/* ===================================================================================
   ข้อมูลหลักสูตร (CurriculumInfo)
   -----------------------------------------------------------------------------------
   สไตล์ของหน้าข้อมูลหลักสูตรอยู่ไฟล์เดียวกันหมด ไม่ปนกับ css หลักของระบบ (app.css / style.css)
   เดิมกระจายอยู่ในบล็อก <style> ของแต่ละ component ใต้ Components/Pages/Private/CurriculumInfo
   ซึ่งเป็น global อยู่แล้ว แต่มีผลเฉพาะตอน component นั้นถูก render และถูกฉีดซ้ำทุกครั้งที่ render
   =================================================================================== */


/* =========================================================
   GeneralInfo/QualityAssurance.razor
   ========================================================= */
.kl-chip-soft {
    background-color: rgba(33, 150, 243, 0.10) !important;
    border-color: rgba(33, 150, 243, 0.35) !important;
}


/* =========================================================
   LearningOutcomes/FilePLO.razor, Other/Fee/FeeFile.razor — การ์ดไฟล์ (สองไฟล์ใช้ชุดเดียวกัน)
   ========================================================= */
.plo-mini {
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(255,255,255,.9);
    box-shadow: 0 8px 22px rgba(0,0,0,.05);
}

.plo-icon {
    background: rgba(220,38,38,.12);
    color: #dc2626;
    border-radius: 12px;
}

.plo-filename {
    font-weight: 600;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 620px;
}

.plo-btn {
    border-radius: 12px;
}

.min-w-0 {
    min-width: 0;
}


/* =========================================================
   StudyPlan/PloMappingInfo.razor
   ========================================================= */
/* Override MudBlazor overflow:hidden so position:sticky works */
.plo-table-wrapper .mud-table,
.plo-table-wrapper .mud-table-container {
    overflow: visible !important;
}
/* Sticky thead — both header rows stick together as one unit */
.plo-table-wrapper thead {
    position: sticky;
    top: 0;
    z-index: 5;
}


    .plo-table-wrapper thead th {
        padding: 4px 8px !important;
        background: #f5f5f5;
    }
/* Sticky body columns */
.plo-sc {
    position: sticky;
    z-index: 2;
}

.plo-sc-1 {
    left: 0;
}

.plo-sc-2 {
    left: 160px;
}


/* =========================================================
   StudyPlan/SubjectInfo/SubjectManage.razor
   ========================================================= */
.sm-rev-tabs-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sm-rev-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 12px 16px 10px;
    border: 1.5px solid #e5e7eb;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    background: #f9fafb;
    text-align: center;
    user-select: none;
    min-width: 140px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sm-rev-tab:hover { background: #f3f4f6; }

.sm-rev-tab__title {
    font-size: 0.80rem;
    font-weight: 700;
    color: #9ca3af;
}

.sm-rev-tab__count {
    font-size: 0.70rem;
    color: #9ca3af;
}

/* tab ก่อนปรับปรุง (active) */
.sm-rev-tab--active {
    background: white;
    border-color: #6b7280;
}
.sm-rev-tab--active .sm-rev-tab__title { color: #374151; }
.sm-rev-tab--active .sm-rev-tab__count { color: #6b7280; }

/* tab ปรับปรุงย่อย (ไม่ active) */
.sm-rev-tab--rev {
    border-color: #fed7aa;
    background: #fff7ed;
}
.sm-rev-tab--rev .sm-rev-tab__title { color: #c2410c; }
.sm-rev-tab--rev .sm-rev-tab__count { color: #ea580c; }
.sm-rev-tab--rev:hover { background: #ffedd5; }

/* tab ปรับปรุงย่อย (active) */
.sm-rev-tab--active-rev {
    background: #fff7ed;
    border-color: #f97316;
}
.sm-rev-tab--active-rev .sm-rev-tab__title { color: #9a3412; font-weight: 800; }

.sm-rev-content {
    border: 1.5px solid #e5e7eb;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: white;
}


/* =========================================================
   StudyPlan/SubjectInfo/SubjectRevisionHistory.razor
   ========================================================= */
.rvl-diff-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    font-size: 12px;
    border: 1px solid #e2e8f0;
}

.rvl-diff-table th {
    font-weight: 700;
    text-align: left;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 0.2px;
    background: #eff6ff;
    color: #1e40af;
    border-bottom: 1px solid #e2e8f0;
}

.rvl-diff-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    font-size: 0.78rem;
}

.rvl-diff-table tbody tr:last-child td { border-bottom: none; }
.rvl-diff-table tbody tr:nth-child(even) td { background: #fafafa; }

.clo-diff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border: 1px solid #ede9fe;
    border-radius: 8px;
    overflow: hidden;
}

.clo-diff-table th {
    font-weight: 700;
    text-align: left;
    padding: 5px 10px;
    font-size: 11px;
    background: #f5f3ff;
    color: #5b21b6;
    border-bottom: 1px solid #ede9fe;
}

.clo-diff-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f5f3ff;
    vertical-align: top;
    font-size: 0.78rem;
}

.clo-diff-table tbody tr:last-child td { border-bottom: none; }


/* =========================================================
   StudyPlan/SubjectInfo/SubjectUsageInfo.razor
   ========================================================= */
.sui-section-title {
    font-size: .8rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 8px;
}

.sui-section-count {
    font-weight: 400;
    color: #64748b;
    text-transform: none;
    letter-spacing: 0;
}

.sui-table-wrap {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    overflow: auto;
    background: #ffffff;
}

.sui-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    color: #1e293b;
}

.sui-table thead tr {
    background: #f1f5f9;
}

.sui-table thead th {
    padding: 9px 12px;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
}

.sui-table thead th:last-child {
    border-right: none;
}

.sui-table tbody td {
    padding: 8px 12px;
    vertical-align: top;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    line-height: 1.5;
}

.sui-table tbody td:last-child {
    border-right: none;
}

.sui-table__id-inline {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    color: #475569;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 2px;
    margin-right: 6px;
    white-space: nowrap;
    vertical-align: middle;
}

.sui-major-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    color: #4338ca;
    background: #ede9fe;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: normal;
    line-height: 1.4;
}

.sui-variant-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    color: #0369a1;
    background: #e0f2fe;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: normal;
    line-height: 1.4;
}

.sui-status-badge {
    display: inline-block;
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 2px;
    white-space: nowrap;
}

.sui-empty {
    text-align: center;
    padding: 32px;
    color: #94a3b8;
    font-style: italic;
    font-size: .875rem;
}


/* =========================================================
   StudyPlan/plan2/PloMappingDetail2.razor
   ::deep ใช้ได้เฉพาะไฟล์ .razor.css — 3 rule ของ .plo-set-tabs ด้านล่างไม่มีผลมาตั้งแต่อยู่ในบล็อก <style> เดิม (คงไว้ตามเดิม)
   ========================================================= */
.plo-table-wrapper2 {
    overflow: auto;
    max-height: 600px;
    border: 1px solid #eeeeee;
    border-radius: 10px;
}

.plo-table-wrapper2 thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.plo-table-wrapper2 thead th {
    background: #D4E5F7;
    color: #1a3252;
    font-weight: 600;
}

.plo-set-tabs ::deep .mud-tabs-toolbar {
    background: transparent;
}

.plo-set-tabs ::deep .mud-tab {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e40af;
}

.plo-set-tabs ::deep .mud-tab.mud-tab-active {
    background: #dbeafe;
    border-radius: 8px;
}


/* =========================================================
   StudyPlan/plan2/StructurePlanViewDialog2.razor, StudyPlanViewDialog2.razor — dialog ดูแผน (สองไฟล์ใช้ชุดเดียวกัน)
   ========================================================= */
.study-plan-view-dialog2 {
    height: 85vh;
}

.study-plan-view-dialog2 .mud-dialog-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* ซ่อนปุ่มเพิ่ม/ลบ/แก้ไขในเนื้อหา ยกเว้น tab */
.study-plan-view-dialog2 .mud-dialog-content .mud-button-root:not(.mud-tab) {
    display: none !important;
}

.study-plan-view-dialog2 .mud-dialog-content .mud-icon-button {
    display: none !important;
}


/* =========================================================
   StudyPlan/plan2/StudentPlanDetail2.razor
   ========================================================= */
/* หัวการ์ดแผนการรับ — กดที่ชื่อแผนเพื่อกาง/ยุบ รูปแบบเดียวกับแท็บแผนการศึกษา */
.admission-plan-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    flex: 1 1 auto;
    min-width: 0;
}

/* หัวข้อวิชาเอกและการ์ดแผนในวิชาเอก — เยื้องหนึ่งชั้นใต้หัวข้อปริญญา ระยะเดียวกับ .sp-major-block ของหน้าแผนการศึกษา
   (หน้านี้วางหัวข้อกับการ์ดเรียงกันในชั้นเดียว จึงเยื้องทีละตัวแทนการครอบกล่อง) */
.adm-major-indent {
    margin-left: 16px;
}

@media (max-width: 600px) {
    .adm-major-indent {
        margin-left: 4px;
    }
}

/* เนื้อหาในการ์ด — หน้าตาตามฟอร์มกรอก (StudentPlanTabForm.razor.css) คัดมาเฉพาะส่วนแสดงผล
   ใช้ชื่อ class adm-info-* ของตัวเอง เพราะ style นี้เป็น global ถ้าใช้ชื่อเดียวกับฟอร์มจะไปทับฟอร์มด้วย */
.adm-info-panel {
    margin-top: 4px;
    overflow: hidden;
    border: 1px solid #dce4e9;
    border-radius: 16px;
    background: #fff;
}

.adm-info-table {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* หัวตาราง — สีชุดเดียวกับกล่อง "ค่าธรรมเนียมกลางของหลักสูตร" (CurriculumFeeInfo) ฟ้าอ่อนไล่สี ตัวหนังสือน้ำเงิน */
.adm-info-table .mud-table-head th {
    height: 48px;
    border-bottom: 2px solid #1976d2;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    color: #1565c0 !important;
}

.adm-info-table .mud-table-foot td {
    height: 48px;
    border-bottom: 0;
    background: #173f5f !important;
    color: #fff !important;
}

.adm-info-table .mud-table-body tr:nth-child(even) td:not(.bg-light-gray) {
    background: #f7f9f8;
}


/* =========================================================
   StudyPlan/plan2/StudentPlanViewDialog2.razor
   ========================================================= */
.student-plan-view-dialog2 {
    height: 85vh;
}

.student-plan-view-dialog2 .mud-dialog-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}


/* =========================================================
   StudyPlan/plan2/StudyPlanStructureDetail2.razor
   ครอบด้วย .sp-structure-detail2 (class บน root ของ component) เพราะ CurriculumStructureTabForm (ฟอร์มกรอก)
   ใช้ชื่อ class ชุดเดียวกัน (cst-*, detail-card, plan-detail-*, plo-row-*) — ไม่ครอบจะไปทับหน้าฟอร์ม
   ========================================================= */
:root {
    --cst-primary-dark: #1e3a5f;
    --cst-primary: #335c81;
    --cst-primary-soft: #f5f8fb;
    --cst-primary-soft-strong: #e8eef5;
    --cst-primary-border: rgba(51, 92, 129, 0.16);
    --cst-primary-shadow: rgba(30, 58, 95, 0.12);
    --cst-ink: #0f172a;
    --cst-muted: #475569;
    --cst-subtle-border: #e2e8f0;
}

.sp-structure-detail2 .cst-major-plan-panels {
    border-radius: 18px;
    border: 1px solid rgba(51, 92, 129, 0.14);
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.sp-structure-detail2 .cst-major-plan-panel {
    border-radius: 18px !important;
    background: radial-gradient(circle at 100% 0%, rgba(51, 92, 129, 0.08), transparent 26%),
                linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}

.sp-structure-detail2 .cst-major-title { color: var(--cst-ink); font-weight: 800 !important; line-height: 1.3; }
.sp-structure-detail2 .cst-major-caption { color: var(--cst-muted) !important; font-weight: 600 !important; }
.sp-structure-detail2 .cst-unassigned-alert { border-radius: 14px !important; background: #fffaf0 !important; }

.sp-structure-detail2 .cst-data-grid .mud-table-root {
    border-radius: 16px; overflow: hidden; border: none;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
}

.sp-structure-detail2 .cst-data-grid .mud-table-head th {
    background: var(--cst-primary) !important;
    color: white !important; font-weight: 600 !important; font-size: 0.875rem;
}

.sp-structure-detail2 .cst-data-grid .mud-table-head th,
.sp-structure-detail2 .cst-data-grid .mud-table-body td { border-bottom: 1px solid #edf3fb; }

.sp-structure-detail2 .cst-data-grid .mud-table-body tr:last-child td { border-bottom: none; }

.sp-structure-detail2 .cst-data-grid .mud-table-body .mud-table-row:hover td {
    background-color: var(--cst-primary-soft) !important;
    transition: background-color 0.15s ease;
}

.sp-structure-detail2 .plan-detail-row { width: 100%; background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%); }

/* ชื่อแผน + ลูกศรหน้าชื่อ = ปุ่มกาง/พับการ์ดแผน (แทนปุ่มลูกศรท้ายแถวเดิม) */
.sp-structure-detail2 .plan-title-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    flex: 1 1 auto;
    min-width: 0;
}

.sp-structure-detail2 .plan-detail-paper {
    width: 100%; max-width: 100%; box-sizing: border-box;
    background: radial-gradient(circle at 0% 0%, rgba(51, 92, 129, 0.08), transparent 28%),
                linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
    border: 1px solid var(--cst-primary-border);
    border-radius: 22px !important;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.sp-structure-detail2 .detail-card {
    border-radius: 18px !important; overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
}

.sp-structure-detail2 .detail-card:hover {
    border-color: rgba(51, 92, 129, 0.28) !important;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.075) !important;
    transform: translateY(-1px);
}

.sp-structure-detail2 .cst-section-header {
    padding: 14px 18px !important;
    background: linear-gradient(90deg, #f8fbff 0%, #ffffff 100%) !important;
    border-bottom: 1px solid #e8eef5;
}

.sp-structure-detail2 .cst-section-icon {
    width: 34px !important; height: 34px !important; padding: 7px;
    border-radius: 12px; color: var(--cst-primary) !important;
    background: var(--cst-primary-soft); border: 1px solid var(--cst-primary-border);
}

.sp-structure-detail2 .cst-section-title { color: var(--cst-ink); font-weight: 800; font-size: 1rem !important; }
.sp-structure-detail2 .cst-detail-content { padding: 18px !important; }

.sp-structure-detail2 .cst-detail-list-item {
    border: 1px solid #e6edf5;
    border-left: 4px solid var(--cst-primary);
    border-radius: 14px !important;
    background: #fbfdff !important;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sp-structure-detail2 .cst-empty-state {
    display: flex; align-items: flex-start; gap: 12px; padding: 16px;
    border: 1px dashed #cbd8e6; border-radius: 14px;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}

.sp-structure-detail2 .cst-empty-icon {
    width: 34px; height: 34px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: var(--cst-primary); background: #eef4fa;
    border: 1px solid var(--cst-primary-border);
}

.sp-structure-detail2 .cst-empty-title { color: var(--cst-ink); font-weight: 800; margin-bottom: 2px; }
.sp-structure-detail2 .cst-empty-text { color: var(--cst-muted); line-height: 1.6; }

.sp-structure-detail2 .criteria-item { border-radius: 12px !important; transition: background-color 0.15s ease; }
.sp-structure-detail2 .criteria-number { min-width: 32px; height: 28px; font-weight: 600; }

.sp-structure-detail2 .cst-main-caption { color: var(--cst-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.sp-structure-detail2 .cst-sub-caption { color: var(--cst-primary-dark); font-weight: 700; }

.sp-structure-detail2 .curriculum-structure-grid .mud-table-row-detail .mud-table-cell { padding: 0; }

.sp-structure-detail2 .plo-row-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border: 1px solid #e6eefb;
    border-radius: 12px; background: #fbfdff; line-height: 1.5; margin-bottom: 8px;
}

.sp-structure-detail2 .plo-row-item:last-child { margin-bottom: 0; }

.sp-structure-detail2 .plo-row-code {
    flex-shrink: 0; font-weight: 700; color: white;
    background: var(--cst-primary); border-radius: 999px;
    padding: 3px 10px; font-size: 0.875rem; min-width: 58px; text-align: center;
}

.sp-structure-detail2 .plo-row-detail { color: var(--cst-muted); font-size: 0.875rem; }

.sp-structure-detail2 .admission-qualification-content { color: var(--cst-muted); line-height: 1.8; }
.sp-structure-detail2 .admission-qualification-content ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.sp-structure-detail2 .admission-qualification-content li { margin-bottom: 0.75rem; line-height: 1.8; }
.sp-structure-detail2 .admission-qualification-content li:last-child { margin-bottom: 0; }
.sp-structure-detail2 .admission-qualification-content p { margin-bottom: 0.5rem; }


/* =========================================================
   StudyPlan/plan2/SubjectManageDetail2.razor — ใช้ร่วมกับ LecturersInfo.razor / LecturersSInfo.razor
   ========================================================= */
.sm2-rev-tabs-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sm2-rev-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 12px 16px 10px;
    border: 1.5px solid #e5e7eb;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    background: #f9fafb;
    text-align: center;
    user-select: none;
    min-width: 140px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sm2-rev-tab:hover { background: #f3f4f6; }

.sm2-rev-tab__title {
    font-size: 0.80rem;
    font-weight: 700;
    color: #9ca3af;
}

.sm2-rev-tab__count {
    font-size: 0.70rem;
    color: #9ca3af;
}

.sm2-rev-tab--active {
    background: white;
    border-color: #6b7280;
}
.sm2-rev-tab--active .sm2-rev-tab__title { color: #374151; }
.sm2-rev-tab--active .sm2-rev-tab__count { color: #6b7280; }

.sm2-rev-tab--rev {
    border-color: #fed7aa;
    background: #fff7ed;
}
.sm2-rev-tab--rev .sm2-rev-tab__title { color: #c2410c; }
.sm2-rev-tab--rev .sm2-rev-tab__count { color: #ea580c; }
.sm2-rev-tab--rev:hover { background: #ffedd5; }

.sm2-rev-tab--active-rev {
    background: #fff7ed;
    border-color: #f97316;
}
.sm2-rev-tab--active-rev .sm2-rev-tab__title { color: #9a3412; font-weight: 800; }

.sm2-rev-content {
    border: 1.5px solid #e5e7eb;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: white;
}
