/* =========================================================
   TeamElektro Lern-App
   quiz.css

   Gemeinsames Quiz-Design für Quiz 01 bis Quiz 12
   ========================================================= */


/* =========================================================
   1. QUIZ-GRUNDBEREICH
   ========================================================= */

.quiz-container {
    padding: 3rem 0 5rem;
    background: var(--color-background, #f5f8fc);
}

.quiz-container .content-container {
    width: min(100% - 2rem, 1000px);
    margin-inline: auto;
}


/* =========================================================
   2. QUIZ-EINLEITUNG
   ========================================================= */

.quiz-intro {
    margin-bottom: 2rem;
}

.quiz-intro-card {
    position: relative;
    overflow: hidden;

    padding: 2rem;

    background: #ffffff;

    border: 1px solid #dce7f3;
    border-radius: 20px;

    box-shadow:
        0 10px 30px rgba(0, 63, 135, 0.08);
}

.quiz-intro-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 5px;

    background: linear-gradient(
        90deg,
        #003f87,
        #006bb6
    );
}

.quiz-intro-card h2 {
    margin-top: 0.4rem;
    margin-bottom: 0.75rem;

    color: #003f87;
}

.quiz-intro-card > p {
    max-width: 760px;

    margin: 0;

    color: #526477;
    line-height: 1.7;
}


/* =========================================================
   3. QUIZ-META
   ========================================================= */

.quiz-meta {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 1rem;

    margin-top: 1.75rem;
}

.quiz-meta-item {
    display: flex;
    flex-direction: column;
    justify-content: center;

    min-height: 100px;

    padding: 1rem;

    text-align: center;

    background: #f5f8fc;

    border: 1px solid #dce7f3;
    border-radius: 14px;
}

.quiz-meta-item strong {
    display: block;

    margin-bottom: 0.25rem;

    color: #003f87;

    font-size: 1.65rem;
    line-height: 1;
}

.quiz-meta-item span {
    color: #5c6d7e;

    font-size: 0.9rem;
}


/* =========================================================
   4. QUIZ-FORMULAR
   ========================================================= */

.quiz-form {
    display: flex;
    flex-direction: column;

    gap: 1.5rem;
}


/* =========================================================
   5. FRAGEKARTE
   ========================================================= */

.quiz-question {
    position: relative;

    padding: 1.75rem;

    background: #ffffff;

    border: 1px solid #dce7f3;
    border-radius: 18px;

    box-shadow:
        0 8px 24px rgba(0, 63, 135, 0.06);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.quiz-question:hover {
    border-color: #b8cee5;

    box-shadow:
        0 12px 30px rgba(0, 63, 135, 0.09);
}

.quiz-question h2 {
    margin: 0 0 1.35rem;

    color: #1d2d3d;

    font-size: 1.2rem;
    line-height: 1.5;
}


/* =========================================================
   6. FRAGENKOPF
   ========================================================= */

.quiz-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    margin-bottom: 1rem;
}

.quiz-question-number {
    color: #003f87;

    font-size: 0.85rem;
    font-weight: 700;

    letter-spacing: 0.03em;
}

.quiz-question-topic {
    display: inline-flex;
    align-items: center;

    padding: 0.35rem 0.75rem;

    color: #00569b;
    background: #e6f2ff;

    border-radius: 999px;

    font-size: 0.78rem;
    font-weight: 700;
}


/* =========================================================
   7. ANTWORTEN
   WICHTIG:
   IMMER UNTEREINANDER
   ========================================================= */

.quiz-options {
    display: grid;

    /*
     * Diese Einstellung ist verbindlich.
     * Es gibt immer genau eine Spalte.
     */
    grid-template-columns: 1fr;

    gap: 0.85rem;

    width: 100%;
}


/* =========================================================
   8. EINZELNE ANTWORT
   ========================================================= */

.quiz-option {
    display: flex;
    align-items: flex-start;

    gap: 0.85rem;

    width: 100%;

    padding: 1rem 1.1rem;

    color: #263849;
    background: #f8fafc;

    border: 2px solid #dce7f3;
    border-radius: 12px;

    cursor: pointer;

    line-height: 1.55;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

.quiz-option:hover {
    background: #eef6ff;
    border-color: #8bb7df;

    transform: translateY(-1px);
}

.quiz-option:focus-within {
    border-color: #006bb6;

    box-shadow:
        0 0 0 3px rgba(0, 107, 182, 0.14);
}

.quiz-option input[type="radio"],
.quiz-option input[type="checkbox"] {
    flex: 0 0 auto;

    width: 1.15rem;
    height: 1.15rem;

    margin: 0.18rem 0 0;

    accent-color: #006bb6;

    cursor: pointer;
}

.quiz-option span {
    flex: 1;

    min-width: 0;
}


/* =========================================================
   9. AUSGEWÄHLTE ANTWORT
   ========================================================= */

.quiz-option:has(
    input[type="radio"]:checked
),
.quiz-option:has(
    input[type="checkbox"]:checked
) {
    color: #003f87;
    background: #e6f2ff;

    border-color: #006bb6;

    box-shadow:
        0 5px 16px rgba(0, 107, 182, 0.10);
}


/* Fallback / JS-Klasse */

.quiz-option.selected {
    color: #003f87;
    background: #e6f2ff;

    border-color: #006bb6;
}


/* =========================================================
   10. RICHTIGE / FALSCHE ANTWORT
   Klassen können später von quiz.js gesetzt werden.
   ========================================================= */

.quiz-option.correct,
.quiz-option.is-correct {
    color: #165c32;
    background: #eaf8ef;

    border-color: #38a169;
}

.quiz-option.wrong,
.quiz-option.incorrect,
.quiz-option.is-wrong {
    color: #8c2f2f;
    background: #fff0f0;

    border-color: #d95c5c;
}


/* Nach Auswertung keine Hover-Verschiebung */

.quiz-question.answered .quiz-option:hover,
.quiz-question.is-evaluated .quiz-option:hover {
    transform: none;
}


/* =========================================================
   11. FEEDBACK
   Standardmäßig ausgeblendet.
   quiz.js blendet das passende Feedback ein.
   ========================================================= */

.quiz-feedback {
    margin-top: 1rem;
}

.feedback-correct,
.feedback-wrong {
    display: none;

    margin: 0;

    padding: 0.9rem 1rem;

    border-radius: 10px;

    font-size: 0.95rem;
    line-height: 1.55;
}

.feedback-correct {
    color: #165c32;
    background: #eaf8ef;

    border-left: 4px solid #38a169;
}

.feedback-wrong {
    color: #8c2f2f;
    background: #fff0f0;

    border-left: 4px solid #d95c5c;
}


/* Kompatibilität mit mehreren JS-Klassen */

.quiz-question.correct
    .feedback-correct,

.quiz-question.is-correct
    .feedback-correct {

    display: block;
}

.quiz-question.wrong
    .feedback-wrong,

.quiz-question.incorrect
    .feedback-wrong,

.quiz-question.is-wrong
    .feedback-wrong {

    display: block;
}


/* =========================================================
   12. FRAGE NACH AUSWERTUNG
   ========================================================= */

.quiz-question.correct,
.quiz-question.is-correct {
    border-color: #8fd0a6;
}

.quiz-question.wrong,
.quiz-question.incorrect,
.quiz-question.is-wrong {
    border-color: #e7a2a2;
}


/* =========================================================
   13. WARNMELDUNG
   ========================================================= */

.quiz-message {
    padding: 1rem 1.2rem;

    border-radius: 12px;

    line-height: 1.55;
}

.quiz-message-warning {
    color: #7a5300;
    background: #fff7df;

    border: 1px solid #efd07c;
    border-left: 5px solid #e0a800;
}


/* =========================================================
   14. QUIZ-AKTIONEN
   ========================================================= */

.quiz-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;

    flex-wrap: wrap;

    gap: 0.85rem;

    margin-top: 0.5rem;
}

.quiz-actions .button {
    min-width: 190px;
}


/* =========================================================
   15. ERGEBNIS
   ========================================================= */

.quiz-result {
    position: relative;

    margin-top: 2rem;
    padding: 2rem;

    text-align: center;

    background: #ffffff;

    border: 2px solid #b9d5ed;
    border-radius: 20px;

    box-shadow:
        0 12px 35px rgba(0, 63, 135, 0.10);
}

.quiz-result[hidden] {
    display: none;
}

.quiz-result-score {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 0.35rem;

    margin: 1rem 0;
}

.quiz-result-score strong {
    color: #003f87;

    font-size: clamp(2.5rem, 8vw, 4rem);
    line-height: 1;
}

.quiz-result-score span {
    color: #526477;

    font-weight: 600;
}

.quiz-result-status {
    max-width: 650px;

    margin: 1.25rem auto 0;

    font-size: 1.05rem;
    line-height: 1.6;
}


/* =========================================================
   16. BESTANDEN
   ========================================================= */

.quiz-result.passed,
.quiz-result.is-passed {
    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #f1fbf4 100%
        );

    border-color: #55b77a;
}

.quiz-result.passed
    .quiz-result-score strong,

.quiz-result.is-passed
    .quiz-result-score strong {

    color: #20804a;
}


/* =========================================================
   17. NICHT BESTANDEN
   ========================================================= */

.quiz-result.failed,
.quiz-result.is-failed {
    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #fff6f6 100%
        );

    border-color: #d97979;
}

.quiz-result.failed
    .quiz-result-score strong,

.quiz-result.is-failed
    .quiz-result-score strong {

    color: #b23a3a;
}


/* =========================================================
   18. ERGEBNIS-AKTIONEN
   ========================================================= */

.quiz-result-actions {
    display: flex;
    justify-content: center;

    flex-wrap: wrap;

    gap: 0.85rem;

    margin-top: 1.5rem;
}


/* =========================================================
   19. MERKHILFE
   ========================================================= */

.quiz-container .memory-box {
    margin-top: 2.5rem;
}


/* =========================================================
   20. DEAKTIVIERTE ELEMENTE
   ========================================================= */

.quiz-option input:disabled {
    cursor: default;
}

.quiz-option:has(input:disabled) {
    cursor: default;
}

.quiz-actions button:disabled {
    opacity: 0.55;

    cursor: not-allowed;

    transform: none;
}


/* =========================================================
   21. HIDDEN
   ========================================================= */

.quiz-container [hidden] {
    display: none !important;
}


/* =========================================================
   22. TABLET
   ========================================================= */

@media (max-width: 760px) {

    .quiz-container {
        padding-top: 2rem;
        padding-bottom: 4rem;
    }

    .quiz-intro-card {
        padding: 1.5rem;
    }

    .quiz-meta {
        grid-template-columns: 1fr;
    }

    .quiz-meta-item {
        min-height: auto;
    }

    .quiz-question {
        padding: 1.4rem;
    }

    .quiz-question-header {
        align-items: flex-start;
        flex-direction: column;

        gap: 0.55rem;
    }

    /*
     * Auch Tablet:
     * Antworten immer untereinander.
     */
    .quiz-options {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   23. SMARTPHONE
   ========================================================= */

@media (max-width: 560px) {

    .quiz-container .content-container {
        width: min(100% - 1.2rem, 1000px);
    }

    .quiz-intro-card,
    .quiz-question,
    .quiz-result {
        border-radius: 14px;
    }

    .quiz-intro-card {
        padding: 1.25rem;
    }

    .quiz-question {
        padding: 1.2rem;
    }

    .quiz-question h2 {
        font-size: 1.08rem;
    }

    /*
     * Auch Smartphone:
     * exakt eine Antwort pro Zeile.
     */
    .quiz-options {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .quiz-option {
        width: 100%;

        padding: 0.9rem;

        border-radius: 10px;
    }

    .quiz-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-actions .button {
        width: 100%;
        min-width: 0;
    }

    .quiz-result {
        padding: 1.4rem;
    }

    .quiz-result-actions {
        flex-direction: column;
    }

    .quiz-result-actions .button {
        width: 100%;
    }

}


/* =========================================================
   24. SEHR KLEINE DISPLAYS
   ========================================================= */

@media (max-width: 380px) {

    .quiz-question {
        padding: 1rem;
    }

    .quiz-option {
        gap: 0.65rem;

        padding: 0.8rem;
    }

    .quiz-meta-item strong {
        font-size: 1.4rem;
    }

}


/* =========================================================
   25. TOUCH-GERÄTE
   ========================================================= */

@media (hover: none) {

    .quiz-option:hover {
        background: #f8fafc;
        border-color: #dce7f3;

        transform: none;
    }

    .quiz-option:has(
        input[type="radio"]:checked
    ):hover,
    .quiz-option:has(
        input[type="checkbox"]:checked
    ):hover {
        background: #e6f2ff;
        border-color: #006bb6;
    }

}


/* =========================================================
   26. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .quiz-question,
    .quiz-option,
    .quiz-actions .button {
        transition: none;
    }

}


/* =========================================================
   27. DRUCK
   ========================================================= */

@media print {

    .quiz-container {
        padding: 0;

        background: #ffffff;
    }

    .quiz-question,
    .quiz-intro-card {
        box-shadow: none;

        break-inside: avoid;
    }

    .quiz-actions,
    .quiz-result-actions {
        display: none;
    }

    .quiz-option {
        color: #000000;
        background: #ffffff;

        border: 1px solid #999999;
    }

}