/* === TEMA DAN VARIABEL === */
:root {
    --primary: #0056b3;
    --primary-light: #3385ff;
    --secondary: #ff8c00;
    --secondary-light: #ffaa33;
    --bg-color: #f4f7f6;
    --text-main: #333333;
    --text-light: #666666;
    --white: #ffffff;
    --terjawab: #10b981;
    --unanswered: #e2e8f0;
    --ragu: #f59e0b;
    --aktif: #3b82f6;
    --correct: #10b981;
    --wrong: #ef4444;
    --border-radius: 12px;
    --box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); min-height: 100vh; }
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }
.btn { padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 1rem; transition: all 0.3s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-light); transform: translateY(-2px); }
.btn-secondary { background-color: var(--secondary); color: var(--white); }
.btn-secondary:hover { background-color: var(--secondary-light); }
.btn-outline { background-color: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background-color: var(--primary); color: var(--white); }
.btn-danger { background-color: var(--wrong); color: var(--white); }
.btn-danger:hover { opacity: 0.9; }

/* Login */
#login-screen { justify-content: center; align-items: center; background: linear-gradient(135deg, #003366 0%, var(--primary) 100%); padding: 20px; }
.login-card { background: var(--white); padding: 40px; border-radius: var(--border-radius); box-shadow: var(--box-shadow); width: 100%; max-width: 450px; text-align: center; }
.logo-placeholder { width: 80px; height: 80px; background-color: #e2e8f0; border-radius: 50%; margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.login-card h1 { color: var(--primary); margin-bottom: 10px; font-size: 1.8rem; }
.login-card p { color: var(--text-light); margin-bottom: 30px; }
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 600; }
.input-group input { width: 100%; padding: 14px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 1rem; transition: border-color 0.3s; }
.input-group input:focus { outline: none; border-color: var(--primary); }

/* Mobile Overlay */
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1040; }
.mobile-overlay.active { display: block; }
.nav-toggle-btn { display: inline-flex; }

/* Desktop Grid Adjustments (Since sidebar is fixed) */
.exam-layout { display: flex; flex-direction: column; gap: 20px; padding: 20px; max-width: 100%; margin: 0; width: 100%; flex: 1; transition: padding-right 0.3s ease-out; }
.exam-header { transition: padding-right 0.3s ease-out; }

@media (min-width: 901px) {
    body.sidebar-open .exam-layout {
        padding-right: 340px; /* Mendorong/shrink lebar soal agar tidak tertutup sidebar */
    }
    body.sidebar-open .exam-header {
        padding-right: 350px; /* Mencegah ikon tertutup sidebar */
    }
    body.sidebar-open .mobile-overlay {
        display: none !important; /* Menghilangkan efek gelap/overlay saat di layar besar */
    }
}

.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.nav-box { aspect-ratio: 1; border: none; border-radius: 6px; font-weight: bold; font-size: 1rem; cursor: pointer; background-color: var(--unanswered); color: var(--text-main); transition: all 0.2s; }
.nav-box.terjawab { background-color: var(--terjawab); color: var(--white); }
.nav-box.ragu { background-color: var(--ragu); color: var(--white); }
.nav-box.aktif { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--aktif); transform: scale(1.05); }
.legend-area { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; font-size: 0.9rem; }
.legend-item { display: flex; align-items: center; gap: 10px; }
.color-box { width: 16px; height: 16px; border-radius: 4px; }
.btn-submit-all { width: 100%; background-color: var(--correct); color: white; padding: 12px; border: none; border-radius: 8px; font-weight: bold; font-size: 1rem; cursor: pointer; }
.btn-submit-all:hover { opacity: 0.9; }

/* Ujian Header */
.exam-header { background: var(--white); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.header-left { display: flex; align-items: center; gap: 15px; }
.student-name { font-weight: bold; color: var(--primary); font-size: 1.1rem; }
.header-right { display: flex; align-items: center; gap: 15px; }
.timer-badge { background-color: var(--primary); color: var(--white); padding: 8px 16px; border-radius: 20px; font-weight: bold; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.timer-badge.warning { background-color: var(--wrong); animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Ujian Layout */
.question-header { display: flex; justify-content: space-between; border-bottom: 2px solid #f0f0f0; padding-bottom: 15px; margin-bottom: 20px; }
.question-number-display { font-size: 1.2rem; font-weight: bold; color: var(--primary); }
.question-text { font-size: 1.15rem; line-height: 1.7; margin-bottom: 25px; }
.options-container { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.option-item { display: flex; align-items: flex-start; padding: 15px; border: 2px solid #e2e8f0; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; }
.option-item:hover { background-color: #f8fafc; border-color: #cbd5e1; }
.option-item.selected { background-color: #eff6ff; border-color: var(--primary); }
.option-letter { font-weight: bold; background-color: #e2e8f0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 4px; margin-right: 15px; flex-shrink: 0; color: var(--text-main); }
.option-item.selected .option-letter { background-color: var(--primary); color: var(--white); }
.option-text { font-size: 1.05rem; line-height: 1.5; padding-top: 3px; }
.question-footer { display: flex; justify-content: space-between; margin-top: auto; border-top: 2px solid #f0f0f0; padding-top: 20px; }
.sidebar { 
    position: fixed !important; 
    top: 0 !important; 
    right: 0 !important; 
    transform: translateX(350px);
    width: 320px !important; 
    height: 100dvh !important; 
    z-index: 1050 !important; 
    border-radius: 0 !important; 
    overflow-y: auto !important; 
    transition: transform 0.3s ease-out !important; 
    box-shadow: -5px 0 25px rgba(0,0,0,0.3) !important; 
    margin: 0 !important;
    background: var(--white);
    padding: 24px;
}
.sidebar.open { transform: translateX(0) !important; }
.sidebar-title { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; font-weight: bold; margin-bottom: 15px; color: var(--text-main); border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; }
.close-sidebar-btn { display: block; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text-main); line-height: 1; padding: 5px; }

/* Hasil */
#result-screen { background-color: #e2e8f0; align-items: center; padding: 40px 20px; }
.result-card { background: var(--white); padding: 40px; border-radius: var(--border-radius); box-shadow: var(--box-shadow); width: 100%; max-width: 600px; text-align: center; }
.result-title { color: var(--primary); font-size: 2rem; margin-bottom: 10px; }
.score-display { width: 160px; height: 160px; border-radius: 50%; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 4rem; font-weight: bold; margin: 30px auto; box-shadow: 0 10px 20px rgba(0,86,179,0.3); border: 6px solid #e6f0ff; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 30px; }
.stat-item { background: #f8fafc; padding: 15px; border-radius: 8px; border: 1px solid #e2e8f0; }
.stat-value { font-size: 1.5rem; font-weight: bold; color: var(--text-main); }

/* Review */
#review-screen { background-color: var(--bg-color); padding: 30px 20px; }
.review-header { max-width: 800px; margin: 0 auto 20px; display: flex; justify-content: space-between; align-items: center; }
.review-container { max-width: 800px; margin: 0 auto; background: var(--white); border-radius: var(--border-radius); box-shadow: var(--box-shadow); padding: 30px; }
.review-item { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; }
.review-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.review-badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 0.85rem; font-weight: bold; color: white; margin-bottom: 10px; }
.badge-correct { background-color: var(--correct); }
.badge-wrong { background-color: var(--wrong); }
.badge-unanswered { background-color: var(--text-light); }
.user-answer { margin-top: 10px; font-weight: 500; }
.correct-answer { margin-top: 5px; color: var(--correct); font-weight: bold; }
.explanation-box { margin-top: 15px; background-color: #f0f7ff; padding: 15px; border-left: 4px solid var(--primary); border-radius: 4px; font-size: 0.95rem; line-height: 1.5; }

/* Error state untuk soal.json */
.error-msg { background: #fee2e2; color: #dc2626; padding: 15px; border-radius: 8px; margin-bottom: 20px; display: none; }

@media (max-width: 900px) {
    .exam-layout { padding: 15px; }

    .question-footer { flex-direction: column; gap: 15px; }
    .question-footer .btn { width: 100%; }
    .nav-btn-group { display: flex; gap: 10px; width: 100%; }
    .nav-btn-group .btn { flex: 1; }
    .stats-grid { grid-template-columns: 1fr; }
    .exam-header { padding: 15px; }
    .header-left .student-name { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
}
