/* ============================================================
   ITA Upload System — Custom CSS
   ============================================================ */
   :root {
    --ita-red:       #C0392B;
    --ita-red-dark:  #922b21;
    --ita-red-light: #f9ebea;
    --ita-green:     #1e8449;
    --ita-blue:      #1a5276;
    --ita-gray:      #f4f6f7;
    --ita-border:    #e0e0e0;
    --navbar-h:      60px;
    --radius:        8px;
    --shadow:        0 2px 8px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    font-size: 15px;
    margin: 0;
    padding-top: var(--navbar-h);
}

/* ── Navbar ─────────────────────────────────────────────── */
.ita-navbar {
    background: var(--ita-red);
    height: var(--navbar-h);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
}
.ita-navbar .brand-logo {
    width: 40px; height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ita-navbar .brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.ita-navbar .brand-text { color: #fff; flex: 1; }
.ita-navbar .brand-name { font-size: .95rem; font-weight: 700; line-height: 1.2; }
.ita-navbar .brand-sub  { font-size: .72rem; opacity: .75; line-height: 1; }
.navbar-actions { display: flex; align-items: center; gap: .5rem; }

/* Staff mode bar */
.staff-bar {
    background: #145a32;
    color: #d5f5e3;
    font-size: .78rem;
    padding: .3rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Login button ───────────────────────────────────────── */
.btn-login-nav {
    background: rgba(255,255,255,.15);
    border: 1.5px solid rgba(255,255,255,.4);
    color: #fff;
    border-radius: 6px;
    padding: .3rem .85rem;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: .4rem;
    transition: all .2s;
    white-space: nowrap;
}
.btn-login-nav:hover { background: rgba(255,255,255,.25); }
.btn-login-nav i { color: #ffd700; }

/* Staff badge */
.staff-badge {
    display: flex; align-items: center; gap: .5rem;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 8px;
    padding: .25rem .65rem;
}
.staff-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; color: #fff;
}
.staff-name { font-size: .78rem; font-weight: 700; color: #fff; line-height: 1.2; }
.staff-role { font-size: .65rem; color: rgba(255,255,255,.65); line-height: 1; }

/* ── Hero Banner ─────────────────────────────────────────── */
.hero-banner {
    background: linear-gradient(135deg, var(--ita-red) 0%, #8e1a0e 100%);
    color: #fff;
    padding: 2rem 0 3.5rem;
    position: relative;
    overflow: hidden;
}
.hero-banner::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 40px;
    background: #f0f2f5;
    clip-path: ellipse(55% 100% at 50% 100%);
}
.hero-title { font-size: 1.6rem; font-weight: 800; line-height: 1.3; }
.hero-sub   { font-size: .9rem; opacity: .85; }
.hero-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 20px;
    padding: .25rem .85rem;
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: .75rem;
}

/* FY selector in hero */
.fy-tabs-wrap { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.fy-tab {
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.3);
    color: rgba(255,255,255,.85);
    border-radius: 20px;
    padding: .25rem .85rem;
    font-size: .82rem; font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex; align-items: center; gap: .3rem;
}
.fy-tab.active, .fy-tab:hover {
    background: rgba(255,255,255,.9);
    color: var(--ita-red);
    border-color: transparent;
}
.fy-current-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
}

/* Stats */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin-top: 1rem;
}
.hstat {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius);
    padding: .85rem;
    text-align: center;
}
.hstat-val { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.hstat-label { font-size: .72rem; opacity: .8; margin-top: .2rem; }

/* ── Main content ─────────────────────────────────────────── */
.main-content { padding: 1.5rem 0 4rem; }

/* Section card */
.section-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.section-header {
    background: var(--ita-blue);
    color: #fff;
    padding: .75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.section-title { font-size: 1rem; font-weight: 700; margin: 0; }
.section-num-badge {
    background: rgba(255,255,255,.2);
    border-radius: 20px;
    padding: .15rem .7rem;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Indicator row */
.indicator-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--ita-border);
    transition: background .15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.indicator-row:last-child { border-bottom: none; }
.indicator-row:hover { background: #fafafa; }
.moit-badge {
    background: var(--ita-red);
    color: #fff;
    border-radius: 5px;
    padding: .25rem .65rem;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.moit-name { flex: 1; font-size: .88rem; line-height: 1.4; }
.moit-stats { display: flex; gap: .5rem; flex-shrink: 0; }
.stat-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--ita-gray);
    border-radius: 20px;
    padding: .2rem .6rem;
    font-size: .72rem;
    color: #555;
    white-space: nowrap;
}
.stat-chip.green { background: #d5f5e3; color: var(--ita-green); }

/* ── Indicator Detail Page ─────────────────────────────────── */
.page-header-bar {
    background: #fff;
    border-bottom: 1px solid var(--ita-border);
    padding: .5rem 0;
}
.indicator-banner {
    background: linear-gradient(135deg, var(--ita-blue), #1a3a5c);
    color: #fff;
    padding: 1.5rem 0;
}
.indicator-banner .moit-code-big {
    font-size: 1rem; font-weight: 800;
    background: rgba(255,255,255,.15);
    border-radius: 6px; padding: .2rem .75rem;
    display: inline-block; margin-bottom: .5rem;
}

/* Items table */
.items-table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table thead th {
    background: var(--ita-gray);
    padding: .75rem 1rem;
    font-size: .82rem;
    font-weight: 700;
    color: #555;
    border-bottom: 2px solid var(--ita-border);
    white-space: nowrap;
}
.items-table tbody td {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--ita-border);
    vertical-align: top;
}
.items-table tbody tr:last-child td { border-bottom: none; }
.items-table tbody tr:hover { background: #fafafa; }

.item-num-badge {
    display: inline-block;
    background: var(--ita-red-light);
    color: var(--ita-red);
    border: 1px solid #f5b7b1;
    border-radius: 5px;
    padding: .15rem .55rem;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Evidence radio */
.evidence-radio { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.ev-label {
    display: flex; align-items: center; gap: .3rem;
    cursor: pointer; font-size: .85rem; font-weight: 500;
    padding: .3rem .7rem;
    border-radius: 6px;
    border: 1.5px solid var(--ita-border);
    transition: all .15s;
    white-space: nowrap;
}
.ev-label input { display: none; }
.ev-label.yes:has(input:checked)  { background: #d5f5e3; border-color: #1e8449; color: #1e8449; }
.ev-label.no:has(input:checked)   { background: #fadbd8; border-color: #c0392b; color: #c0392b; }
.ev-label:hover { background: var(--ita-gray); }

/* File upload zone */
.upload-zone {
    border: 2px dashed #c8c8c8;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--ita-gray);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--ita-red);
    background: var(--ita-red-light);
}
.upload-zone .upload-icon { font-size: 2rem; color: #aaa; display: block; margin-bottom: .4rem; }

/* File item */
.file-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .7rem 1rem;
    border-radius: 7px;
    border: 1px solid var(--ita-border);
    background: #fff;
    margin-bottom: .5rem;
    transition: box-shadow .15s;
}
.file-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.file-icon {
    width: 42px; height: 42px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 800;
    flex-shrink: 0; color: #fff;
}
.file-icon.pdf   { background: #e74c3c; }
.file-icon.word  { background: #2980b9; }
.file-icon.excel { background: #27ae60; }
.file-icon.other { background: #7f8c8d; }

/* Link copy toast */
.copy-toast {
    position: fixed; bottom: 1.5rem; left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #27ae60;
    border-radius: 10px;
    padding: .75rem 1.1rem;
    display: flex; align-items: center; gap: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 9999; opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
    pointer-events: none; min-width: 220px;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Admin Page ─────────────────────────────────────────────── */
.admin-sidebar {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.admin-nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--ita-border);
    cursor: pointer;
    transition: background .15s;
    font-weight: 500; font-size: .9rem;
    color: #444;
    text-decoration: none;
}
.admin-nav-item:hover, .admin-nav-item.active {
    background: var(--ita-red-light);
    color: var(--ita-red);
}
.admin-nav-item i { width: 20px; text-align: center; }

/* ── Login Modal ────────────────────────────────────────────── */
.login-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--ita-red), #8e1a0e);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    font-size: 1.8rem; color: #fff;
    box-shadow: 0 8px 24px rgba(192,57,43,.35);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero-title { font-size: 1.3rem; }
    .hero-stats { grid-template-columns: 1fr 1fr; }
    .hstat-val  { font-size: 1.4rem; }
    .indicator-row { flex-wrap: wrap; }
    .moit-stats { display: none; }
    .items-table thead th:nth-child(3),
    .items-table tbody td:nth-child(3) { display: none; }
}
@media (max-width: 576px) {
    .hero-stats { grid-template-columns: 1fr 1fr 1fr; }
    .ita-navbar .brand-sub { display: none; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.section-card { animation: fadeUp .3s ease both; }
.section-card:nth-child(2) { animation-delay: .05s; }
.section-card:nth-child(3) { animation-delay: .1s; }

/* SweetAlert Thai */
.swal2-popup { font-family: 'Sarabun','Noto Sans Thai',sans-serif !important; border-radius: 12px !important; }
.swal2-title { font-size: 1.15rem !important; }
.swal2-html-container { font-size: .9rem !important; }

/* Progress bar */
.ita-progress { height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); margin-top: .4rem; }
.ita-progress-fill { height: 100%; border-radius: 3px; background: #2ecc71; transition: width .4s ease; }

/* Note textarea */
.note-area { border-radius: 6px; border: 1.5px solid var(--ita-border); font-family: inherit; font-size: .88rem; resize: vertical; padding: .6rem .85rem; width: 100%; transition: border-color .2s; }
.note-area:focus { outline: none; border-color: var(--ita-blue); box-shadow: 0 0 0 3px rgba(26,82,118,.1); }

/* Badge utils */
.badge-section { background: #1a5276; color: #fff; border-radius: 4px; padding: .15rem .55rem; font-size: .72rem; }
.bg-success-soft { background: #d5f5e3; color: #1e8449; }
.bg-danger-soft  { background: #fadbd8; color: #c0392b; }
.bg-gray-soft    { background: #ecf0f1; color: #7f8c8d; }

/* ================================================================
   ITEM GROUP HEADER ROW  — เหมือนแถบแดงใน MITAS
   ================================================================ */
tr.item-group-header td {
    padding: 0 !important;
    border-bottom: 1px solid rgba(192,57,43,.25) !important;
}
.item-group-header-inner {
    background: linear-gradient(90deg, #c0392b 0%, #9b2335 100%);
    color: #fff;
    padding: .65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.item-group-title {
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.4;
    flex: 1;
}
.item-group-num {
    background: rgba(255,255,255,.18);
    border-radius: 4px;
    padding: .1rem .5rem;
    margin-right: .5rem;
    font-size: .85rem;
    white-space: nowrap;
}
.item-score-badge {
    background: #fbbf24;
    color: #7c2d12;
    font-weight: 800;
    border-radius: 20px;
    padding: .2rem .85rem;
    font-size: .8rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
/* Row ที่อยู่ใต้ header ให้มี left border สีแดงเบาๆ */
tr.item-group-header + tr td:first-child {
    border-left: 3px solid #f5b7b1;
}

/* ── Type Radio Tabs (Add Modal) ─────────────────── */
.type-radio-label {
    flex: 1;
    border: 2px solid var(--ita-border);
    border-radius: 8px;
    padding: .6rem .9rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
    text-align: center;
    transition: all .2s;
    color: #555;
    line-height: 1.3;
    user-select: none;
}
.type-radio-label:hover {
    border-color: #aaa;
    background: var(--ita-gray);
}
.type-radio-label.active {
    border-color: var(--ita-red);
    background: var(--ita-red-light);
    color: var(--ita-red);
}
.type-radio-label.active i { color: var(--ita-red); }