/* =========================================================
   style.css — Design tokens & komponen inti
   Palette: Navy / Biru / Cyan dengan aksen ungu, gaya glassmorphism
   ========================================================= */
:root {
    --navy-950: #050b1a;
    --navy-900: #0a1128;
    --navy-800: #101a35;
    --navy-700: #16234a;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --cyan-500: #0ea5e9;
    --cyan-400: #22d3ee;
    --purple-500: #8b5cf6;
    --purple-400: #a78bfa;

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --critical: #db2777;
    --muted: #94a3b8;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-inverse: #f1f5f9;
    --bg-app: #eef2f9;
    --bg-surface: rgba(255, 255, 255, 0.72);
    --bg-surface-solid: #ffffff;
    --border-color: rgba(15, 23, 42, 0.08);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-elevated: 0 20px 45px rgba(15, 23, 42, 0.14);
    --sidebar-w: 264px;
    --font-display: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --bg-app: #060c1c;
    --bg-surface: rgba(16, 26, 53, 0.65);
    --bg-surface-solid: #101a35;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 20px 45px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    background:
        radial-gradient(circle at 10% 0%, rgba(14, 165, 233, .12), transparent 40%),
        radial-gradient(circle at 90% 10%, rgba(139, 92, 246, .12), transparent 40%),
        var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    transition: background .25s ease, color .25s ease;
}
h1, h2, h3, h4, .font-display { font-family: var(--font-display); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--cyan-400); color: #002; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy-950), var(--navy-800));
    color: var(--text-inverse);
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 24px; }
.sidebar-brand .logo-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--cyan-400), var(--purple-500));
    display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff;
    box-shadow: 0 6px 18px rgba(14, 165, 233, .35);
}
.sidebar-brand .app-name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.sidebar-brand .school-name { font-size: 11px; color: #94a3b8; }

.nav-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 18px 10px 8px; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
    color: #cbd5e1; font-size: 14px; font-weight: 500; margin-bottom: 2px; transition: all .15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, rgba(14, 165, 233, .25), rgba(139, 92, 246, .2)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.nav-link .nav-icon { width: 18px; text-align: center; }

.nav-group-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.nav-group-toggle .chevron { transition: transform .2s ease; font-size: 10px; }
.nav-group.open .nav-group-toggle .chevron { transform: rotate(90deg); }
.nav-submenu { max-height: 0; overflow: hidden; padding-left: 10px; transition: max-height .25s ease; }
.nav-group.open .nav-submenu { max-height: 400px; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 24px;
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
}
.hamburger-btn { display: none; background: none; border: none; font-size: 20px; color: var(--text-primary); }
.search-box { flex: 1; max-width: 420px; position: relative; }
.search-box input {
    width: 100%; padding: 10px 14px 10px 38px; border-radius: 999px; border: 1px solid var(--border-color);
    background: var(--bg-surface-solid); color: var(--text-primary); font-size: 13px;
}
.search-box .search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .5; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border-color);
    background: var(--bg-surface-solid); display: flex; align-items: center; justify-content: center;
    position: relative; font-size: 16px;
}
.sync-badge {
    position: absolute; top: -6px; right: -6px; background: var(--warning); color: #fff;
    border-radius: 999px; font-size: 10px; padding: 1px 5px; font-weight: 700;
}
.sync-badge.hidden { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--bg-surface-solid); border: 1px solid var(--border-color); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan-500), var(--purple-500)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-chip .u-name { font-size: 12.5px; font-weight: 600; line-height: 1.1; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-secondary); }

.page-content { padding: 24px; flex: 1; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; margin: 0 0 4px; }
.page-header p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 39; }
.sidebar-overlay.show { display: block; }

/* ---------- Cards ---------- */
.card {
    background: var(--bg-surface); backdrop-filter: blur(14px);
    border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft); padding: 20px;
}
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card {
    background: var(--bg-surface); backdrop-filter: blur(14px); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-soft);
    position: relative; overflow: hidden;
}
.kpi-card::before {
    content: ""; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px; border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, .18), transparent 70%);
}
.kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 26px; font-weight: 800; margin-top: 6px; font-family: var(--font-display); }
.kpi-icon { font-size: 20px; opacity: .8; }

.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.chart-card canvas { max-height: 280px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm);
    border: none; font-weight: 600; font-size: 13.5px; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--cyan-500), var(--blue-600)); color: #fff; box-shadow: 0 8px 20px rgba(37, 99, 235, .3); }
.btn-secondary { background: var(--bg-surface-solid); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-danger { background: linear-gradient(135deg, #f87171, var(--danger)); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-surface-solid); display: inline-flex; align-items: center; justify-content: center; }
.btn-icon.danger { color: var(--danger); }
.fab { position: fixed; bottom: 22px; right: 22px; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan-500), var(--purple-500)); color: #fff; font-size: 24px; box-shadow: var(--shadow-elevated); z-index: 50; border: none; display: none; }

/* ---------- Forms ---------- */
label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    background: var(--bg-surface-solid); color: var(--text-primary); font-size: 13.5px; font-family: inherit;
}
textarea.input { min-height: 70px; resize: vertical; }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-success { background: rgba(34, 197, 94, .15); color: #16a34a; }
.badge-warning { background: rgba(245, 158, 11, .15); color: #b45309; }
.badge-danger { background: rgba(239, 68, 68, .15); color: #dc2626; }
.badge-critical { background: rgba(219, 39, 119, .15); color: #be185d; }
.badge-info { background: rgba(59, 130, 246, .15); color: #2563eb; }
.badge-muted { background: rgba(148, 163, 184, .18); color: #64748b; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); background: rgba(148, 163, 184, .08); padding: 12px 14px; white-space: nowrap; }
table.data-table td { padding: 12px 14px; font-size: 13px; border-top: 1px solid var(--border-color); }
table.data-table tr:hover td { background: rgba(14, 165, 233, .04); }
.table-actions { display: flex; gap: 6px; }
.empty-row { text-align: center; padding: 30px; color: var(--text-secondary); }
.max-w { max-width: 320px; }
.row-late td { background: rgba(239, 68, 68, .06) !important; }

/* ---------- Modal ---------- */
.modal-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(5, 11, 26, .55); backdrop-filter: blur(3px);
    align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal { background: var(--bg-surface-solid); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-elevated); }
.modal-lg { max-width: 760px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-secondary); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--bg-surface-solid); border: 1px solid var(--border-color); border-radius: 12px;
    padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; box-shadow: var(--shadow-elevated);
    transform: translateX(120%); opacity: 0; transition: all .3s ease; max-width: 340px; white-space: pre-line;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* ---------- Loading ---------- */
.loading-overlay { display: none; position: fixed; inset: 0; background: rgba(5, 11, 26, .35); backdrop-filter: blur(2px); z-index: 300; align-items: center; justify-content: center; }
.loading-overlay.show { display: flex; }
.loading-box { background: var(--bg-surface-solid); padding: 24px 30px; border-radius: 16px; text-align: center; box-shadow: var(--shadow-elevated); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border-color); border-top-color: var(--cyan-500); border-radius: 50%; margin: 0 auto 10px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Progress ---------- */
.progress-track { width: 100%; height: 10px; border-radius: 999px; background: rgba(148, 163, 184, .2); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--cyan-500), var(--purple-500)); border-radius: 999px; transition: width .3s ease; }

/* ---------- Misc ---------- */
.chip-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.chip-filter .field { margin-bottom: 0; min-width: 160px; }
.glass-panel { background: var(--bg-surface); backdrop-filter: blur(14px); border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.hidden { display: none !important; }
.text-muted { color: var(--text-secondary); }
.mt-16 { margin-top: 16px; }
.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 12px; }
