@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --primary-color: #3a7bd5;
    --secondary-color: #004e92;
    --background-color: #f0f2f5;
    --surface-color: #ffffff;
    --text-color: #333;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --neutral-color: #6c757d;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

.container {
    width: 100%;
    max-width: 800px;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.view { display: none; padding: 30px 40px; animation: fadeIn 0.5s ease-in-out; }
.view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#start-screen h1, #start-screen h2, #start-screen h3 {
    text-align: left;
    margin-bottom: 15px;
    color: var(--primary-color);
}

#start-screen h2 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    font-weight: 600;
}

#start-screen h3 {
    text-align: left;
    margin-top: 25px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

#start-screen p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: justify;
}

#start-screen ul {
    list-style-position: inside;
    margin-left: 5px;
    margin-bottom: 20px;
}

#start-screen ul li {
    margin-bottom: 10px;
    line-height: 1.5;
}

#start-screen a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

#start-screen a:hover {
    text-decoration: underline;
}

#start-screen h2:last-of-type {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.category-btn {
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.category-btn:hover { transform: translateY(-5px); box-shadow: 0 6px 20px rgba(58, 123, 213, 0.4); }

.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
#quiz-category-title { color: var(--primary-color); }
.quiz-info { display: flex; align-items: center; gap: 20px; font-weight: 600; }
#timer { background-color: #e9ecef; padding: 5px 15px; border-radius: 20px; font-variant-numeric: tabular-nums; }

.progress-bar-container { width: 100%; height: 10px; background-color: #e9ecef; border-radius: 5px; margin-bottom: 30px; overflow: hidden; }
#progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); border-radius: 5px; transition: width 0.4s ease-in-out; }

#question-text { font-size: 1.4rem; font-weight: 600; margin-bottom: 25px; min-height: 80px; }

.answer-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.answer-btn {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    text-align: left;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}
.answer-btn:hover:not([disabled]) { background-color: #e9ecef; border-color: var(--primary-color); }
.answer-btn.correct { background-color: #d4edda; border-color: var(--correct-color); color: var(--correct-color); font-weight: 600; }
.answer-btn.incorrect { background-color: #f8d7da; border-color: var(--incorrect-color); color: var(--incorrect-color); font-weight: 600; }
.answer-btn:disabled { cursor: not-allowed; opacity: 0.8; }

.quiz-footer { margin-top: 30px; display: flex; justify-content: space-between; align-items: center; }
.nav-btn, .results-controls button {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s, transform 0.2s;
    background-color: var(--primary-color);
    color: white;
}
.nav-btn:hover, .results-controls button:hover { background-color: var(--secondary-color); transform: scale(1.03); }
.nav-btn:disabled { background-color: var(--neutral-color); cursor: not-allowed; transform: none; }
.hide { display: none; }

.results-summary { display: flex; justify-content: space-around; gap: 20px; margin: 30px 0; }
.result-box { flex: 1; background-color: #f8f9fa; padding: 20px; text-align: center; border-radius: var(--border-radius); }
.result-box p { margin-bottom: 10px; color: var(--neutral-color); }
.result-box h2 { font-size: 2rem; }
#result-status.pass { color: var(--correct-color); }
#result-status.fail { color: var(--incorrect-color); }

#detailed-review { margin-top: 30px; }
#review-container { max-height: 300px; overflow-y: auto; padding-right: 15px; border-top: 1px solid #dee2e6; margin-top: 15px; }
.review-item { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #dee2e6; }
.review-item:last-child { border-bottom: none; }
.review-question { font-weight: 600; margin-bottom: 10px; }
.review-answer { margin-bottom: 5px; }
.review-answer.user-correct { color: var(--correct-color); font-weight: bold; }
.review-answer.user-incorrect { color: var(--incorrect-color); text-decoration: line-through; }
.review-answer.correct-answer { color: var(--correct-color); font-weight: bold; }
.review-explanation { background-color: #e9ecef; padding: 10px; border-radius: 8px; font-size: 0.9rem; margin-top: 10px; }

.results-controls { margin-top: 30px; display: flex; justify-content: center; gap: 20px; }

@media (max-width: 600px) {
    .view { padding: 20px; }
    .category-grid { grid-template-columns: 1fr; }
    .results-summary { flex-direction: column; }
    .quiz-footer { flex-direction: column; gap: 10px; }
    .nav-btn { width: 100%; }
}