/* ==========================================================
   CBT MTs 1 Alor — stylesheet
   Font sistem saja (tanpa CDN) karena aplikasi harus tetap
   jalan walau server terputus dari internet saat ujian.
   ========================================================== */

:root {
    --navy: #1B2A41;
    --navy-light: #24374F;
    --slate: #3B6E8F;
    --slate-light: #E7EEF3;
    --bg: #F4F6F8;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-mute: #6B7280;
    --border: #DFE4EA;
    --green: #16A34A;
    --red: #DC2626;
    --amber: #D97706;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: Georgia, "Times New Roman", serif;
    color: var(--navy);
    margin-top: 0;
}

a { color: var(--slate); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Sidebar layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-shell[data-role="admin"] { --accent: var(--navy); --accent-light: var(--navy-light); }
.app-shell[data-role="guru"]  { --accent: #3B6E8F; --accent-light: #2C5674; }
.app-shell[data-role="siswa"] { --accent: #166534; --accent-light: #0F4D26; }

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.sidebar-brand small { display: block; font-family: -apple-system, sans-serif; font-size: .7rem; color: rgba(255,255,255,.65); font-weight: normal; margin-top: 3px; }
.sidebar nav { flex: 1; padding: 14px 0; overflow-y: auto; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #E3ECF3;
    font-size: .92rem;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-light); border-left-color: #fff; color: #fff; font-weight: 600; }
.nav-icon { font-size: 1rem; width: 18px; text-align: center; }
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: .85rem;
}
.sidebar-user .nama-user { color: #fff; margin-bottom: 4px; }
.sidebar-user a { color: #CBDCEA; font-size: .82rem; }

.main-content { flex: 1; min-width: 0; background: var(--bg); }

.sidebar-toggle-state { display: none; }
.sidebar-toggle-btn { display: none; }

@media (max-width: 800px) {
    .sidebar {
        position: fixed;
        left: -230px;
        z-index: 50;
        transition: left .2s ease;
        box-shadow: 4px 0 16px rgba(0,0,0,.2);
    }
    .sidebar-toggle-state:checked ~ .sidebar { left: 0; }
    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 60;
        width: 40px;
        height: 40px;
        background: var(--accent);
        color: #fff;
        border-radius: 8px;
        font-size: 1.2rem;
        cursor: pointer;
    }
    .container { padding-top: 64px; }
}

/* ---------- Layout ---------- */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}
.narrow { max-width: 480px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
label { display: block; font-size: .85rem; color: var(--text-mute); margin-bottom: 4px; margin-top: 14px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--slate);
    outline-offset: 1px;
    border-color: var(--slate);
}

.btn {
    display: inline-block;
    background: var(--slate);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: .95rem;
    cursor: pointer;
    font-family: inherit;
}
.btn:hover { background: var(--navy); text-decoration: none; }
.btn-outline { background: transparent; color: var(--slate); border: 1px solid var(--slate); }
.btn-outline:hover { background: var(--slate-light); color: var(--navy); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #B91C1C; }
.btn-sm { padding: 5px 12px; font-size: .82rem; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-mute); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: var(--slate-light); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: .75rem; font-weight: 600; }
.badge-draft { background: #E5E7EB; color: #4B5563; }
.badge-aktif { background: #DCFCE7; color: var(--green); }
.badge-selesai { background: #DBEAFE; color: #1D4ED8; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .9rem; margin-bottom: 16px; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.alert-info { background: var(--slate-light); color: var(--navy); border: 1px solid #BFD4E3; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 45%, var(--slate) 100%);
}
.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 36px 34px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 2px; }
.login-card .sub { color: var(--text-mute); font-size: .85rem; margin-bottom: 18px; }
.role-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.role-tabs a {
    flex: 1; text-align: center; padding: 8px 0; border-radius: 6px;
    font-size: .85rem; border: 1px solid var(--border); color: var(--text-mute);
}
.role-tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Exam-taking screen ---------- */
.exam-header {
    position: sticky; top: 0; z-index: 10;
    background: var(--navy); color: #fff;
    padding: 12px 24px; display: flex; justify-content: space-between; align-items: center;
}
.timer {
    font-family: Georgia, serif;
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
    background: var(--navy-light);
    padding: 6px 16px;
    border-radius: 8px;
}
.timer.low { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

.soal-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.soal-nav button {
    width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-size: .82rem;
}
.soal-nav button.answered { background: var(--green); color: #fff; border-color: var(--green); }
.soal-nav button.current { outline: 2px solid var(--navy); outline-offset: 1px; }

.opsi-jawaban { display: block; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.opsi-jawaban:hover { background: var(--slate-light); }
.opsi-jawaban input { margin-right: 10px; }
.opsi-jawaban.selected { border-color: var(--slate); background: var(--slate-light); }

.soal-gambar { max-width: 100%; border-radius: 8px; margin: 12px 0; border: 1px solid var(--border); }

footer.app-footer { text-align: center; color: var(--text-mute); font-size: .8rem; padding: 20px; }
