/* =========================================================
   Bank Soal Madrasah — app.css
   ========================================================= */

:root {
    --sb-width: 264px;
    --brand: #2f6fed;
    --brand-dark: #1e4fb8;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e6e9ef;
    --surface: #ffffff;
    --canvas: #f4f6fb;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body.app-body {
    background: var(--canvas);
    color: var(--ink);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
}

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

/* ---------------------------------------------------------
   Sidebar
   --------------------------------------------------------- */
.app-sidebar {
    width: var(--sb-width);
    flex: 0 0 var(--sb-width);
    background: linear-gradient(180deg, #12224a 0%, #0e1a37 100%);
    color: #cbd5f5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.15rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-badge {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand), #6aa0ff);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(47, 111, 237, .45);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: .98rem; letter-spacing: .2px; }
.brand-text small { color: #93a4d4; font-size: .7rem; }

.btn-close-sb {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: #cbd5f5;
    font-size: 1.1rem;
    line-height: 1;
    padding: .25rem .4rem;
    border-radius: 8px;
}
.btn-close-sb:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .9rem .7rem 1rem; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 99px; }

.nav-group { margin-bottom: 1.1rem; }

.nav-group-title {
    font-size: .66rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #7b8cc4;
    padding: 0 .7rem;
    margin-bottom: .4rem;
    font-weight: 700;
}

.nav-link-sb {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .58rem .7rem;
    border-radius: 10px;
    color: #cbd5f5;
    text-decoration: none;
    font-size: .875rem;
    margin-bottom: 3px;
    transition: background .15s ease, color .15s ease;
}
.nav-link-sb:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.nav-link-sb.is-active {
    background: linear-gradient(90deg, var(--brand), #4d84ff);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(31, 78, 183, .4);
}

.nav-icon {
    width: 22px;
    display: inline-flex;
    justify-content: center;
    font-size: .9rem;
    opacity: .9;
}

.sidebar-foot {
    padding: .85rem .8rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; padding: 0 .2rem; }

.user-avatar {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-meta strong { color: #fff; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: #93a4d4; font-size: .65rem; letter-spacing: .08em; }

.btn-logout {
    background: rgba(239, 68, 68, .16);
    border: 1px solid rgba(239, 68, 68, .35);
    color: #fecaca;
    font-size: .84rem;
    padding: .5rem;
    border-radius: 10px;
}
.btn-logout:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 1035;
}

/* ---------------------------------------------------------
   Main
   --------------------------------------------------------- */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: .85rem 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-eyebrow {
    font-size: .66rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 700;
}

.topbar-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -.2px; }

.app-content { flex: 1; padding: 1.35rem; }

.app-foot {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: .8rem 1.35rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--muted);
}

/* ---------------------------------------------------------
   Komponen konten
   --------------------------------------------------------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}
.page-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .2rem; }
.page-head p { margin: 0; color: var(--muted); font-size: .86rem; }

.card-app {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    overflow: hidden;
}

.card-app > .card-head {
    padding: .95rem 1.15rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.card-head h3 { font-size: .95rem; font-weight: 700; margin: 0; }
.card-app > .card-body { padding: 1.15rem; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.1rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    height: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16, 24, 40, .08); }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid; place-items: center;
    font-size: 1.1rem;
    color: #fff;
    flex: 0 0 46px;
}
.stat-icon.bg-brand { background: linear-gradient(135deg, #2f6fed, #6aa0ff); }
.stat-icon.bg-green  { background: linear-gradient(135deg, #16a34a, #4ade80); }
.stat-icon.bg-amber  { background: linear-gradient(135deg, #d97706, #fbbf24); }
.stat-icon.bg-violet { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.stat-icon.bg-rose   { background: linear-gradient(135deg, #e11d48, #fb7185); }
.stat-icon.bg-cyan   { background: linear-gradient(135deg, #0891b2, #22d3ee); }

.stat-meta small { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; }
.stat-meta strong { display: block; font-size: 1.5rem; line-height: 1.2; }

/* Tabel */
.table-app { margin: 0; width: 100%; }
.table-app thead th {
    background: #f8fafc;
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    padding: .7rem .9rem;
    white-space: nowrap;
}
.table-app tbody td { padding: .72rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .88rem; }
.table-app tbody tr:last-child td { border-bottom: 0; }
.table-app tbody tr:hover { background: #fafbff; }

.table-wrap { overflow-x: auto; }

.badge-soft {
    display: inline-block;
    padding: .28rem .55rem;
    border-radius: 7px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}
.badge-soft.blue   { background: #e8efff; color: #1e4fb8; }
.badge-soft.green  { background: #e6f7ec; color: #15803d; }
.badge-soft.amber  { background: #fef3e2; color: #b45309; }
.badge-soft.violet { background: #f1eafe; color: #6d28d9; }
.badge-soft.rose   { background: #ffe9ee; color: #be123c; }
.badge-soft.gray   { background: #eef1f5; color: #475569; }

.btn-icon {
    width: 32px; height: 32px;
    display: inline-grid; place-items: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: .8rem;
}
.btn-icon:hover { background: #f1f5ff; color: var(--brand); border-color: #cdddff; }
.btn-icon.danger:hover { background: #ffecec; color: #dc2626; border-color: #ffc9c9; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.2rem; opacity: .35; display: block; margin-bottom: .6rem; }

.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { max-width: 220px; }

.progress-thin { height: 7px; border-radius: 99px; background: #eef1f6; overflow: hidden; }
.progress-thin > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #6aa0ff); }

.form-label { font-weight: 600; font-size: .83rem; }
.form-control, .form-select { border-radius: 10px; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: #a9c3ff; box-shadow: 0 0 0 .18rem rgba(47, 111, 237, .16); }
.input-group-text { border-radius: 10px; }
.required::after { content: " *"; color: #dc2626; }

.profile-avatar {
    width: 68px; height: 68px;
    display: inline-grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #6aa0ff);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
}

/* ---------------------------------------------------------
   Halaman login
   --------------------------------------------------------- */
.login-body {
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(47, 111, 237, .35), transparent 60%),
        radial-gradient(700px 500px at 105% 110%, rgba(124, 58, 237, .3), transparent 60%),
        #0d1730;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    min-height: 100vh;
}

.login-wrap { width: 100%; max-width: 980px; }

.login-card {
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 992px) {
    .login-card { grid-template-columns: 1fr 1.1fr; }
}

.login-aside {
    background: linear-gradient(150deg, #2f6fed 0%, #6d3aed 100%);
    color: #fff;
    padding: 2.2rem;
}

.login-brand {
    width: 52px; height: 52px;
    border-radius: 15px;
    background: rgba(255, 255, 255, .18);
    display: grid; place-items: center;
    font-size: 1.35rem;
    border: 1px solid rgba(255, 255, 255, .3);
}

.login-main { background: #fff; }

/* ---------------------------------------------------------
   Halaman error
   --------------------------------------------------------- */
.error-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--canvas);
    padding: 1.5rem;
}
.error-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 18px 40px rgba(16, 24, 40, .08);
}
.error-code { font-size: 4.2rem; font-weight: 800; line-height: 1; letter-spacing: -.05em; }

/* ---------------------------------------------------------
   Responsif
   --------------------------------------------------------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .app-content { padding: 1rem; }
    .app-topbar { padding: .75rem 1rem; }
    .topbar-title { font-size: 1rem; }
}

/* ---------------------------------------------------------
   Cetak
   --------------------------------------------------------- */
.print-sheet {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 2rem 2.2rem;
    max-width: 210mm;
    margin: 0 auto;
}

.print-toolbar {
    position: sticky;
    top: 72px;
    z-index: 15;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .7rem .9rem;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(16, 24, 40, .06);
}

@media print {
    .app-sidebar, .app-topbar, .app-foot, .print-toolbar, .sidebar-backdrop,
    .no-print, .btn, form.no-print { display: none !important; }
    .app-content { padding: 0; }
    body.app-body { background: #fff; }
    .print-sheet { border: 0; border-radius: 0; padding: 0; max-width: 100%; box-shadow: none; }
    .card-app { border: 0; box-shadow: none; }
    a[href]::after { content: ""; }
    @page { size: A4; margin: 15mm; }
}

/* Kop surat cetak */
.kop-surat { width: 100%; border-bottom: 3px double #111; padding-bottom: 6px; margin-bottom: 14px; }
.kop-surat table { width: 100%; border-collapse: collapse; }
.kop-surat td { vertical-align: middle; padding: 2px 4px; }
.kop-logo { width: 84px; }
.kop-logo img { max-width: 76px; max-height: 76px; display: block; }
.kop-text h4, .kop-text p { margin: 0; }
.kop-text h4 { font-size: 15pt; letter-spacing: .5px; text-transform: uppercase; }
.kop-text p { font-size: 9.5pt; line-height: 1.35; }

.soal-item { margin-bottom: 12px; page-break-inside: avoid; }
.soal-item .opsi { display: block; margin-left: 1.6em; }
.tbl-kisi { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.tbl-kisi th, .tbl-kisi td { border: 1px solid #444; padding: 5px 6px; vertical-align: top; }
.tbl-kisi th { background: #eef2f7; text-align: center; }
