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

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f4f8;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

.hidden { display: none !important; }

#menu-container {
    text-align: center;
    background-color: #fff;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
}

#menu-container h1 { color: #003366; margin-top: 0; font-size: 1.8em; }
#menu-container p { color: #555; margin-bottom: 30px; }

.topic-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.topic-header {
    padding: 18px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #e9ecef;
}

.topic-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: #343a40;
}

.topic-header .arrow {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.topic-quizzes {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding: 0 15px;
}

.topic-card.active .topic-quizzes {
    max-height: 500px; 
    padding: 15px;
}

.topic-card.active .arrow {
    transform: rotate(180deg);
}

.quiz-selection-btn {
    display: block;
    width: 100%;
    background-color: #0056b3;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}
.quiz-selection-btn:last-child { margin-bottom: 0; }

.quiz-selection-btn.fisiologia { background-color: #00695c; }
.quiz-selection-btn.rpa-prep { background-color: #6a1b9a; }
.quiz-selection-btn.emergencia { background-color: #b71c1c; }

.quiz-selection-btn:hover { background-color: #004494; }
.quiz-selection-btn.fisiologia:hover { background-color: #004d40; }
.quiz-selection-btn.rpa-prep:hover { background-color: #4a148c; }
.quiz-selection-btn.emergencia:hover { background-color: #871414; }

#quiz-container { max-width: 800px; width: 100%; }
#quiz-header {
    background-color: #003366;
    color: white;
    padding: 15px 20px;
    text-align: center;
    display: flex;
    align-items: center;
    position: relative;
}
#quiz-header h1 { margin: 0; font-size: 1.5em; flex-grow: 1; padding: 0 45px; }
#quiz-header h1 span { font-weight: 400; font-size: 0.7em; opacity: 0.8; display: block; }
#header-back-to-menu-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 35px; height: 35px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding-bottom: 2px;
    transition: background-color 0.2s;
}
#header-back-to-menu-btn:hover { background: rgba(255, 255, 255, 0.3); }

#progress-container { width: 100%; background-color: #e0e0e0; }
#progress-bar { height: 8px; width: 0%; background-color: #4caf50; transition: width 0.3s ease-in-out; }

#quiz-header.level-2 { background-color: #1a237e; }
#quiz-header.rpa-prep { background-color: #6a1b9a; }
#quiz-header.emergencia { background-color: #b71c1c; }
#progress-bar.level-2 { background-color: #ff9800; }
#progress-bar.rpa-prep { background-color: #fdd835; }
#progress-bar.emergencia { background-color: #ffc107; }
.question-block h3.level-2, .question-block h3.rpa-prep, .question-block h3.emergencia { color: #1a237e; }

.question-block { padding: 20px; border-bottom: 1px solid #eee; }
.question-block h3 { margin-top: 0; font-size: 1.1em; color: #003366; }
.options { list-style: none; padding: 0; margin: 0; }
.options li { background-color: #f8f9fa; border: 2px solid #ddd; border-radius: 8px; margin-bottom: 10px; padding: 12px 15px; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
.options li.selected { background-color: #d4e3ff; border-color: #0056b3; font-weight: 500; }
.options.disabled { pointer-events: none; }
.options li.correct-feedback, .options li.actual-answer { border-color: #28a745; background-color: #e9f7ef; font-weight: 500; }
.options li.incorrect-feedback { border-color: #dc3545; background-color: #fce8e6; font-weight: 500; }
.options input[type="radio"] { display: none; }

#navigation { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; gap: 10px; }
.nav-btn, .action-btn { background-color: #0056b3; color: white; border: none; padding: 10px 15px; border-radius: 6px; cursor: pointer; font-size: 1em; font-weight: 500; flex-shrink: 0; width: 110px; text-align: center; }
#prev-btn, #back-to-menu-btn-results { background-color: #6c757d; }
#reset-btn { background-color: #dc3545; margin-left: 10px; }
#question-counter { font-size: 0.9em; color: #555; font-weight: 500; flex-grow: 1; text-align: center; }

#results { padding: 30px 20px; text-align: center; }
#results h2 { color: #003366; }
#results p { font-size: 1.3em; font-weight: bold; color: #28a745; }
#results p.low-score { color: #dc3545; }
#review-container { margin-top: 30px; max-height: 400px; overflow-y: auto; border-top: 1px solid #ccc; padding-top: 20px; }
.review-question { text-align: left; margin-bottom: 20px; padding: 15px; border-radius: 8px; background-color: #f8f9fa; }
.review-question.correct { border-left: 5px solid #28a745; }
.review-question.incorrect { border-left: 5px solid #dc3545; }
.review-question p { font-size: 1em; margin: 0 0 10px 0; font-weight: 500; }
.review-answer { font-style: italic; }
.review-answer .correct-answer { color: #28a745; font-weight: bold; }
.review-answer .wrong-answer { color: #dc3545; text-decoration: line-through; }

@media (max-width: 600px) {
    body { padding: 0; align-items: flex-start; }
    #menu-container, #quiz-container { border-radius: 0; min-height: 100vh; box-shadow: none; }
    #menu-container h1, #quiz-header h1 { font-size: 1.2em; }
    #quiz-header h1 { padding: 0 40px; }
    .quiz-selection-btn { font-size: 1em; padding: 15px; }
    .question-block { padding: 15px; }
    .question-block h3 { font-size: 1em; }
    .options li { padding: 10px 12px; font-size: 0.9em; }
    #navigation { padding: 10px; gap: 5px; }
    .nav-btn, .action-btn { width: auto; padding: 10px; font-size: 0.9em; flex-basis: 100px; }
    #results { padding: 20px 15px; }
}