/* ==========================================================================
   QUIZ VERBES IRRÉGULIERS - CSS FINAL
   Incorrect : réponse utilisateur ✗ réponse attendue (sur une ligne)
   ========================================================================== */

/* ==========================================================================
   1. STRUCTURE DE BASE & LAYOUT
   ========================================================================== */
body, html {
    margin: 0; padding: 0; height: 100%; width: 100%;
    font-family: "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden; background-color: #f8f8f8;
    display: flex; flex-direction: column; min-height: 100vh;
}

canvas.webgl { 
    position: fixed; top: 0; left: 0; 
    width: 100vw; height: 100vh; 
    z-index: 0; pointer-events: none; 
}

main { position: relative; z-index: 1; width: 100%; }
.hero { position: relative; z-index: 10; }

.quiz-wrapper, .englobe-wrapper {
    position: relative; z-index: 10;
    background: linear-gradient(135deg, rgba(210, 230, 255, 0.4), rgba(225, 240, 255, 0.3));
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-radius: 20px; padding: 20px; margin: 20px auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); 
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-width: 1100px; width: 90%; box-sizing: border-box; text-align: center;
}

/* ==========================================================================
   2. ONGLETS (NIVEAUX & MODES)
   ========================================================================== */
.level-tabs { 
    display: flex; justify-content: center; 
    gap: 12px; flex-wrap: wrap; margin-bottom: 20px; 
}

.level-tab {
    appearance: none; padding: 12px 28px; 
    border: none; border-radius: 30px;
    font-weight: 700; text-transform: uppercase; 
    cursor: pointer; transition: all .3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); 
    color: #fff; outline: 0;
}

.level-tab[data-level=general] { background: linear-gradient(135deg, #2196f3, #1976d2); }
.level-tab[data-level=easy] { background: linear-gradient(135deg, #4caf50, #45a049); }
.level-tab[data-level=medium] { background: linear-gradient(135deg, #ff9800, #f57c00); }
.level-tab[data-level=hard] { background: linear-gradient(135deg, #f44336, #d32f2f); }

.level-tab.active { 
    transform: scale(1.1); 
    box-shadow: 0 8px 20px rgba(0,0,0,.3); 
    border: 2px solid #fff; 
}

.level-tab:hover:not(.active) { 
    transform: translateY(-2px); 
    filter: brightness(1.1); 
}

.mode-tabs { 
    display: flex; justify-content: center; 
    gap: 15px; flex-wrap: wrap; margin: 20px 0 30px; 
}

.mode-tab {
    appearance: none; padding: 15px 30px; 
    border: 2px solid rgba(31, 124, 255, 0.3);
    border-radius: 15px; font-weight: 600; 
    cursor: pointer; transition: all .3s ease;
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(10px);
    color: #1976d2; outline: 0; line-height: 1.6;
}

.mode-tab small { 
    display: block; font-size: 0.85em; 
    font-weight: 400; margin-top: 5px; color: #666; 
}

.mode-tab.active { 
    background: linear-gradient(135deg, #2196f3, #1976d2); 
    color: #fff; border-color: #1976d2; 
    transform: scale(1.05); 
    box-shadow: 0 6px 20px rgba(31, 124, 255, 0.4); 
}

.mode-tab.active small { color: #e3f2fd; }

.mode-tab:hover:not(.active) { 
    transform: translateY(-2px); 
    border-color: #1976d2; 
    background: rgba(255, 255, 255, 0.8); 
}

/* ==========================================================================
   3. TABLEAU, VERBES & INPUTS
   ========================================================================== */
.quiz-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 15px; 
}

.quiz-table td, .quiz-table th { 
    padding: 10px; 
    text-align: center; 
    vertical-align: middle; 
}

/* Colonnes Oeil / Check */
.check-column { 
    width: 50px; 
    padding: 5px!important; 
}

.check-cell { 
    width: 50px; 
    padding: 5px!important; 
    text-align: center!important; 
}

/* Entête de Verbe & Traductions */
.verb-header { 
    display: flex!important; 
    align-items: center!important; 
    justify-content: flex-start!important; 
    gap: 15px; 
}

.verb-translation { 
    font-weight: 800; 
    color: #101e6d; 
    text-align: left; 
    flex: 0 1 auto;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 200px;
}

/* Permettre le retour à la ligne dans la colonne de traduction */
.quiz-table td.verb-header,
.quiz-table td[data-label="Traduction"],
.quiz-table td[data-label="Translation"] {
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

.check-verb-btn {
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 38px; height: 38px;
    border-radius: 50%; 
    border: 1px solid rgba(0,0,0,0.1); 
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(5px); 
    cursor: pointer; 
    transition: all .3s ease; 
    font-size: 1.2rem; 
    color: #333; 
    flex-shrink: 0;
}

.check-verb-btn:hover { 
    background: rgba(255,255,255,0.6); 
    color: #1f7cff; 
    transform: scale(1.1); 
}

/* Inputs & Barre */
input.quiz-input[type=text], .barre {
    width: 100%; 
    text-align: center; 
    border-radius: 8px; 
    border: 1.5px solid rgba(0, 0, 0, 0.2);
    padding: 10px; 
    background: rgba(255, 255, 255, 0.9); 
    box-sizing: border-box; 
    font-size: 16px;
    transition: all 0.2s ease; 
    outline: none;
}

input.quiz-input[type=text]:focus { 
    background: #fff; 
    border-color: #1f7cff; 
    box-shadow: 0 0 0 3px rgba(31, 124, 255, 0.2); 
}

/* ==========================================================================
   4. MODE "FROM ONE FORM" - FORME DONNÉE (STYLE ORIGINAL CONSERVÉ)
   ========================================================================== */
.given-form-display {
    font-weight: 800!important; 
    color: #1565c0!important; 
    padding: 10px!important;
    text-align: center!important;
    font-size: 1em!important; 
    display: block!important;
}

/* ==========================================================================
   5. CORRECTIONS - S'ALIGNENT SUR LE STYLE DE GIVEN-FORM-DISPLAY
   ========================================================================== */

/* Réponse correcte - même structure que given-form, couleur verte */
.quiz-table td.correct > .answer-text,
.quiz-table td.correct > span.answer-text,
.quiz-table.correction td.correct > .answer-text,
.quiz-table.correction td.correct > span.answer-text {
    font-weight: 800!important; 
    color: #2e7d32!important; 
    padding: 10px!important;
    background: rgba(144,238,144,0.4)!important; 
    border-radius: 8px!important;
    border: 2px solid rgba(76,175,80,0.5)!important; 
    text-align: center!important;
    font-size: 1em!important; 
    display: block!important;
}

/* Icône check pour correct */
.quiz-table td.correct > .answer-text::after,
.quiz-table td.correct > span.answer-text::after,
.quiz-table.correction td.correct > .answer-text::after,
.quiz-table.correction td.correct > span.answer-text::after {
    content: ' ✓';
    color: #2e7d32;
    font-weight: 700;
    margin-left: 8px;
}

/* Réponse incorrecte - FUSIONNÉE sur une ligne */
/* Conteneur incorrect : affichage en ligne */
.quiz-table td.incorrect,
.quiz-table.correction td.incorrect {
    background: transparent!important;
}

/* Wrapper pour incorrect : réponse + croix + attendu */
.quiz-table td.incorrect > .incorrect-wrapper,
.quiz-table.correction td.incorrect > .incorrect-wrapper {
    font-weight: 800!important; 
    color: #c62828!important; 
    padding: 10px!important;
    background: rgba(255,182,193,0.4)!important; 
    border-radius: 8px!important;
    border: 2px solid rgba(244,67,54,0.5)!important; 
    text-align: center!important;
    font-size: 1em!important; 
    display: block!important;
}

/* Réponse utilisateur (dans incorrect) */
.incorrect-wrapper .user-answer {
    font-weight: 800;
    color: #c62828;
}

/* Croix rouge */
.incorrect-wrapper .cross {
    color: #c62828;
    font-weight: 700;
    margin: 0 8px;
}

/* Réponse attendue (dans incorrect) - même couleur mais moins marquée */
.incorrect-wrapper .expected-answer {
    font-weight: 600;
    color: #666;
}

/* Réponse manquante - même structure que given-form, couleur grise */
.quiz-table td.missing > small.expected,
.quiz-table.correction td.missing > small.expected {
    font-weight: 600!important; 
    color: #666!important; 
    padding: 10px!important;
    background: rgba(224,224,224,0.4)!important; 
    border-radius: 8px!important;
    border: 2px solid rgba(158,158,158,0.5)!important; 
    text-align: center!important;
    font-size: 1em!important; 
    display: block!important;
}

/* ==========================================================================
   6. MODES D'AFFICHAGE (GRID) & SCORES
   ========================================================================== */
.mode {
    background: rgba(255,255,255,0.3); 
    backdrop-filter: blur(10px); 
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 20px; 
    padding: 20px; 
    margin: 20px auto; 
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px;
}

.text-mode, .text-modesup { 
    font-weight: 700; 
    color: #101e6d; 
    margin-bottom: 10px; 
    text-align: center; 
    grid-column: 1/-1; 
}

.temps { 
    background: rgba(255,255,255,0.8); 
    border-radius: 15px; 
    padding: 12px; 
    border: 1px solid rgba(0,0,0,0.05); 
    display: flex; 
    flex-direction: column; 
}

.text-temps { 
    font-weight: 700; 
    margin-bottom: 8px; 
    color: #333; 
}

.personne { 
    color: #1f7cff; 
    padding: 2px 0; 
    font-size: .95em; 
}

.score-message { 
    margin: 30px 0 5px; 
    font-weight: 800; 
    font-size: 1.8rem; 
    color: #101e6d; 
}

.score-details { 
    display: block; 
    font-size: 1rem; 
    color: #555; 
    margin-bottom: 25px; 
    font-weight: 500; 
}

/* ==========================================================================
   7. ALERTES
   ========================================================================== */
.alert-success, .alert-primary, .alert-warning {
    padding: 15px 25px; 
    border-radius: 15px; 
    margin: 20px auto; 
    max-width: 500px;
    font-weight: 700; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 10px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    animation: fadeInUp 0.5s ease-out;
}

.alert-success { 
    background: rgba(76,175,80,0.2); 
    color: #2e7d32; 
    border: 1px solid rgba(76,175,80,0.3); 
}

.alert-primary { 
    background: rgba(31,124,255,0.2); 
    color: #1565c0; 
    border: 1px solid rgba(31,124,255,0.3); 
}

.alert-warning { 
    background: rgba(255,152,0,0.2); 
    color: #ef6c00; 
    border: 1px solid rgba(255,152,0,0.3); 
}

/* ==========================================================================
   8. BOUTONS D'ACTION & ANIMATIONS
   ========================================================================== */
#generatePdfButton, .btn-link, .quiz-buttons, .btn-submit-total {
    display: inline-block; 
    margin: 10px; 
    padding: 14px 30px; 
    font-weight: 700; 
    color: #fff;
    border: none; 
    border-radius: 30px; 
    background: #1f7cff; 
    box-shadow: 0 6px 15px rgba(31,124,255,0.3);
    cursor: pointer; 
    transition: all .2s ease; 
    text-decoration: none;
}

#generatePdfButton:hover, .quiz-buttons:hover { 
    background: #1560d0; 
    transform: translateY(-3px); 
    box-shadow: 0 8px 20px rgba(31,124,255,0.4); 
}

.quiz-actions { 
    text-align: center; 
    width: 100%; 
    margin: 20px auto 40px; 
    position: relative; 
    z-index: 10; 
}

@keyframes fadeInUp { 
    from { opacity: 0; transform: translateY(20px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* ==========================================================================
   9. RESPONSIVE - MOBILE (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Libellés mobiles - TOUJOURS gris */
    .quiz-table tbody tr td:not(.verb-header):not(.given-form-header):not(.check-cell)::before {
        content: attr(data-label); 
        display: block; 
        font-size: .75em; 
        text-transform: uppercase; 
        color: #666; 
        background: transparent;
        margin-bottom: 8px; 
        text-align: center;
        font-weight: 600;
    }
    
    /* Cacher les inputs dans la correction mobile */
    .quiz-table.correction tbody tr td input.quiz-input,
    .quiz-table.correction input.quiz-input,
    .quiz-table.correction input {
        display: none!important;
        visibility: hidden!important;
        height: 0!important;
        width: 0!important;
        padding: 0!important;
        margin: 0!important;
    }
    
    /* Sur mobile, les td n'ont PAS de background */
    .quiz-form td.correct, .quiz-table.correction td.correct,
    .quiz-form td.incorrect, .quiz-table.correction td.incorrect,
    .quiz-form td.missing, .quiz-table.correction td.missing,
    .quiz-form td.given, .quiz-table.correction td.given {
        background-color: transparent!important;
        background-image: none!important;
    }
    
    /* Layout mobile */
    .level-tabs { 
        display: grid; 
        grid-template-columns: 1fr 1fr; 
    }
    
    .mode-tabs { 
        flex-direction: row; 
        gap: 10px; 
    }
    
    .mode-tab { 
        width: auto; 
        flex: 1; 
        text-align: center; 
        padding: 12px 15px; 
        font-size: .9em; 
    }
    
    .quiz-table thead { 
        display: none; 
    }
    
    .quiz-table tbody tr {
        display: block; 
        margin-bottom: 20px; 
        padding: 15px;
        background: rgba(255,255,255,0.5); 
        border-radius: 15px; 
        border: 1px solid rgba(255,255,255,0.3);
    }
    
    .quiz-table tbody tr td { 
        display: block; 
        text-align: center!important; 
        padding: 8px 0; 
    }
    
    .check-cell { 
        display: flex!important; 
        justify-content: center!important; 
        align-items: center; 
        padding: 10px!important; 
        margin-top: 10px; 
        background: transparent!important; 
        border: none!important; 
        width: 100%; 
    }
    
    .verb-header {
        background: rgba(31,124,255,.2)!important; 
        backdrop-filter: blur(8px); 
        border-radius: 12px;
        border: 1px solid rgba(31,124,255,.2)!important; 
        padding: 10px!important;
        margin-bottom: 10px; 
        justify-content: center!important; 
        display: flex!important;
    }
    
    .given-form-header {
        background: rgba(31,124,255,.2)!important; 
        backdrop-filter: blur(8px); 
        border-radius: 12px;
        border: 1px solid rgba(31,124,255,.2)!important; 
        padding: 10px!important;
        display: flex!important; 
        flex-direction: column; 
        align-items: center!important; 
        justify-content: center!important; 
        gap: 8px;
    }
    
    .given-form-value { 
        margin: 0!important; 
        display: block; 
        width: 100%; 
    }
    
    .mode { 
        grid-template-columns: 1fr; 
    }
}

/* ==========================================================================
   10. RESPONSIVE - DESKTOP (min-width: 769px)
   ========================================================================== */
@media (min-width: 769px) {
    /* Les cellules desktop n'ont PAS de background de couleur */
    .quiz-form td.correct, 
    .quiz-table.correction td.correct,
    .quiz-form td.incorrect, 
    .quiz-table.correction td.incorrect,
    .quiz-form td.missing, 
    .quiz-table.correction td.missing { 
        background: transparent!important;
        padding: 12px!important;
    }
    
    /* Table desktop */
    .quiz-table { 
        border-collapse: collapse; 
    }
    
    .quiz-table td, .quiz-table th { 
        border-bottom: 1px solid rgba(0,0,0,0.05); 
    }
    
    .quiz-table td:first-child:not(.check-cell) { 
        width: auto !important;
        white-space: normal !important;
        min-width: 150px !important;
        max-width: 250px !important;
        padding-right: 20px; 
    }
    
    .given-form-header, .verb-header { 
        background: transparent!important; 
        border: none!important; 
        backdrop-filter: none!important; 
    }
}

.quiz-footer{max-width:1100px;width:90%;margin:40px auto 20px auto;padding:20px 30px;background:rgba(255,255,255,.3);backdrop-filter:blur(8px);border-radius:12px;border:1px solid rgba(255,255,255,.4);box-sizing:border-box}
.quiz-footer p{margin:0;font-size:.9rem;line-height:1.7;color:#555;text-align:center}
.quiz-footer strong{font-weight:700;color:#1976d2}
/* ==========================================================================
   11. ACCORDÉON — LISTES COMPLÈTES DES VERBES
   ========================================================================== */
.ivq-accordion { margin: 2rem 0; }

.ivq-accordion-item {
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 10px;
    margin-bottom: .6rem;
    overflow: hidden;
    background: rgba(255,255,255,.5);
    backdrop-filter: blur(8px);
}

.ivq-accordion-btn {
    width: 100%;
    text-align: left;
    background: rgba(255,255,255,.6);
    border: none;
    padding: .9rem 1.2rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #101e6d;
    transition: background .2s;
}

.ivq-accordion-btn:hover { background: rgba(255,255,255,.85); }

.ivq-accordion-btn::after {
    content: '\25B8';
    font-size: 1rem;
    transition: transform .25s;
    flex-shrink: 0;
    margin-left: .8rem;
}

.ivq-accordion-btn[aria-expanded="true"] { background: rgba(33,150,243,.08); }
.ivq-accordion-btn[aria-expanded="true"]::after { transform: rotate(90deg); }

.ivq-accordion-panel { display: none; overflow-x: auto; }
.ivq-accordion-panel.open { display: block; }

.ivq-verb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.ivq-verb-table th {
    background: #1976d2;
    color: #fff;
    padding: .55rem .9rem;
    text-align: left;
    font-weight: 700;
}

.ivq-verb-table td {
    padding: .45rem .9rem;
    border-bottom: 1px solid rgba(0,0,0,.05);
    color: #333;
    vertical-align: middle;
}

.ivq-verb-table tr:last-child td { border-bottom: none; }
.ivq-verb-table tbody tr:nth-child(even) td { background: rgba(33,150,243,.04); }
.ivq-verb-table tbody tr:hover td { background: rgba(33,150,243,.09); }

@media (max-width: 768px) {
    .ivq-verb-table thead { display: none; }
    .ivq-verb-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 10px;
        border-radius: 8px;
        background: rgba(255,255,255,.6);
        border: 1px solid rgba(0,0,0,.07);
    }
    .ivq-verb-table td {
        display: block;
        text-align: left;
        padding: 4px 0;
        border: none;
    }
    .ivq-verb-table td::before {
        content: attr(data-label) ': ';
        font-weight: 700;
        color: #1976d2;
        font-size: .8rem;
        text-transform: uppercase;
    }
}
