/* =============================================
   CAE Quiz Module
   ============================================= */

.quiz-shell {
    font-family: 'Open Sans', 'Segoe UI', -apple-system, sans-serif;
    max-width: 960px;
    width: 100%;
    box-sizing: border-box;
    margin: 32px auto;
    background: #fff;
    overflow: hidden;
}

/* --- Topbar --- */
.quiz-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid #F0F0F0;
    background: #fff;
}

.quiz-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #E8664A;
    color: #fff !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    transition: background 0.2s;
    white-space: nowrap;
}
.quiz-btn-back:hover {
    background: #d45638;
    color: #fff !important;
    text-decoration: none;
}

.quiz-score-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.quiz-score-box {
    display: inline-block;
    padding: 6px 14px;
    border: 2px solid #E8664A;
    font-size: 13px;
    font-weight: 700;
    color: #3b4243;
    white-space: nowrap;
}

.quiz-timer-box {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #F5F5F5;
    font-size: 13px;
    font-weight: 700;
    color: #666;
    white-space: nowrap;
    min-width: 70px;
    justify-content: center;
}

/* --- Progress Bar --- */
.quiz-progress {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px 16px;
    background: #fff;
}

.quiz-progress__label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9E9E9E;
    white-space: nowrap;
    flex-shrink: 0;
}

.quiz-progress__bar {
    display: flex;
    gap: 5px;
    flex: 1;
    align-items: center;
}

.quiz-progress__segment {
    flex: 1;
    height: 8px;
    background: #EEEEEE;
    transition: background 0.35s ease;
    position: relative;
    overflow: hidden;
}

.quiz-progress__segment--current {
    background: #E8664A;
    transform-origin: left center;
    animation: quizSegmentFill 0.5s ease-out;
}
.quiz-progress__segment--correct { background: #4CAF50; }
.quiz-progress__segment--partial { background: #F9A825; }
.quiz-progress__segment--wrong   { background: #E53935; }

@keyframes quizSegmentFill {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* --- Body (question area) --- */
.quiz-body {
    padding: 24px 24px 28px;
}

/* --- Question meta badges --- */
.quiz-question-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.quiz-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
}

.quiz-badge--number {
    background: #E8664A;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-badge--points {
    background: #FFFDE7;
    color: #F57F17;
}

.quiz-badge--multiple {
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
    color: #9E9E9E;
    background: none;
    padding: 0 4px;
}

/* --- Question card --- */
.quiz-card {
    border: 2px solid #E8664A;
    padding: 20px;
    margin-bottom: 20px;
}

.quiz-card__competence {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #E8664A;
    margin-bottom: 8px;
}

.quiz-card__question {
    font-size: 16px;
    color: #2D2D2D;
    line-height: 1.55;
    margin-bottom: 10px;
}

.quiz-card__question p { margin: 0 0 8px; }
.quiz-card__question p:last-child { margin-bottom: 0; }
.quiz-card__question strong, .quiz-card__question b { font-weight: 700; }
.quiz-card__question ul, .quiz-card__question ol { padding-left: 20px; margin: 6px 0; }
.quiz-card__question li { margin-bottom: 4px; }

.quiz-card__subtext {
    font-size: 13px;
    color: #616161;
    line-height: 1.6;
    margin-bottom: 12px;
}

.quiz-card__context {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.quiz-card__context-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #3b4243;
}

.quiz-card__context-img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border: 1px solid #E0E0E0;
}

/* --- Multiple Choice Options --- */
.quiz-options {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.quiz-options button {
	border-radius: 0;
}

.quiz-options--text  { grid-template-columns: 1fr; }
.quiz-options--image { grid-template-columns: 1fr 1fr; }

.quiz-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #E0E0E0;
    background: #fff;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #424242;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}

.quiz-option--image-card {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    text-align: center;
}

.quiz-option:hover:not([disabled]):not([style*="pointer-events"]) {
    border-color: #BDBDBD;
    background: #FAFAFA;
}

.quiz-option--selected {
    border-color: #E8664A;
    background: #FFF0EC;
    font-weight: 700;
}

.quiz-option--correct {
    border-color: #4CAF50;
    background: #F1F8F1;
}

.quiz-option--wrong {
    border-color: #E53935;
    background: #FFF5F5;
}

.quiz-option__indicator {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #BDBDBD;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.quiz-option__indicator--radio    { border-radius: 50%; }
.quiz-option__indicator--checkbox { border-radius: 0; }

.quiz-option__indicator--checked {
    border-color: #E8664A;
    background: #E8664A;
}

.quiz-option__image {
    max-width: 120px;
    max-height: 100px;
    object-fit: contain;
}

.quiz-option__label {
    flex: 1;
}

.quiz-option__badge {
    position: absolute;
    top: 6px;
    right: 6px;
    line-height: 0;
}

/* --- Short Answer Input --- */
.quiz-sa-input {
    margin-bottom: 20px;
}

.quiz-sa-input__field {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    font-size: 15px;
    font-family: 'Open Sans', sans-serif;
    border: 2px solid #E0E0E0;
    outline: none;
    transition: border-color 0.2s;
    color: #2D2D2D;
    background: #fff;
}

.quiz-sa-input__field:focus {
    border-color: #E8664A;
}

.quiz-sa-input__field:disabled {
    background: #F5F5F5;
    color: #616161;
}

/* --- Feedback Banner --- */
.quiz-feedback {
    padding: 16px 18px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.quiz-feedback--correct {
    background: #F1F8F1;
    border-color: #C8E6C9;
}

.quiz-feedback--partial {
    background: #FFFDE7;
    border-color: #FFF176;
}

.quiz-feedback--wrong {
    background: #FFF5F5;
    border-color: #FFCDD2;
}

.quiz-feedback__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.quiz-feedback__label {
    font-weight: 700;
    font-size: 15px;
}

.quiz-feedback--correct .quiz-feedback__label { color: #4CAF50; }
.quiz-feedback--partial .quiz-feedback__label  { color: #F57F17; }
.quiz-feedback--wrong   .quiz-feedback__label  { color: #E53935; }

.quiz-feedback__points {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
}

.quiz-feedback__points--earned {
    background: #FFFDE7;
    color: #F57F17;
}

.quiz-feedback__points--zero {
    background: #F5F5F5;
    color: #9E9E9E;
}

.quiz-feedback__explanation {
    font-size: 13px;
    color: #424242;
    line-height: 1.6;
}

/* --- Actions (submit / next) --- */
.quiz-actions {
    display: flex;
    justify-content: flex-end;
}

.quiz-btn-submit {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    color: #fff;
    background: #E8664A;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
	border-radius: 0;
}

.quiz-btn-submit:hover {
    background: #d45638;
}

.quiz-btn-submit--disabled {
    background: #BDBDBD;
    cursor: not-allowed;
}

.quiz-btn-submit--disabled:hover {
    background: #BDBDBD;
}

/* --- Results Screen --- */
.quiz-results {
    text-align: center;
}

.quiz-results__circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 5px solid #4CAF50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    background: #F1F8F1;
}

.quiz-results__pct {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    color: #4CAF50;
}

.quiz-results__perfect-count {
    font-size: 12px;
    color: #9E9E9E;
    margin-top: 4px;
}

.quiz-results__stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.quiz-results__score-badge,
.quiz-results__time-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    font-weight: 700;
    font-size: 15px;
}

.quiz-results__score-badge {
    background: #FFFDE7;
    border: 1px solid #FFF176;
    color: #F57F17;
}

.quiz-results__time-badge {
    background: #F5F5F5;
    border: 1px solid #E0E0E0;
    color: #616161;
}

.quiz-results__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 24px;
}

.quiz-results__breakdown {
    border: 2px solid #E0E0E0;
    overflow: hidden;
    margin-bottom: 24px;
    text-align: left;
}

.quiz-results__breakdown-header {
    background: #F5F5F5;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 13px;
    color: #424242;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #E0E0E0;
}

.quiz-results__breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
}

.quiz-results__breakdown-label {
    font-size: 13px;
    color: #424242;
    font-weight: 600;
    flex: 1;
}

.quiz-results__breakdown-pts {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.quiz-results__breakdown-status {
    font-size: 11px;
    font-weight: 700;
    min-width: 58px;
    text-align: right;
}

.quiz-results__actions {
    margin-top: 4px;
}

.quiz-btn-restart {
    padding: 11px 26px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    color: #E8664A;
    background: transparent;
    border: 2px solid #E8664A;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
	border-radius: 0;
}

.quiz-btn-restart:hover {
    background: #E8664A;
    color: #fff;
}

/* --- Intro Screen --- */
.quiz-intro {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 36px 32px 40px;
}

.quiz-intro__message {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.quiz-intro__media {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.quiz-intro__character {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

.quiz-intro__play-btn {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border: none;
    background: #E8664A;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
	border-radius: 0;
}

.quiz-intro__play-btn:hover,
.quiz-intro__play-btn--playing {
    background: #d45638;
}

.quiz-intro__text {
    flex: 1;
    font-size: 16px;
    color: #2D2D2D;
    line-height: 1.65;
}

.quiz-intro__text p { margin: 0 0 10px; }
.quiz-intro__text p:last-child { margin-bottom: 0; }

.quiz-intro__actions {
    display: flex;
	justify-content: center;
}

@media (max-width: 640px) {
    .quiz-intro {
        padding: 24px 16px 28px;
    }
}

/* --- Quiz List Shortcode [cae_quiz_list] --- */
.cae-quiz-list {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.cae-quiz-list--cols-1 { grid-template-columns: 1fr; }
.cae-quiz-list--cols-2 { grid-template-columns: repeat(2, 1fr); }
.cae-quiz-list--cols-3 { grid-template-columns: repeat(3, 1fr); }
.cae-quiz-list--cols-4 { grid-template-columns: repeat(4, 1fr); }

.cae-quiz-card {
    display: flex;
    flex-direction: column;
}

.cae-quiz-card__label {
    background: #E8664A;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
}

.cae-quiz-card__body {
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
	border: 2px solid #E0E0E0;
	border-top: 0;
}

.cae-quiz-card__title {
    font-size: 17px;
    font-weight: 700;
    color: #2D2D2D;
    margin: 0;
    line-height: 1.3;
}

.cae-quiz-card__btn {
    display: inline-block;
    padding: 10px 20px;
    background: #E8664A;
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Open Sans', sans-serif;
    text-decoration: none;
    align-self: flex-start;
    transition: background 0.2s;
}

.cae-quiz-card__btn:hover {
    background: #d45638;
    color: #fff !important;
    text-decoration: none;
}

@media (max-width: 640px) {
    .cae-quiz-list--cols-2,
    .cae-quiz-list--cols-3,
    .cae-quiz-list--cols-4 {
        grid-template-columns: 1fr;
    }
}

/* --- Empty State --- */
.quiz-empty {
    padding: 40px 24px;
    text-align: center;
    color: #9E9E9E;
    font-size: 15px;
}

/* --- Hero banner --- */
.image-container.page {
    position: relative;
    max-height: 700px;
}

.quiz-hero-bloc {
    position: absolute;
    bottom: 45px;
    left: 0;
    width: auto;
    max-width: 55%;
    padding: 24px 36px;
    background: #E8664A;
    text-align: left;
    z-index: 1;
}

.quiz-hero-bloc h2,
.quiz-hero-bloc h3 {
    color: #fff;
    margin-bottom: 8px;
}

/* --- Page wrapper --- */
.quiz-page .wrapper {
    max-width: 1020px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 20px;
}

/* --- Responsive --- */

/* Prevent any child from blowing out the shell width */
.quiz-shell * {
    box-sizing: border-box;
    max-width: 100%;
}

/* WYSIWYG explanation — images and tables must not overflow */
.quiz-feedback__explanation img {
    max-width: 100%;
    height: auto;
    display: block;
}
.quiz-feedback__explanation table {
    width: 100%;
    overflow-x: auto;
    display: block;
}
.quiz-feedback__explanation p { margin: 0 0 8px; }
.quiz-feedback__explanation p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
    .quiz-shell {
        margin: 12px;
    }

    .quiz-topbar {
        padding: 10px 12px;
        gap: 6px;
    }

    .quiz-progress {
        padding: 8px 12px;
    }

    .quiz-progress__label {
        display: none;
    }

    .quiz-body {
        padding: 14px 12px 18px;
    }

    .quiz-options--image {
        grid-template-columns: 1fr 1fr;
    }

    .quiz-card {
        padding: 12px;
    }

    .quiz-card__question {
        font-size: 15px;
    }

    .quiz-btn-back {
        font-size: 12px;
        padding: 7px 10px;
    }

    .quiz-score-box {
        font-size: 11px;
        padding: 4px 8px;
    }

    .quiz-timer-box {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Full-width action buttons */
    .quiz-actions {
        justify-content: stretch;
    }

    .quiz-btn-submit {
        width: 100%;
        text-align: center;
    }

    .quiz-results__actions {
        display: flex;
    }

    .quiz-btn-restart {
        width: 100%;
        text-align: center;
    }

    /* Results breakdown: wrap pts + status under the label */
    .quiz-results__breakdown-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .quiz-results__breakdown-label {
        flex: 1 1 100%;
        order: 1;
    }

    .quiz-results__breakdown-pts {
        order: 2;
    }

    .quiz-results__breakdown-status {
        order: 3;
        min-width: auto;
        text-align: left;
    }

    /* Hero overlay */
    .quiz-hero-bloc {
        max-width: 75%;
        bottom: 20px;
        padding: 16px 20px;
    }
}

@media (max-width: 400px) {
    .quiz-shell {
        margin: 0;
    }

    .quiz-options--image {
        grid-template-columns: 1fr;
    }

    .quiz-hero-bloc {
        max-width: 90%;
        bottom: 12px;
        padding: 12px 16px;
    }

    .quiz-score-timer {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
}
