/* ========== SOLUTION DÉFINITIVE - DÉBORDEMENT DES MOTS ========== */

/* Conteneurs avec contrôle strict du débordement */
.interactif-reorderwords-words,
.interactif-reordersentences-sentences,
.interactif-reorderwords-sentence,
.interactif-reordersentences-result,
.reorder-target {
    display: block !important; /* Force block pour éviter flex issues */
    padding: 12px;
    margin-bottom: 15px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e6f7ff;
    min-height: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden; /* Force le contenu à rester dans le conteneur */
    word-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

/* Mots avec contrainte stricte de largeur */
.interactif-reorderword,
.interactif-reorderword-selected {
    display: inline-block;
    margin: 3px 2px;
    padding: 6px 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fdff 100%);
    border-radius: 6px;
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid #00d9ff;
   
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
    user-select: none;
    color: #2c3e50;
    font-weight: 600;
    
    /* Contraintes strictes pour éviter le débordement */
    max-width: calc(100% - 20px) !important;
    width: auto;
    box-sizing: border-box;
    word-break: break-all; /* Force la coupure des mots longs */
    overflow-wrap: anywhere; /* Casse n'importe où si nécessaire */
    hyphens: auto;
    white-space: normal;
    
    /* Fallback pour les navigateurs anciens */
    -ms-word-break: break-all;
    word-wrap: break-word;
}

/* Phrases avec gestion optimisée */
.interactif-reordersentence,
.interactif-reordersentence-selected {
    display: block;
    margin: 6px 0;
    padding: 8px 10px;
    font-size: 0.9em;
    line-height: 1.4;
    background: linear-gradient(135deg, #ffffff 0%, #f8fdff 100%);
    border-radius: 6px;
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid #00d9ff;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
    user-select: none;
    color: #2c3e50;
    font-weight: 600;
    
    /* Contraintes pour les phrases */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* États hover simplifiés */
.interactif-reorderword:hover,
.interactif-reordersentence:hover {
    background: #00d9ff;
    border-color: #0099cc;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

/* États sélectionnés */
.interactif-reorderword-selected,
.interactif-reordersentence-selected {
    background: #ffd700 !important;
    border-color: #ffc107 !important;
    color: #856404 !important;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

/* Conteneurs principaux avec padding adapté */
.interactif-reorderwords-container,
.interactif-reordersentences-container {
    margin: 15px 0;
    padding: 15px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fdff 100%);
    border: 2px solid #00d9ff;
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.1);
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Empêche tout débordement */
}

/* Zone de feedback avec gestion du texte */
.question-results {
    margin: 10px 0;
    padding: 0;
    list-style: none;
    width: 100%;
    box-sizing: border-box;
}

.question-results li {
    margin: 6px 0;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 4px solid #6c757d;
    background: #f8f9fa;
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.question-results .explanation {
    color: #495057;
    background: #fff9e6;
    padding: 10px 12px;
    border-radius: 6px;
    margin: 6px 0;
    border-left: 3px solid #ffc107;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.question-results .correct-answer,
.question-results .user-answer {
    padding: 8px 12px;
    border-radius: 6px;
    margin: 5px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.question-results .correct-answer {
    background: #d4edda;
    color: #155724;
    border-left: 3px solid #28a745;
}

.question-results .user-answer {
    background: #f8f9fa;
    color: #495057;
    border-left: 3px solid #6c757d;
    font-style: italic;
}

.question-results .question-header {
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #00d9ff;
    border-radius: 6px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

/* Support RTL amélioré */
[dir="rtl"] .interactif-reorderwords-words,
[dir="rtl"] .interactif-reordersentences-sentences,
[dir="rtl"] .interactif-reorderwords-sentence,
[dir="rtl"] .interactif-reordersentences-result {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .interactif-reorderword,
[dir="rtl"] .interactif-reorderword-selected {
    direction: rtl;
    text-align: right;
}

/* Media queries ultra-sécurisés */
@media (max-width: 768px) {
    .interactif-reorderword,
    .interactif-reorderword-selected {
        font-size: 0.8em;
        padding: 5px 7px;
        margin: 2px 1px;
        max-width: calc(100% - 10px) !important;
    }
    
    .interactif-reorderwords-container,
    .interactif-reordersentences-container {
        padding: 12px;
        margin: 12px 0;
    }
    
    .interactif-reorderwords-words,
    .interactif-reordersentences-sentences,
    .interactif-reorderwords-sentence,
    .interactif-reordersentences-result {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .interactif-reorderword,
    .interactif-reorderword-selected {
        display: block !important;
        width: calc(100% - 4px) !important;
        max-width: calc(100% - 4px) !important;
        margin: 3px 2px !important;
        padding: 6px 8px;
        font-size: 0.8em;
        text-align: center;
        box-sizing: border-box;
    }
    
    .interactif-reorderwords-container,
    .interactif-reordersentences-container {
        padding: 10px;
        margin: 10px 0;
    }
    
    .interactif-reorderwords-words,
    .interactif-reordersentences-sentences,
    .interactif-reorderwords-sentence,
    .interactif-reordersentences-result {
        padding: 8px;
        min-height: 45px;
    }
    
    .question-results .explanation,
    .question-results .correct-answer,
    .question-results .user-answer,
    .question-results .question-header {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .interactif-reorderword,
    .interactif-reorderword-selected {
        display: block !important;
        width: calc(100% - 2px) !important;
        max-width: calc(100% - 2px) !important;
        margin: 2px 1px !important;
        padding: 4px 6px;
        font-size: 0.75em;
    }
    
    .interactif-reorderwords-container,
    .interactif-reordersentences-container {
        padding: 8px;
        margin: 8px 0;
    }
    
    .interactif-reorderwords-words,
    .interactif-reordersentences-sentences,
    .interactif-reorderwords-sentence,
    .interactif-reordersentences-result {
        padding: 6px;
        min-height: 40px;
    }
    
    .question-results .explanation,
    .question-results .correct-answer,
    .question-results .user-answer,
    .question-results .question-header {
        padding: 4px 6px;
        font-size: 0.75rem;
        line-height: 1.3;
    }
}

/* Animations conservées mais simplifiées */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Classes utilitaires pour forcer la conformité */
.force-no-overflow {
    overflow: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
}

.force-max-width {
    max-width: 100% !important;
    width: auto !important;
    box-sizing: border-box !important;
}
/* ========== CSS POUR GRAMMAR-EXPLANATION ========== */

/* Conteneur principal de l'explication grammaticale */
.grammar-explanation {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    font-family: 'system-ui', 'Segoe UI', sans-serif;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

/* Effet de bordure animée */
.grammar-explanation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #28a745, #ffc107, #dc3545);
    background-size: 400% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Titre de l'explication */
.grammar-explanation .title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.grammar-explanation .title::before {
    content: '📚';
    margin-right: 10px;
    font-size: 1.2em;
}

[dir="rtl"] .grammar-explanation .title::before {
    margin-right: 0;
    margin-left: 10px;
}

/* Contenu principal */
.grammar-explanation .content {
    color: #495057;
    font-size: 1rem;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

/* Paragraphes */
.grammar-explanation p {
    margin: 0 0 15px 0;
    text-align: justify;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.grammar-explanation p:last-child {
    margin-bottom: 0;
}

/* Support RTL pour l'arabe */
[dir="rtl"] .grammar-explanation {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .grammar-explanation p {
    text-align: right;
}

/* Listes dans l'explication */
.grammar-explanation ul,
.grammar-explanation ol {
    margin: 15px 0;
    padding-left: 25px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

[dir="rtl"] .grammar-explanation ul,
[dir="rtl"] .grammar-explanation ol {
    padding-left: 0;
    padding-right: 25px;
}

.grammar-explanation li {
    margin: 8px 0;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Mise en évidence du texte important */
.grammar-explanation .highlight,
.grammar-explanation strong,
.grammar-explanation b {
    color: #007bff;
    font-weight: 600;
    background: linear-gradient(120deg, rgba(0, 123, 255, 0.1) 0%, transparent 100%);
    padding: 2px 4px;
    border-radius: 3px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Exemples dans l'explication */
.grammar-explanation .example {
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9ff 100%);
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #1565c0;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

[dir="rtl"] .grammar-explanation .example {
    border-left: none;
    border-right: 4px solid #2196f3;
    border-radius: 8px 0 0 8px;
}

.grammar-explanation .example::before {
    content: '💡';
    position: absolute;
    top: 12px;
    left: -2px;
    font-size: 1.1em;
}

[dir="rtl"] .grammar-explanation .example::before {
    left: auto;
    right: -2px;
}

/* Notes et remarques */
.grammar-explanation .note {
    background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
    border: 1px solid #ffcc02;
    border-radius: 8px;
    padding: 12px 15px;
    margin: 15px 0;
    color: #f57f17;
    font-size: 0.95rem;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.grammar-explanation .note::before {
    content: '⚠️';
    margin-right: 8px;
    font-size: 1em;
}

[dir="rtl"] .grammar-explanation .note::before {
    margin-right: 0;
    margin-left: 8px;
}

/* Citations et références */
.grammar-explanation blockquote {
    border-left: 4px solid #6c757d;
    background: #f8f9fa;
    margin: 15px 0;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #6c757d;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

[dir="rtl"] .grammar-explanation blockquote {
    border-left: none;
    border-right: 4px solid #6c757d;
    border-radius: 8px 0 0 8px;
}

/* Code et termes techniques */
.grammar-explanation code {
    background: #f1f3f4;
    color: #e91e63;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'system-ui', 'Segoe UI', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Tables dans l'explication */
.grammar-explanation table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.grammar-explanation th,
.grammar-explanation td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
}

[dir="rtl"] .grammar-explanation th,
[dir="rtl"] .grammar-explanation td {
    text-align: right;
}

.grammar-explanation th {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
}

.grammar-explanation tr:hover {
    background: #f8f9fa;
    transition: background 0.3s ease;
}

/* Boutons et liens dans l'explication */
.grammar-explanation .btn {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin: 5px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.grammar-explanation .btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004494 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .grammar-explanation {
        padding: 15px;
        margin: 15px 0;
    }
    
    .grammar-explanation .title {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .grammar-explanation .content {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .grammar-explanation .example,
    .grammar-explanation .note,
    .grammar-explanation blockquote {
        padding: 10px 12px;
        margin: 12px 0;
    }
    
    .grammar-explanation ul,
    .grammar-explanation ol {
        padding-left: 20px;
    }
    
    [dir="rtl"] .grammar-explanation ul,
    [dir="rtl"] .grammar-explanation ol {
        padding-left: 0;
        padding-right: 20px;
    }
    
    .grammar-explanation th,
    .grammar-explanation td {
        padding: 8px 10px;
        font-size: 0.9rem;
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .grammar-explanation {
        padding: 12px;
        margin: 12px 0;
        border-radius: 8px;
    }
    
    .grammar-explanation .title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .grammar-explanation .title::before {
        font-size: 1em;
        margin-right: 6px;
    }
    
    [dir="rtl"] .grammar-explanation .title::before {
        margin-right: 0;
        margin-left: 6px;
    }
    
    .grammar-explanation .content {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .grammar-explanation .example,
    .grammar-explanation .note,
    .grammar-explanation blockquote {
        padding: 8px 10px;
        margin: 10px 0;
        font-size: 0.9rem;
    }
    
    .grammar-explanation ul,
    .grammar-explanation ol {
        padding-left: 15px;
        margin: 10px 0;
    }
    
    [dir="rtl"] .grammar-explanation ul,
    [dir="rtl"] .grammar-explanation ol {
        padding-left: 0;
        padding-right: 15px;
    }
    
    .grammar-explanation th,
    .grammar-explanation td {
        padding: 6px 8px;
        font-size: 0.85rem;
        max-width: 120px;
    }
    
    .grammar-explanation .btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .grammar-explanation {
        padding: 10px;
        margin: 10px 0;
    }
    
    .grammar-explanation .title {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .grammar-explanation .content {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .grammar-explanation .example,
    .grammar-explanation .note,
    .grammar-explanation blockquote {
        padding: 6px 8px;
        margin: 8px 0;
        font-size: 0.85rem;
    }
    
    .grammar-explanation ul,
    .grammar-explanation ol {
        padding-left: 12px;
    }
    
    [dir="rtl"] .grammar-explanation ul,
    [dir="rtl"] .grammar-explanation ol {
        padding-left: 0;
        padding-right: 12px;
    }
    
    .grammar-explanation th,
    .grammar-explanation td {
        padding: 4px 6px;
        font-size: 0.8rem;
        max-width: 100px;
    }
    
    .grammar-explanation .btn {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

/* États d'interaction */
.grammar-explanation:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
}

/* Animation d'apparition */
.grammar-explanation.show {
    animation: fadeInUp 0.6s ease forwards;
}

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

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .grammar-explanation {
        background: linear-gradient(135deg, #2c2c2c 0%, #3a3a3a 100%);
        border-color: #555555;
        color: #e0e0e0;
    }
    
    .grammar-explanation .title {
        color: #ffffff;
        border-bottom-color: #555555;
    }
    
    .grammar-explanation .content {
        color: #cccccc;
    }
    
    .grammar-explanation .example {
        background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
        border-left-color: #3f51b5;
        color: #e3f2fd;
    }
    
    .grammar-explanation .note {
        background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
        border-color: #ff8f00;
        color: #ffcc02;
    }
}

/* ========== CSS POUR LES IMAGES DANS LES EXERCICES ========== */

/* Conteneur d'image */
.interactif-reorder-image-container {
    margin: 0 auto 15px auto;
    max-width: 100%;
    text-align: center;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #f5f5f5;
    transition: all 0.3s ease;
}

/* Image elle-même */
.interactif-reorder-image {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

/* Effet au survol */
.interactif-reorder-image-container:hover .interactif-reorder-image {
    transform: scale(1.02);
}

/* Légende optionnelle */
.interactif-reorder-image-caption {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #555;
    background: rgba(255, 255, 255, 0.9);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
}

/* Style pour les écrans larges */
@media (min-width: 992px) {
    .interactif-reorder-image {
        max-height: 250px;
    }
}

/* Adaptation tablette */
@media (max-width: 768px) {
    .interactif-reorder-image-container {
        margin-bottom: 12px;
    }
    
    .interactif-reorder-image {
        max-height: 180px;
    }
}

/* Adaptation mobile */
@media (max-width: 480px) {
    .interactif-reorder-image-container {
        margin-bottom: 10px;
        border-radius: 6px;
    }
    
    .interactif-reorder-image {
        max-height: 150px;
        border-radius: 4px;
    }
    
    .interactif-reorder-image-caption {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .interactif-reorder-image {
        max-height: 130px;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .interactif-reorder-image-container {
        background: #2d2d2d;
    }
    
    .interactif-reorder-image-caption {
        color: #ddd;
        background: rgba(0, 0, 0, 0.7);
    }
}

/* Animation de chargement */
@keyframes imageLoading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.interactif-reorder-image.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: imageLoading 1.5s infinite linear;
}

/* Style pour les images manquantes */
.interactif-reorder-image.missing {
    min-height: 100px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-style: italic;
    border: 2px dashed #ddd;
}

/* Conteneur flexible pour image + texte */
.interactif-reorder-question.has-image {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .interactif-reorder-question.has-image {
        flex-direction: row;
        align-items: flex-start;
    }
    
  
    
    .interactif-reorder-content {
        flex: 1;
    }
}

[dir="rtl"] .interactif-reorder-question.has-image {
    direction: rtl;
}

/* ========== STYLE POUR LE TEXTE DE QUESTION ========== */
.interactif-reorder-question-text {
    /* Typographie */
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.5;
    text-align: center;
    margin: 0 0 15px 0;
    padding: 12px 15px;
    
    /* Style visuel */
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    border: 1px solid #e0e9ff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    
    /* Effets */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    
    /* Décoration spéciale */
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 217, 255, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(0, 217, 255, 0.1) 0%, transparent 20%);
}

/* Effet au survol */
.interactif-reorder-question-text:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #00d9ff;
}

/* Version RTL (pour l'arabe) */
[dir="rtl"] .interactif-reorder-question-text {
    text-align: right;
    font-family: 'system-ui', 'Segoe UI', sans-serif;
}

/* Style pour les écrans moyens */
@media (max-width: 768px) {
    .interactif-reorder-question-text {
        font-size: 1rem;
        padding: 10px 12px;
        margin-bottom: 12px;
    }
}

/* Style pour les petits écrans */
@media (max-width: 480px) {
    .interactif-reorder-question-text {
        font-size: 0.95rem;
        padding: 8px 10px;
        margin-bottom: 10px;
        line-height: 1.4;
    }
}

/* Style pour les très petits écrans */
@media (max-width: 360px) {
    .interactif-reorder-question-text {
        font-size: 0.9rem;
        padding: 6px 8px;
    }
}

/* Variante avec icône */
.interactif-reorder-question-text.with-icon::before {
    content: "🔤";
    margin-right: 8px;
    font-size: 1.2em;
    vertical-align: middle;
}

[dir="rtl"] .interactif-reorder-question-text.with-icon::before {
    margin-right: 0;
    margin-left: 8px;
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .interactif-reorder-question-text {
        color: #ffffff;
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
        border-color: #4a627a;
    }
    
    .interactif-reorder-question-text:hover {
        border-color: #00d9ff;
    }
}

/* Animation d'apparition */
.interactif-reorder-question-text.animate {
    animation: textAppear 0.6s ease-out forwards;
}

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

/* Style pour les questions longues */
.interactif-reorder-question-text.long-text {
    text-align: left;
    padding: 15px;
    line-height: 1.6;
}

[dir="rtl"] .interactif-reorder-question-text.long-text {
    text-align: right;
}

/* Style spécial pour les consignes importantes */
.interactif-reorder-question-text.important {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 100%);
    border: 2px solid #ffc107;
    color: #ff6f00;
}

.interactif-reorder-question-text.important::after {
    content: "!";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff6f00;
    font-weight: bold;
    font-size: 1.5em;
}

[dir="rtl"] .interactif-reorder-question-text.important::after {
    right: auto;
    left: 15px;
}

/* ========== CSS MANQUANT POUR LES ÉLÉMENTS DE FEEDBACK ========== */

/* Conteneur principal du feedback */
.interactif-feedback {
    margin: 20px 0;
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.5s ease;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Animation d'apparition */
.interactif-feedback.interactif-show {
    opacity: 1;
    transform: translateY(0);
    animation: feedbackSlideIn 0.6s ease-out forwards;
}

@keyframes feedbackSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Feedback incorrect */
.feedback-incorrect {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
    border: 2px solid #ff6b6b;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.feedback-incorrect::before {
    content: '❌';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff6b6b;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

[dir="rtl"] .feedback-incorrect::before {
    right: auto;
    left: -10px;
}

/* Feedback correct */
.feedback-correct {
    background: linear-gradient(135deg, #f0fff4 0%, #e6ffe6 100%);
    border: 2px solid #51cf66;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}

.feedback-correct::before {
    content: '✅';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #51cf66;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(81, 207, 102, 0.3);
}

[dir="rtl"] .feedback-correct::before {
    right: auto;
    left: -10px;
}

/* Message principal du feedback */
.feedback-incorrect > div:first-child,
.feedback-correct > div:first-child {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 1px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.feedback-incorrect > div:first-child {
    color: #c92a2a;
}

.feedback-correct > div:first-child {
    color: #2b8a3e;
}

/* Titre de la réponse correcte */
.correct-answer-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin: 15px 0 10px 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border-left: 4px solid #ff6b6b;
    text-align: right; /* Par défaut pour l'arabe */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

[dir="ltr"] .correct-answer-title {
    text-align: left;
    border-left: 4px solid #ff6b6b;
    border-right: none;
}

[dir="rtl"] .correct-answer-title {
    text-align: right;
    border-right: 4px solid #ff6b6b;
    border-left: none;
}

/* Liste ordonnée de la réponse correcte */
.correct-order {
    list-style: none;
    counter-reset: order-counter;
    margin: 15px 0;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
}
/* ========== CORRECTION DE L'ESPACEMENT DES NUMÉROS ========== */

/* Correction principale pour éviter que les numéros collent au texte */
.correct-order li {
    display: flex;
    align-items: center;
    position: relative;
    padding: 15px 20px;
    margin: 10px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #2c3e50;
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    min-height: 60px; /* Hauteur minimale pour éviter l'écrasement */
}

/* Configuration RTL pour l'arabe */
[dir="rtl"] .correct-order li {
    direction: rtl;
    text-align: right;
    padding-right: 70px; /* Espace suffisant pour le numéro */
    padding-left: 20px;
}

/* Configuration LTR */
[dir="ltr"] .correct-order li {
    direction: ltr;
    text-align: left;
    padding-left: 70px; /* Espace suffisant pour le numéro */
    padding-right: 20px;
}

/* Numéros repositionnés correctement */
.correct-order li::before {
    content: counter(order-counter);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; /* Plus grand pour éviter le chevauchement */
    height: 36px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(0, 123, 255, 0.4);
    z-index: 2; /* Au-dessus du texte */
    flex-shrink: 0; /* Empêche la compression */
}

/* Position du numéro pour RTL */
[dir="rtl"] .correct-order li::before {
    right: 18px; /* Position fixe à droite */
    left: auto;
}

/* Position du numéro pour LTR */
[dir="ltr"] .correct-order li::before {
    left: 18px; /* Position fixe à gauche */
    right: auto;
}

/* Contenu du texte avec marge appropriée */
.correct-order li .text-content {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
}

/* Si vous n'avez pas de div .text-content, utilisez ceci : */
.correct-order li {
    /* Pseudo-élément pour créer l'espace nécessaire */
}

[dir="rtl"] .correct-order li {
    /* Le texte commence après le numéro */
    text-indent: 0;
}

[dir="ltr"] .correct-order li {
    /* Le texte commence après le numéro */
    text-indent: 0;
}

/* Corrections spécifiques pour éviter le collage */
.correct-order {
    list-style: none;
    counter-reset: order-counter;
    margin: 15px 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.correct-order li {
    counter-increment: order-counter;
    /* Force l'espacement même si le contenu est long */
    overflow: visible;
}

/* Effet hover amélioré sans affecter l'espacement */
.correct-order li:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.25);
}

.correct-order li:hover::before {
    background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
    transform: translateY(-50%) scale(1.1);
}

/* Responsive - Tablette */
@media (max-width: 768px) {
    .correct-order li {
        padding: 12px 18px;
        min-height: 55px;
        font-size: 1rem;
    }
    
    [dir="rtl"] .correct-order li {
        padding-right: 65px;
        padding-left: 18px;
    }
    
    [dir="ltr"] .correct-order li {
        padding-left: 65px;
        padding-right: 18px;
    }
    
    .correct-order li::before {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    [dir="rtl"] .correct-order li::before {
        right: 16px;
    }
    
    [dir="ltr"] .correct-order li::before {
        left: 16px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .correct-order li {
        padding: 10px 15px;
        min-height: 50px;
        font-size: 0.95rem;
        margin: 8px 0;
    }
    
    [dir="rtl"] .correct-order li {
        padding-right: 60px;
        padding-left: 15px;
    }
    
    [dir="ltr"] .correct-order li {
        padding-left: 60px;
        padding-right: 15px;
    }
    
    .correct-order li::before {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }
    
    [dir="rtl"] .correct-order li::before {
        right: 14px;
    }
    
    [dir="ltr"] .correct-order li::before {
        left: 14px;
    }
}

/* Responsive - Très petits écrans */
@media (max-width: 360px) {
    .correct-order li {
        padding: 8px 12px;
        min-height: 45px;
        font-size: 0.9rem;
    }
    
    [dir="rtl"] .correct-order li {
        padding-right: 55px;
        padding-left: 12px;
    }
    
    [dir="ltr"] .correct-order li {
        padding-left: 55px;
        padding-right: 12px;
    }
    
    .correct-order li::before {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    [dir="rtl"] .correct-order li::before {
        right: 12px;
    }
    
    [dir="ltr"] .correct-order li::before {
        left: 12px;
    }
}

/* Correction pour les textes très longs */
.correct-order li.long-text {
    min-height: auto;
    padding-top: 15px;
    padding-bottom: 15px;
    line-height: 1.7;
}

/* Amélioration de la barre de titre pour coordination */
.correct-answer-title {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
    margin: 20px 0 15px 0;
    box-shadow: 0 3px 10px rgba(77, 171, 247, 0.3);
    position: relative;
}

/* Message d'erreur coordonné */
.feedback-incorrect > div:first-child {
    background: linear-gradient(135deg, #ff6b6b 0%, #e63946 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
    position: relative;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
}

/* Icône pour le message d'erreur */
.feedback-incorrect > div:first-child::after {
    content: '❌';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5em;
}

[dir="rtl"] .feedback-incorrect > div:first-child::after {
    right: auto;
    left: 20px;
}

/* Animation fluide pour tous les éléments */
.correct-order li {
    animation: smoothSlideIn 0.6s ease-out forwards;
    animation-delay: calc(var(--item-index, 0) * 0.1s);
    opacity: 0;
}

@keyframes smoothSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] @keyframes smoothSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Classes utilitaires pour forcer l'espacement correct */
.force-number-spacing {
    position: relative !important;
    padding-right: 70px !important; /* RTL */
    padding-left: 20px !important;
}

[dir="ltr"] .force-number-spacing {
    padding-left: 70px !important;
    padding-right: 20px !important;
}