/*------------------------
 *  Flashcard application
 *  (auto-évaluation + QCM)
 *------------------------*/

/* Variables */
:root {
    --quiz-bg-color: var(--global-palette8);
    --quiz-progress-bar: #dedad3;
    --quiz-separator: var(--global-palette6);
    --quiz-button-shadow: var(--global-palette6);
    --quiz-button-border: var(--global-palette6);
    --quiz-button-background: var(--global-palette9);
    --quiz-bubble-border: var(--global-palette6);

    --quiz-control-success-bg: #e6ffcc;
    --quiz-control-success-border: #58cb05;
    --quiz-control-success-color: #58cb05;

    --quiz-control-fail-bg: #ffe6e6;
    --quiz-control-fail-border: #e85a4f;
    --quiz-control-fail-color: #e85a4f;

    --quiz-control-pending-bg: var(--global-palette9);
    --quiz-control-pending-border: var(--global-palette6);
    --quiz-control-pending-color: var(--global-palette6);
}

/* Prevent template from showing before load */
div[v-cloak] { display: none !important; }

#app_flashcard {
    font-size: 15px;
    height: 100%;
    position: relative;
}

/*------------------------
 *  Layout principal
 *------------------------*/
.parlonscoreen_quiz_container {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    align-items: stretch;
}

.pcquiz_layout_main {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: var(--quiz-bg-color);
}

.pc_quiz_layout_top {
    padding: 1em;
    display: flex;
    column-gap: 1em;
    max-width: 800px;
    width: 100%;
    align-self: center;
}

@media screen and (min-width: 600px) {
    .pc_quiz_layout_top {
        padding: 2em 1em;
    }
}

.pc_quiz_layout_top_left {
    flex: 1;
}

/*------------------------
 *  Stats & progression
 *------------------------*/
.wpfc_stats {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 5px;
}

.wpfc_progress_state {
    text-align: center;
}

.wpfc_stat_green {
    color: var(--global-palette1);
}

.wpfc_stat_red {
    color: var(--global-palette2);
}

.pcquiz_progress_bar_wrapper {
    border-radius: 5px;
    background-color: var(--quiz-progress-bar);
    overflow: hidden;
}

.pcquiz_progress_bar {
    height: 12px;
    background-color: var(--global-palette1);
    transition: width ease-in-out .5s;
    border-radius: 5px;
}

/*------------------------
 *  Mode auto-évaluation
 *------------------------*/
.wpfc_review_container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    max-width: 720px;
    overflow: hidden;
    margin: auto;
}

/* Cards (flip) */
.card-container {
    width: 100%;
    height: 100%;
    margin: 2em 0;
    perspective: 1000px;
    padding: 2em !important;
    max-width: 520px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-inner .illustration {
    max-width: 164px;
}

.is-flipped .card-container .card-inner {
    transform: rotateX(180deg);
}

.card-front,
.card-back {
    background-color: var(--global-palette9);
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-perspective: 0;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translate3d(0, 0, 0);
    visibility: visible;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 -1px 1px rgba(0,0,0,0.04),
        0 2px 2px rgba(0,0,0,0.04),
        0 4px 4px rgba(0,0,0,0.04),
        0 8px 8px rgba(0,0,0,0.04),
        0 16px 16px rgba(0,0,0,0.04);
}

.card-back {
    transform: rotateX(180deg);
}

/* Carte auto-évaluation */
.autoeval-card-wrapper {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1em 0;
}

/* Barre d'options (toggle Inverser) */
.swiper-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flip-notice {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--global-palette6);
}

.swiper-switch-wrapper {
    display: flex;
}

.swiper-switch-wrapper > span {
    font-size: 13px;
    font-weight: 500;
    color: var(--global-palette6);
    margin-right: .7em;
}

/* Icône son */
.icon-sound-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 1;
    visibility: visible;
    transition: .6s ease-in-out;
    padding: .6em;
    cursor: pointer;
}

.icon-sound {
    display: block;
    width: 20px;
    height: 20px;
    background-image: url(../assets/icon-sound.svg);
    background-size: contain;
}

.icon-sound-wrapper.is-visible {
    opacity: 0;
    visibility: hidden;
}

/***********************
 *  Switch (inverser)
 ***********************/
.switch-wrap {
    cursor: pointer;
    background: var(--global-palette3);
    padding: 4px;
    width: 40px;
    height: 24px;
    border-radius: 15px;
}

.switch-wrap input {
    position: absolute !important;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-wrap .switch {
    height: 100%;
    display: grid;
    grid-template-columns: 0fr 1fr 1fr;
    transition: .2s;
}

.switch-wrap .switch:after {
    content: '';
    border-radius: 50%;
    background: var(--global-palette6);
    grid-column: 2;
    transition: background .2s;
}

.switch-wrap input:checked + .switch {
    grid-template-columns: 1fr 1fr 0fr;
}

.switch-wrap input:checked + .switch:after {
    background-color: var(--global-palette1);
}

/***********************
 *  Boutons d'action (auto-éval)
 ***********************/
.wpfc_actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 1em 0;
}

.wpfc_actions > button,
.wpfc_actions > button:hover {
    box-shadow: none !important;
}

.wpfc_actions button {
    border-radius: 10px !important;
    color: var(--global-palette3) !important;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 8px !important;
    transition: none !important;
    line-height: 1.2;
}

.wpfc_actions .answer {
    width: auto;
}

.wpfc_actions button:hover,
.wpfc_actions button:active,
.wpfc_actions button:focus {
    color: var(--global-palette3);
}

.wpfc_actions button.wrong {
    background: #fff5f5 !important;
    border: 1.5px solid var(--global-palette2) !important;
    color: var(--global-palette2) !important;
}

.wpfc_actions button.wrong:hover {
    background: #ffe4e4 !important;
}

.wpfc_actions button.hesitate {
    background: #fff8f0 !important;
    border: 1.5px solid #f59e0b !important;
    color: #b45309 !important;
}

.wpfc_actions button.hesitate:hover {
    background: #fef3c7 !important;
}

#app_flashcard .wpfc_actions button.almost {
    background: #f0fdf9 !important;
    border: 1.5px solid #2dd4bf !important;
    color: #0f766e !important;
}

#app_flashcard .wpfc_actions button.almost:hover {
    background: #ccfbf1 !important;
}

.wpfc_actions button.good {
    background: #f0fdf4 !important;
    border: 1.5px solid var(--global-palette1) !important;
    color: var(--global-palette1) !important;
}

.wpfc_actions button.good:hover {
    background: #dcfce7 !important;
}

.wpfc_actions button:not(:last-child) {
    margin-right: 0;
}

.wpfc_actions button:disabled,
.wpfc_actions button[disabled],
.wpfc_actions button:disabled:hover,
.wpfc_actions button[disabled]:hover {
    background: var(--global-palette7) !important;
    border: 1px solid var(--global-palette6) !important;
    color: var(--global-palette6) !important;
    cursor: default;
}

.wpfc_btn_neutral {
    background: var(--global-palette9) !important;
    border-radius: 30px;
    color: var(--global-palette3) !important;
}

.wpfc_btn_full {
    width: 100%;
    grid-column: 1 / -1;
}

/*------------------------
 *  Mode quiz
 *------------------------*/
.pcquiz_layout_question {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.pcquiz_layout_question.disabled .pc_quiz_layout_middle {
    pointer-events: none;
}

.pc_quiz_layout_middle {
    flex: 1;
    padding: 1em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.pcquiz_layout_middle_inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: 1em;
}

.pc_quiz_layout_bottom {
    min-height: 90px;
    width: 100%;
    display: flex;
    align-items: end;
}

/* Zone question */
.pcquiz_statement {
    text-align: center;
}

.pcquiz_question {
    align-items: center;
    text-align: center;
    display: flex;
    max-width: 360px;
}

.pcquiz_question.has-illustration {
    flex-direction: column;
}

.pcquiz_question span {
    display: inline-block;
    padding: .3em 1em;
    border-radius: 5px;
}

.pcquiz_question_face_wrapper {
    width: 80px;
    height: 89px;
}

.pcquiz_question_illustration {
    max-width: 140px;
    padding: 10px;
    background: var(--global-palette9);
    border: 2px solid var(--global-palette7);
    border-radius: 6px;
}

@media screen and (min-width: 820px) {
    .pcquiz_question_face_wrapper {
        width: 120px;
        height: 133px;
    }
}

.pcquiz_question_text {
    position: relative;
    font-size: 18px;
    font-weight: bold;
}

/* Zone réponse */
.pcquiz_answerzone {
    width: 100%;
    max-width: 400px;
    border-bottom: 1px dashed var(--quiz-separator);
    min-height: 60px;
    padding: .3em;
}

/* Zone propositions */
.pcquiz_propositionszone {
    padding: 1em;
    text-align: center;
    min-height: 80px;
}

.pcquiz_answerzone span,
.pcquiz_propositionszone span {
    cursor: pointer;
    display: inline-block;
    border: 2px solid var(--quiz-button-border);
    box-shadow: 0 1px 0 0 var(--quiz-button-shadow);
    background: var(--quiz-button-background);
    border-radius: 5px;
    padding: .2em .5em;
    margin: .3em .5em;
    transition: all ease-in-out .2s;
}

.pcquiz_propositionszone.single span {
    font-size: 20px;
}

.pcquiz_propositionszone span.disabled {
    pointer-events: none;
    border: 2px solid var(--global-palette7);
    color: var(--global-palette6);
}

.pcquiz_propositionszone span.selected {
    border: 2px solid var(--quiz-control-pending-border);
    background: var(--quiz-control-pending-bg);
    color: var(--quiz-control-pending-color);
}

.pcquiz_propositionszone span.active {
    pointer-events: none;
    border: 2px solid var(--quiz-control-success-border);
    color: var(--quiz-control-success-color);
}

.pcquiz_propositionszone span.answer-correct {
    pointer-events: none;
    border: 2px solid var(--quiz-control-success-border);
    background: var(--quiz-control-success-bg);
    color: var(--quiz-control-success-color);
}

.pcquiz_propositionszone span.answer-wrong {
    pointer-events: none;
    border: 2px solid var(--quiz-control-fail-border);
    background: var(--quiz-control-fail-bg);
    color: var(--quiz-control-fail-color);
}

/* Bulle de discours */
.arrow_box {
    position: relative;
    background: var(--global-palette9);
    border: 2px solid var(--quiz-bubble-border);
}

.arrow_box:after,
.arrow_box:before {
    right: 100%;
    top: 50%;
    border: solid transparent;
    content: "";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

.arrow_box:after {
    border-color: rgba(255, 255, 255, 0);
    border-right-color: var(--global-palette9);
    border-width: 7px;
    margin-top: -7px;
}

.arrow_box:before {
    border-color: rgba(229, 229, 229, 0);
    border-right-color: var(--quiz-bubble-border);
    border-width: 10px;
    margin-top: -10px;
}

/* Contrôles quiz */
.pcquiz_layout_control {
    border-top: 2px solid var(--quiz-separator);
    width: 100%;
}

.pcquiz_layout_control > div {
    padding: 1em 1.5em 2em 1.5em;
}

.pcquiz_layout_wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    max-width: 800px;
    margin: auto;
}

@media screen and (min-width: 600px) {
    .pcquiz_layout_control > div {
        padding: 1em 1.5em;
    }
}

.pcquiz_control_success {
    background-color: var(--global-palette7);
    color: var(--global-palette1);
    box-shadow: none;
}

.pcquiz_control_fail {
    background-color: var(--global-palette8);
    color: var(--global-palette2);
    box-shadow: none;
    flex-direction: column;
}

.pcquiz_control_pending button.pass-btn {
    background: var(--global-palette9);
    color: var(--global-palette6);
    box-shadow: none;
}

.pcquiz_control_pending button,
.pcquiz_control_success button {
    background-color: var(--global-palette1);
    box-shadow: none !important;
}

.pcquiz_control_pending button:hover,
.pcquiz_control_pending button:focus,
.pcquiz_control_success button:hover,
.pcquiz_control_success button:focus {
    background-color: var(--global-palette1);
    color: var(--global-palette9);
}

.pcquiz_control_fail button {
    background-color: var(--global-palette2);
    box-shadow: none;
}

.pcquiz_control_fail button:hover,
.pcquiz_control_fail button:focus {
    box-shadow: none;
    background-color: var(--global-palette2);
    color: var(--global-palette9);
}

.pcquiz_control_pending button:disabled {
    cursor: default;
    opacity: 1;
    background: var(--global-palette7) !important;
    color: var(--global-palette6);
}

/*------------------------
 *  Transitions
 *------------------------*/
.fade-enter-active, .fade-leave-active {
    transition: all .3s;
}

.fade-enter, .fade-leave-to {
    opacity: 0;
}

.switch-enter-active,
.switch-leave-active {
    transition: all .2s;
}

.switch-enter {
    opacity: 0;
    transform: translateX(50px);
}

.switch-leave-to {
    opacity: 0;
    transform: translateX(-40px);
}

/* Supprime toutes les transitions Vue quand le panneau options est ouvert */
.wpfc-no-anim .switch-enter-active,
.wpfc-no-anim .switch-leave-active,
.wpfc-no-anim .fade-enter-active,
.wpfc-no-anim .fade-leave-active,
.wpfc-no-anim .wpfc-screen-enter-active,
.wpfc-no-anim .wpfc-screen-leave-active {
    transition: none !important;
    position: static !important;
}
.wpfc-no-anim .switch-enter,
.wpfc-no-anim .switch-leave-to,
.wpfc-no-anim .fade-enter,
.wpfc-no-anim .fade-leave-to,
.wpfc-no-anim .wpfc-screen-enter,
.wpfc-no-anim .wpfc-screen-leave-to {
    opacity: 1 !important;
    transform: none !important;
}

/*------------------------
 *  Écran terminé
 *------------------------*/
.pcquiz_layout_finished {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 36px;
    padding: 40px 24px;
}

/* Transitions entre écrans (quiz → résultats → etc.) */
.wpfc-screen-leave-active {
    position: absolute;
    inset: 0;
    transition: opacity 0.08s ease;
}
.wpfc-screen-enter-active {
    transition: opacity 0.2s ease;
}
.wpfc-screen-enter,
.wpfc-screen-leave-to {
    opacity: 0;
}

/* Header */
.wpfc-result-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.wpfc-result-trophy {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fef3e2;
    border: 2px solid #fde68a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
}

.wpfc-result-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin: 0 !important;
    line-height: 1.2;
}

.wpfc-result-sub {
    font-size: 14px;
    color: var(--muted);
    margin: 0 !important;
}

/* Cartes de stats */
.wpfc-result-stats {
    display: flex;
    gap: 14px;
}

.wpfc-result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 36px;
    border-radius: 16px;
    min-width: 130px;
    text-align: center;
}

.wpfc-result-stat--correct {
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
}

.wpfc-result-stat--wrong {
    background: #fff5f5;
    border: 1.5px solid #fecaca;
}

.wpfc-result-stat__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wpfc-result-stat--correct .wpfc-result-stat__icon {
    background: var(--global-palette1);
    color: #fff;
}

.wpfc-result-stat--wrong .wpfc-result-stat__icon {
    background: var(--brand);
    color: #fff;
}

.wpfc-result-stat__number {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
}

.wpfc-result-stat--correct .wpfc-result-stat__number { color: var(--global-palette1); }
.wpfc-result-stat--wrong .wpfc-result-stat__number { color: var(--brand); }

.wpfc-result-stat__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

/* Boutons d'action */
.wpfc-result-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

.wpfc-result-btn {
    padding: 14px 24px;
    border-radius: 24px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .1s;
    text-align: center;
}

.wpfc-result-btn:active { transform: scale(0.98); }

.wpfc-result-btn--primary {
    background: var(--brand);
    color: #fff;
}
.wpfc-result-btn--primary:hover { background: var(--global-palette2); }

.wpfc-result-btn--secondary {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    padding: 11px 24px;
}
.wpfc-result-btn--secondary:hover {
    background: var(--soft);
    border-color: var(--global-palette6);
    color: var(--text);
}

/*------------------------
 *  Deck vide
 *------------------------*/
.wpfc-review-done {
    text-align: center;
}

/*------------------------
 *  Bouton options (engrenage)
 *------------------------*/
.wpfc-options-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    background: var(--quiz-progress-bar);
    color: var(--global-palette3);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, background 0.2s ease;
}
.wpfc-options-btn:hover {
    transform: scale(1.05);
    background: rgba(26,32,44,0.16);
    color: var(--global-palette3);
}
.wpfc-options-btn svg {
    display: block;
}

.pcmh-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/*------------------------
 *  Panneau options (overlay)
 *------------------------*/
.wpfc-options-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-end;
}

.wpfc-options-panel {
    background: var(--global-palette9);
    border-radius: 20px 20px 0 0;
    width: 100%;
    padding: 20px 20px 36px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

@media (min-width: 520px) {
    .wpfc-options-overlay {
        align-items: center;
        justify-content: center;
    }
    .wpfc-options-panel {
        width: 360px;
        border-radius: 20px;
        padding: 20px 20px 24px;
    }
}

.wpfc-opt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.wpfc-opt-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text, #1a202c);
}

.wpfc-opt-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--quiz-progress-bar);
    color: var(--global-palette3);
    cursor: pointer;
    padding: 0;
}
.wpfc-opt-close:hover {
    background: rgba(26,32,44,0.16);
}

.wpfc-opt-section {
    padding: 16px 0;
    border-top: 1px solid var(--quiz-progress-bar);
}

.wpfc-opt-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted, #718096);
    margin: 0 0 12px 0;
}

/* Grille des modes */
.wpfc-opt-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.wpfc-opt-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: 12px;
    border: 2px solid var(--quiz-progress-bar);
    background: transparent;
    color: var(--muted, #718096);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.wpfc-opt-mode-btn svg {
    stroke: currentColor;
}
.wpfc-opt-mode-btn:hover {
    border-color: var(--global-palette5, #a0aec0);
    color: var(--text, #1a202c);
    background: var(--soft, #f7f7f7);
}
.wpfc-opt-mode-btn.active {
    border-color: var(--brand, #e75480);
    color: var(--brand, #e75480);
    background: color-mix(in srgb, var(--brand, #e75480) 8%, transparent);
}

/* Ligne son */
.wpfc-opt-sound-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wpfc-opt-sound-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text, #1a202c);
}
.wpfc-opt-sound-label svg {
    stroke: var(--muted, #718096);
    flex-shrink: 0;
}
