@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1e3a8a; /* Royal Indigo */
    --primary-light: #60a5fa;
    --primary-dark: #1e40af;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --glass: rgba(255, 255, 255, 0.85);
    --border: #e2e8f0;
    --text-main: #1a1a1a;
    --text-muted: #64748b;
    --orange: #f59e0b;
    --red: #ef4444;
    --bg-input: #f8fafc;
    --green: #22c55e;
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
}

body {
    user-select: none;
    -webkit-user-select: none;
    background: radial-gradient(at top left, #eff6ff 0%, #ffffff 50%, #f1f5f9 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
}

/* Global Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.hidden { display: none !important; }

/* Login Page - Total Overhaul */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 3rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-premium);
    width: 100%;
    max-width: 440px;
    border: 1.5px solid var(--border);
    animation: fadeIn 0.8s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.login-title span {
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-wrapper input, 
.input-wrapper select {
    width: 100%;
    padding: 1.1rem 1.4rem;
    border-radius: 1rem;
    border: 1.5px solid #e2e8f0;
    background: var(--bg-input);
    font-weight: 600;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    color: var(--text-main);
}

.input-wrapper input:focus, 
.input-wrapper select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.token-input {
    text-transform: uppercase;
    font-weight: 800 !important;
    letter-spacing: 0.1em;
    text-align: center;
}

.btn-login {
    background: var(--glass);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 1rem;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px rgba(37, 99, 235, 0.2);
    margin-top: 1rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 15px 25px rgba(37, 99, 235, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}
.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.login-footer span {
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Re-Designed Exam Interface --- */
.exam-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #ffffff;
}

.exam-header {
    background: #000000;
    height: 70px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    z-index: 1000;
    position: relative;
}

.header-brand {
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    color: #fff;
}

.header-brand span { color: var(--primary-light); }

.timer-display {
    font-family: monospace;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    background: rgba(255,255,255,0.1);
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.btn-finish-exam {
    background: var(--red);
    color: rgb(248, 246, 246);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    border: none;
    padding: 0.6rem 1.5rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: 0.3s;
}
.btn-finish-exam:hover { filter: brightness(1.2); transform: translateY(-2px); }

.progress-wrapper { height: 4px; background: #f1f5f9; width: 100%; }
.progress-bar-fill { 
    height: 100%; 
    background: #fa0202;
    transition: width 0.6s ease;
}

.exam-main { display: flex; flex: 1; overflow: hidden; }

.nav-sidebar {
    width: 300px;
    background: #f8fafc;
    border-right: 1.5px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.nav-sidebar.minimized { width: 80px; padding: 2rem 1rem; }
.nav-sidebar.minimized .section-title, 
.nav-sidebar.minimized .status-summary { display: none; }
.nav-sidebar.minimized .nav-grid { grid-template-columns: 1fr; }

.btn-minimize {
    position: absolute;
    right: 10px;
    top: 10px;
    background: #000;
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-weight: 900;
    z-index: 5;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.section-title span { width: 3px; height: 14px; background: #000; }

.status-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 2.5rem; }
.status-card { background: white; padding: 0.75rem; border: 1px solid #e2e8f0; text-align: center; }
.status-label { display: block; font-size: 0.55rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.25rem; }
.status-value { font-size: 1rem; font-weight: 800; color: #000; }

.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
.nav-grid button {
    aspect-ratio: 1;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: white;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}
.nav-grid button.answered { background: #2563eb; color: white; border-color: #2563eb; }
.nav-grid button.doubtful { background: #facc15; color: #000; border-color: #facc15; }
.nav-grid button.current { border: 2px solid #000; transform: scale(1.1); z-index: 1; }

.question-container { flex: 1; padding: 3rem; overflow-y: auto; display: flex; justify-content: center; background: #fff; }
.question-card {
    background: white;
    width: 100%;
    max-width: 800px;
    padding: 1rem;
    height: fit-content;
}

.question-badge {
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5rem;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.7;
    margin: 2.5rem 0;
    color: #1e293b;
    white-space: pre-line;
}

.option-item {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #eef2f6;
    padding: 1.25rem 1.5rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: 0.2s;
    text-align: left;
}
.option-item:hover { border-color: var(--primary-light); transform: translateX(5px); }
.option-item.active { background: var(--primary); border-color: var(--primary); color: white; }

.option-key {
    min-width: 42px;
    height: 42px;
    background: white;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary);
    border: 1.5px solid #eef2f6;
}
.option-item.active .option-key { background: rgba(255, 255, 255, 0.2); color: white; border-color: transparent; }

.question-nav-buttons {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1.5px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary { background: #f1f5f9; color: #475569; padding: 0.8rem 1.5rem; border-radius: 1rem; font-weight: 700; border: none; cursor: pointer; }
.btn-next { background: var(--primary); color: white; padding: 0.8rem 2.5rem; border-radius: 1rem; font-weight: 700; border: none; cursor: pointer; }

.ragu-checkbox-wrapper { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; color: var(--orange); font-weight: 700; font-size: 0.9rem; }
.ragu-checkbox-wrapper input { width: 1.2rem; height: 1.2rem; accent-color: var(--orange); }

/* --- Overlays & Popups (On Top of Everything) --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* Higher than header and sidebar */
    padding: 2rem;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    background: white;
    padding: 3rem;
    border-radius: 2rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Responsive Fixes */
@media (max-width: 1024px) {
    .nav-sidebar {
        position: fixed;
        left: 0;
        top: 70px; /* Sesuai tinggi header baru */
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
        background: white;
    }
    .nav-sidebar.active {
        transform: translateX(0);
    }
    .desktop-only { display: none; }
    .mobile-only { display: block; }
    .question-container { padding: 1.5rem; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInQuestion {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.question-slide-active {
    animation: slideInQuestion 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#loginScreen > div {
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Exclusive Result Screen --- */
.result-card {
    background: #ffffff;
    padding: 4rem;
    border-radius: 0; /* Modern Boxy Look */
    border: 3px solid #000000;
    width: 100%;
    max-width: 550px;
    text-align: center;
    box-shadow: 20px 20px 0px rgba(0, 0, 0, 0.1);
    margin: auto; /* Ensuring absolute centering within flex */
}

.result-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.4em;
    color: #000;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.result-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 4rem;
    text-transform: uppercase;
}

.score-section {
    margin-bottom: 4rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 3rem 0;
}

.score-label {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.5em;
    color: #000;
}

.score-value {
    font-size: 9rem;
    font-weight: 900;
    color: #000;
    line-height: 1;
    letter-spacing: -0.05em;
    margin-top: 1rem;
}

.stats-container { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 1.5rem; 
    margin-bottom: 4rem; 
}

.stat-box { 
    padding: 1.5rem 0.5rem;
    border: 1.5px solid #000;
    transition: 0.3s;
}

.stat-label { font-size: 0.55rem; font-weight: 900; letter-spacing: 0.2em; color: #000; display: block; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.8rem; font-weight: 900; color: #000; }

.stat-benar { background: #ecfdf5; border-color: #059669; }
.stat-benar .stat-value { color: #059669; }

.stat-salah { background: #fef2f2; border-color: #dc2626; }
.stat-salah .stat-value { color: #dc2626; }

.stat-kosong { background: #f8fafc; border-color: #475569; }

.btn-exit {
    width: 100%;
    background: #000;
    color: white;
    border: none;
    padding: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.3em;
    cursor: pointer;
    transition: 0.3s;
}
.btn-exit:hover { background: #000; transform: translateY(-2px); }

.whitespace-pre-line { white-space: pre-line; }
.scrollbar-hide::-webkit-scrollbar { display: none; }