@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-light: #f3f4f6;
    --card-bg: #ffffff;
    --text-dark: #1f2937;
    --text-light: #4b5563;
    --border-color: #d1d5db;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    color: var(--text-dark);
}

.container {
    width: 100%;
    max-width: 800px;
}

.test-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.15);
    width: 100%;
}

/* === HALAMAN LOGIN === */
.login-card {
    max-width: 480px;
    margin: auto;
}
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}
.login-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
}
.login-header p {
    color: var(--text-light);
}

.form-step {
    margin-bottom: 1.5rem;
    display: none;
}
.form-step.active {
    display: block;
}
.form-step label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    -webkit-appearance: none; /* Removes default styling on iOS */
    -moz-appearance: none;
    appearance: none;
    background-color: white;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.tgl-lahir-container {
    display: flex;
    gap: 0.75rem;
}
.tgl-lahir-container select {
    flex: 1;
}

.btn-login { width: 100%; justify-content: center; }

.error-text {
    color: var(--danger-color);
    text-align: center;
    margin-top: 1rem;
    font-weight: 600;
}

/* === HALAMAN CBT === */
.cbt-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}
.progress-container {
    flex-grow: 1;
    height: 12px;
    background-color: var(--bg-light);
    border-radius: 6px;
    overflow: hidden;
}
.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, #6366f1, #8b5cf6);
    border-radius: 6px;
    transition: width 0.4s ease-out;
}
#timer-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
    background-color: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: 12px;
}
#soal-wrapper { margin-bottom: 2rem; }
#nomor-soal-display {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
#soal-container { min-height: 250px; }
.pertanyaan {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--text-dark);
}
.opsi-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.opsi {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s, transform 0.2s;
}
.opsi:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}
.opsi input[type="radio"] { display: none; }
.opsi.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}
.opsi .opsi-huruf {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-right: 1rem;
    font-weight: 700;
    transition: all 0.3s;
    background-color: var(--card-bg);
    flex-shrink: 0;
}
.opsi.selected .opsi-huruf {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.opsi-teks {
    flex-grow: 1;
    font-weight: 600;
    color: var(--text-light);
}
.opsi.selected .opsi-teks { color: var(--text-dark); }

/* === HALAMAN HASIL === */
.hasil-card { max-width: 520px; text-align: center; margin: auto; }
.hasil-header { margin-bottom: 2rem; }
.hasil-header h2 { font-size: 1.75rem; font-weight: 800; color: var(--text-dark); }
.hasil-header p { color: var(--text-light); }
.score-display {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem auto;
}
.score-circle { transform: rotate(-90deg); }
.score-bg { stroke: var(--bg-light); }
.score-value {
    stroke: var(--primary-color);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}
.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.score-nilai {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
}
.score-label {
    font-weight: 600;
    color: var(--text-light);
}
.hasil-detail h3 {
    font-size: 1.5rem;
    font-weight: 700;
}
.info-kelas {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}
.summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: 12px;
    margin-bottom: 2rem;
}
.summary-item { text-align: center; }
.summary-item .label {
    font-size: 0.9rem;
    color: var(--text-light);
}
.summary-item .value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}
.summary-item .value.correct { color: var(--success-color); }
.btn-kembali { width: 100%; justify-content: center; }

/* === ELEMEN UMUM === */
.cbt-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap; /* Memastikan tombol tidak tumpang tindih */
    gap: 1rem;
}
.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 15px -5px rgba(79, 70, 229, 0.4);
    text-decoration: none;
}
.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px -8px rgba(79, 70, 229, 0.5);
    color: #fff;
}
.btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn:disabled svg { stroke: #9ca3af; }
.btn-secondary {
    background: #fff;
    color: var(--secondary-color);
    border: 2px solid var(--border-color);
    box-shadow: none;
}
.btn-secondary:hover {
    background: var(--bg-light);
    color: var(--text-dark);
    border-color: var(--secondary-color);
}
.btn-finish {
    background: linear-gradient(to right, #059669, #10b981);
    box-shadow: 0 4px 15px -5px rgba(16, 185, 129, 0.4);
}
.btn-finish:hover {
     box-shadow: 0 8px 25px -8px rgba(16, 185, 129, 0.5);
}
.hidden { display: none !important; }
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--primary-light);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 100px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 640px) {
    body { padding: 0.5rem; }
    .test-card { padding: 1.5rem 1rem; }
    .pertanyaan { font-size: 1.1rem; }
    .cbt-header { flex-direction: column; align-items: stretch; gap: 1rem; }
    .btn { padding: 0.7rem 1rem; font-size: 0.9rem; flex-grow: 1; justify-content: center; }
    .cbt-navigation { justify-content: center; }
}

