/* ============================================
   Conjugaison - Modal de test d'activite
   Interface click pour preview mode eleve
   ============================================ */

/* Overlay modal */
.test-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.test-modal-overlay.open {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Container modal */
.test-modal {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    position: relative;
}

/* Header modal */
.test-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    background: var(--primary);
    border-radius: 20px 20px 0 0;
    gap: 15px;
}

.test-modal-header h2 {
    font-size: 1.2rem;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
}

.test-badges {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.test-badge {
    background: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.btn-close-modal {
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    flex-shrink: 0;
    line-height: 1;
}

.btn-close-modal:hover {
    background: var(--background);
}

/* Corps modal */
.test-modal-body {
    padding: 25px;
}

/* --- Barre de progression --- */
.test-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 15px;
    background: var(--background);
    border-radius: var(--radius);
}

.test-progress-bar {
    flex: 1;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.test-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
    border-radius: 4px;
    width: 0%;
}

#test-progress-text {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    color: var(--text);
}

#test-score {
    font-weight: 600;
    font-size: 0.9rem;
    color: #4CAF50;
    white-space: nowrap;
}

/* --- Info (objectif + consigne) --- */
.test-info {
    margin-bottom: 15px;
}

.test-info p {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}

.test-consigne {
    background: #E3F2FD;
    padding: 12px 18px;
    border-radius: var(--radius);
    border-left: 4px solid #1976D2;
    color: #333;
    font-style: italic;
}

/* --- Zone phrase --- */
.test-phrase-zone {
    padding: 20px;
    background: var(--white);
    border: 1px solid #eee;
    border-radius: var(--radius);
    margin-bottom: 15px;
    min-height: 60px;
}

.test-phrase-display {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    line-height: 2;
}

.test-phrase-display .mot-normal {
    color: var(--text);
}

/* Trou a remplir (pointilles) */
.test-trou {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    height: 44px;
    padding: 4px 12px;
    background: #fff3e0;
    border: 2px dashed #f57c00;
    border-radius: 0 8px 8px 0;
    color: #f57c00;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.test-trou.rempli {
    border-style: solid;
    background: #fff3e0;
}

.test-trou.correct {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.test-trou.incorrect {
    background: #ffebee;
    border-color: #ef5350;
    color: #c62828;
}

.test-trou.active {
    box-shadow: 0 0 0 2px #f57c00;
}

/* Trou independant (sans radical a gauche) */
.test-trou.standalone {
    border-radius: 8px;
    border-left: 2px dashed #f57c00;
}

.test-trou.standalone.rempli {
    border-left-style: solid;
}

/* --- Reservoir --- */
.test-reservoir {
    background: var(--background);
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.test-reservoir-label {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 5px;
    font-weight: 500;
}

.test-terminaison {
    background: #fff3e0;
    border: 2px solid #f57c00;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: bold;
    color: #f57c00;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    font-size: 1.05rem;
}

.test-terminaison:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

.test-terminaison.selected {
    background: #f57c00;
    color: white;
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.4);
}

.test-terminaison.correct {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.test-terminaison.incorrect {
    background: #ffebee;
    border-color: #ef5350;
    color: #c62828;
}

.test-terminaison.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Pronom dans le reservoir */
.test-pronom {
    background: #e8f5e9;
    border: 2px solid #2e7d32;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: bold;
    color: #2e7d32;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    font-size: 1.05rem;
}

.test-pronom:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.test-pronom.selected {
    background: #2e7d32;
    color: white;
}

/* Forme complete (verbes irreguliers) */
.test-forme {
    background: #f5f5f5;
    border: 2px solid #424242;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: bold;
    color: #424242;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    font-size: 1.05rem;
}

.test-forme:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.test-forme.selected {
    background: #424242;
    color: white;
}

/* --- Association (2 colonnes) --- */
.test-association {
    display: flex;
    gap: 40px;
    justify-content: center;
    padding: 20px;
    margin-bottom: 15px;
}

.test-assoc-colonne {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 140px;
}

.test-assoc-colonne-titre {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.test-assoc-item {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    font-size: 1rem;
}

.test-assoc-conjugue {
    background: #fff3e0;
    border: 2px solid #f57c00;
    color: #e65100;
}

.test-assoc-conjugue:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

.test-assoc-conjugue.selected {
    background: #f57c00;
    color: white;
}

.test-assoc-conjugue.relie {
    opacity: 0.5;
    cursor: default;
}

.test-assoc-infinitif {
    background: var(--background);
    border: 2px solid #bbb;
    color: var(--text);
}

.test-assoc-infinitif:hover {
    border-color: var(--primary-dark);
    transform: scale(1.03);
}

.test-assoc-infinitif.selected {
    border-color: var(--primary-dark);
    background: var(--primary);
}

.test-assoc-infinitif.relie {
    opacity: 0.5;
    cursor: default;
}

/* Lignes de liaison association */
.test-assoc-liens {
    margin-top: 10px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.test-assoc-lien {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e8f5e9;
    border: 1px solid #81c784;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
}

.test-assoc-lien:hover {
    background: #ffebee;
    border-color: #ef9a9a;
}

.test-assoc-lien .lien-conjugue {
    color: #e65100;
    font-weight: 600;
}

.test-assoc-lien .lien-fleche {
    color: var(--text-light);
}

.test-assoc-lien .lien-infinitif {
    color: var(--text);
    font-weight: 500;
}

/* --- Identification (mots cliquables) --- */
.test-mot-cliquable {
    display: inline-block;
    padding: 8px 14px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.test-mot-cliquable:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.test-mot-cliquable.selected {
    background: #fff3e0;
    border-color: #f57c00;
    font-weight: bold;
}

.test-mot-cliquable.correct {
    background: #e8f5e9;
    border-color: #4caf50;
}

.test-mot-cliquable.incorrect {
    background: #ffebee;
    border-color: #ef5350;
}

.test-consigne-ident {
    font-size: 0.9rem;
    color: var(--text-light, #666);
    text-align: center;
    margin-bottom: 10px;
    font-style: italic;
}

/* Separation lettres (identification) */
.test-separation-lettres {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 15px 0;
    font-size: 1.6rem;
    user-select: none;
}

.test-separation-lettres .letter {
    padding: 8px 3px;
    font-weight: bold;
    cursor: default;
}

.test-separation-lettres .letter.radical-part {
    color: #000;
}

.test-separation-lettres .letter.terminaison-part {
    color: #f57c00;
}

.test-separation-lettres .sep-zone {
    width: 16px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.test-separation-lettres .sep-zone:hover::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 40px;
    background: rgba(245, 124, 0, 0.4);
    border-radius: 2px;
}

.test-separation-lettres .sep-marker {
    width: 3px;
    height: 40px;
    background: #f57c00;
    border-radius: 2px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0 1px;
}


/* --- Feedback --- */
.test-feedback {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.test-feedback.show {
    display: block;
}

.test-feedback.success {
    background: #E8F5E9;
    border: 1px solid #81C784;
    color: #2E7D32;
}

.test-feedback.error {
    background: #FFEBEE;
    border: 1px solid #EF9A9A;
    color: #C62828;
}

.test-feedback.info {
    background: #E3F2FD;
    border: 1px solid #64B5F6;
    color: #1565C0;
}

/* --- Controles --- */
.test-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-test {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-test:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-test:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-test-primary {
    background: #4CAF50;
    color: white;
}

.btn-test-primary:hover {
    background: #43A047;
}

#btn-test-recommencer {
    background: #FF9800;
    color: white;
}

#btn-test-recommencer:hover {
    background: #F57C00;
}

#btn-test-solution {
    background: #9E9E9E;
    color: white;
}

#btn-test-solution:hover {
    background: #757575;
}

/* --- Resultat final --- */
.test-resultat {
    text-align: center;
    padding: 30px;
}

.test-resultat h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.test-resultat .score-final {
    font-size: 3rem;
    font-weight: bold;
    color: #4CAF50;
    margin: 15px 0;
}

.test-resultat .score-detail {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.test-resultat .score-message {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 20px;
}

.test-resultat .btn-test {
    margin-top: 10px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .test-modal-overlay {
        padding: 0;
    }

    .test-modal {
        border-radius: 0;
        margin: 0;
        min-height: 100vh;
    }

    .test-modal-header {
        border-radius: 0;
        padding: 15px;
        flex-wrap: wrap;
    }

    .test-modal-header h2 {
        font-size: 1rem;
    }

    .test-modal-body {
        padding: 15px;
    }

    .test-phrase-display {
        font-size: 1rem;
    }

    .test-trou {
        min-width: 55px;
        height: 38px;
        font-size: 1rem;
        padding: 4px 8px;
    }

    .test-terminaison,
    .test-pronom,
    .test-forme {
        padding: 8px 14px;
        font-size: 0.95rem;
    }

    .test-controls {
        flex-direction: column;
    }

    .btn-test {
        width: 100%;
    }

    .test-association {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }

    .test-assoc-colonne {
        width: 100%;
        max-width: 250px;
    }

    .test-separation-lettres {
        font-size: 1.3rem;
    }
}
