/* ============================================================
   SISTEM ATS — Dinas Pendidikan Kabupaten Pamekasan
   Stylesheet Utama
   ============================================================ */

:root {
    --primary:      #1a56a0;
    --primary-dk:   #0f3d7a;
    --primary-lt:   #e8f0fb;
    --accent:       #e8a020;
    --accent-lt:    #fef3dc;
    --success:      #1a8a4a;
    --success-lt:   #e6f7ed;
    --danger:       #c0392b;
    --danger-lt:    #fdecea;
    --warning:      #d68910;
    --warning-lt:   #fef9e7;
    --info:         #1779a0;
    --info-lt:      #e8f4fa;
    --sidebar-w:    260px;
    --topbar-h:     60px;
    --bg:           #f0f4f9;
    --surface:      #ffffff;
    --border:       #dce4ef;
    --text:         #1a2332;
    --text-muted:   #6b7a92;
    --radius:       10px;
    --shadow:       0 2px 12px rgba(26,86,160,0.08);
    --shadow-md:    0 4px 24px rgba(26,86,160,0.13);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary-dk);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform .25s ease;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: grid; place-items: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-title {
    display: block;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: .5px;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
    padding: 16px 8px 6px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all .18s;
    margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-user {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-avatar { font-size: 28px; color: rgba(255,255,255,0.5); margin-top: 1px; }
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.user-sekolah { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(255,255,255,0.15); }
.user-sekolah-name { font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.7); }
.user-sekolah-name i { width: 14px; text-align: center; margin-right: 4px; }
.user-sekolah-npsn { font-size: 10.5px; color: rgba(255,255,255,0.4); margin-top: 5px; padding-left: 18px; }
.logout-btn { color: rgba(255,255,255,0.45); font-size: 16px; transition: color .15s; }
.logout-btn:hover { color: #ff6b6b; }

/* ── MAIN WRAPPER ── */
.main-wrapper {
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-w));
    overflow-x: hidden;
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .25s ease;
}

/* ── TOPBAR ── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.toggle-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 18px; padding: 4px;
    display: none;
}

.topbar-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tahun-badge {
    background: var(--primary-lt);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-sekolah {
    background: var(--primary);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
}
.topbar-sekolah-name { overflow: hidden; text-overflow: ellipsis; }
.topbar-sekolah-npsn { color: rgba(255,255,255,0.75); font-weight: 500; flex-shrink: 0; }
.topbar-sekolah-npsn::before { content: '•'; margin-right: 6px; opacity: .6; }

/* ── CONTENT ── */
.content-area { padding: 24px; }

/* ── FLASH MESSAGE ── */
.flash-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    margin: 0 24px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}
.flash-success { background: var(--success-lt); color: var(--success); border-left: 4px solid var(--success); }
.flash-danger   { background: var(--danger-lt); color: var(--danger); border-left: 4px solid var(--danger); }
.flash-info     { background: var(--info-lt); color: var(--info); border-left: 4px solid var(--info); }
.flash-warning  { background: var(--warning-lt); color: var(--warning); border-left: 4px solid var(--warning); }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 18px; opacity: .5; }

/* ── CARDS ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title i { color: var(--primary); }
.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-lt); color: var(--primary); }
.stat-icon.orange { background: var(--accent-lt); color: var(--accent); }
.stat-icon.green  { background: var(--success-lt); color: var(--success); }
.stat-icon.red    { background: var(--danger-lt); color: var(--danger); }
.stat-icon.info   { background: var(--info-lt); color: var(--info); }
.stat-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ── TABLE ── */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: var(--bg);
    padding: 11px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
thead th.center, td.center { text-align: center; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 10px 12px; vertical-align: middle; }
tbody td .sekolah-name { font-weight: 600; color: var(--text); }
tbody td .npsn { font-size: 11px; color: var(--text-muted); }

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success  { background: var(--success-lt); color: var(--success); }
.badge-warning  { background: var(--warning-lt); color: var(--warning); }
.badge-danger   { background: var(--danger-lt); color: var(--danger); }
.badge-primary  { background: var(--primary-lt); color: var(--primary); }
.badge-info     { background: var(--info-lt); color: var(--info); }
.badge-secondary{ background: #f0f0f0; color: #666; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: all .18s;
    white-space: nowrap;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-sm        { padding: 5px 11px; font-size: 12px; }
.btn-icon      { padding: 6px 10px; }

/* ── FORM ── */
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date],
select, textarea {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .18s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,160,0.1);
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ── Searchable Select (dropdown dengan kotak pencarian) ── */
.search-select { position: relative; }
.search-select-icon {
    position: absolute;
    left: 12px; top: 0; bottom: 0;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}
.search-select-icon svg { width: 14px; height: 14px; display: block; }
.search-select-input {
    padding: 9px 12px 9px 36px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .18s;
    width: 100%;
    cursor: text;
}
.search-select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,160,0.1);
}
.search-select.invalid .search-select-input { border-color: var(--danger); }
.search-select.no-icon .search-select-input { padding-left: 12px; }
.search-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}
.search-select-dropdown.open { display: block; }
.search-select-option {
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
}
.search-select-option:hover,
.search-select-option.highlighted { background: var(--primary-lt); color: var(--primary); }
.search-select-option.active { font-weight: 600; color: var(--primary); }
.search-select-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 500;
    display: none;
    place-items: center;
}
.modal-overlay.open { display: grid; }
.modal-box {
    background: var(--surface);
    border-radius: 14px;
    width: min(500px, 95vw);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity:0; } }
.modal-head {
    padding: 18px 22px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-head h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 20px; cursor: pointer; }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-header h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: var(--text); }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar select, .filter-bar input { max-width: 200px; }
.filter-bar .search-input { flex: 1; min-width: 200px; max-width: 320px; }

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-left: 0 !important;
}
.login-left {
    background: linear-gradient(150deg, var(--primary-dk) 0%, var(--primary) 60%, #2980d4 100%);
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
}
.login-left::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    top: -100px; right: -100px;
}
.login-left::after {
    content: '';
    position: absolute;
    width: 250px; height: 250px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    bottom: -50px; left: -50px;
}
.login-left .logo-big { font-size: 56px; margin-bottom: 24px; }
.login-left h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 32px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.login-left p { font-size: 15px; opacity: .75; line-height: 1.6; }
.login-right {
    background: var(--surface);
    padding: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}
.login-right-grid {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 100%;
}
.login-form-col {
    flex: 0 0 420px;
    width: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
}
.login-stats-col {
    flex: 1 1 0;
    min-width: 0;
    background: var(--bg);
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--border);
}
.login-stats-title {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); margin-bottom: 14px;
}
.login-stat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.login-stat-item:last-of-type { border-bottom: none; }
.login-stat-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
}
.login-stat-num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.1; }
.login-stat-label { font-size: 10.5px; color: var(--text-muted); }
.login-stats-note { font-size: 10px; color: var(--text-muted); margin-top: 12px; line-height: 1.5; }
.login-right h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-right .sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 32px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; margin-bottom: 6px; }
.login-btn { width: 100%; padding: 12px; font-size: 15px; border-radius: 10px; margin-top: 8px; }
.login-footer { margin-top: 24px; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ── CHART CONTAINER ── */
.chart-wrap { position: relative; height: 280px; }

/* ── IMPORT DROP ZONE ── */
.dropzone {
    border: 2.5px dashed var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--bg);
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-lt);
}
.dropzone i { font-size: 40px; color: var(--text-muted); margin-bottom: 12px; display: block; }
.dropzone p { color: var(--text-muted); font-size: 14px; }
.dropzone strong { color: var(--primary); }

/* ── PAGINATION ── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.page-link {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: all .15s;
}
.page-link:hover { background: var(--primary-lt); border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper {
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-w));
    overflow-x: hidden; margin-left: 0; }
    .toggle-btn { display: block; }
    .login-page { grid-template-columns: 1fr; }
    .login-left { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar-sekolah { max-width: 150px; }
    .topbar-sekolah-npsn { display: none; }
}

@media (max-width: 480px) {
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .login-right { padding: 0; }
    .login-right-grid { flex-direction: column; }
    .login-form-col { padding: 40px 28px; max-width: 100%; }
    .login-stats-col { display: none; }
    .topbar-sekolah { display: none; }
}


/* ============================================================
   Session Timeout Overlay
   ============================================================ */
#session-timeout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay .25s ease;
}
@keyframes fadeInOverlay { from { opacity:0 } to { opacity:1 } }

.sto-box {
    background: var(--surface, #fff);
    border-radius: 16px;
    padding: 40px 36px 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.sto-icon {
    width: 64px; height: 64px;
    background: var(--warning-lt, #fff8e1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--warning, #f59e0b);
}
.sto-box h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    color: var(--text, #1e293b);
}
.sto-box p {
    color: var(--text-muted, #64748b);
    margin: 0 0 24px;
    font-size: .95rem;
    line-height: 1.6;
}
.sto-box #sto-countdown {
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}
