/* =======================================================================
    0. CLASSES UTILITAIRES
   ======================================================================= */
.hidden {
    display: none;
}

/* =======================================================================
   1. STYLES DE BASE ET RÉINITIALISATION
   ======================================================================= */
html {
    overflow-y: scroll; /* Affiche la scrollbar en permanence pour éviter les sauts de page */
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: #F5F5F7; /* Fond gris clair Apple */
    color: #1d1d1f; /* Gris foncé pour le texte */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    min-height: 100vh;
    padding-bottom: 60px; /* Hauteur du footer */
    box-sizing: border-box;
}

.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

/* =======================================================================
   2. EN-TÊTE ET BARRE D'APPLICATION
   ======================================================================= */
.app-bar {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 5px 20px; /* Padding vertical réduit */
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 50px; /* Taille du logo augmentée */
    width: auto;
}

.title-container {
    display: flex;
    flex-direction: column;
}

.app-bar h1 {
    margin: 0;
    font-size: 1.5em; /* Taille du titre principal */
    font-weight: 600;
    color: #1d1d1f;
}

.subtitle {
    margin: 0;
    font-size: 0.8em; /* Taille du sous-titre */
    font-weight: 400;
    color: #6e6e73; /* Gris plus doux pour le sous-titre */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =======================================================================
   3. SÉLECTEUR DE LANGUE
   ======================================================================= */
.language-switcher {
    position: relative;
    display: inline-block;
}


.language-dropdown {
    display: none;
    position: absolute;
    right: 0;
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
    z-index: 1;
    list-style: none;
    padding: 0;
    border-radius: 8px;
}

.language-dropdown li a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
   align-items: center;
   gap: 10px;
   position: relative;
}

.language-dropdown li a .flag-icon {
   font-size: 1.2em; /* Ajustement de la taille pour les icônes SVG */
   width: 1.33333333em;
   line-height: 1em;
}

.language-dropdown li a.active {
   font-weight: bold;
   color: #007AFF;
}

.language-dropdown li a.active::after {
   content: '✔';
   position: absolute;
   right: 15px;
   color: #007AFF;
}

.language-dropdown li a:hover {
    background-color: #f1f1f1;
}

.language-switcher.open .language-dropdown {
    display: block;
}


/* =======================================================================
   4. BARRE LATÉRALE / MODALE D'ACTIVITÉ
   ======================================================================= */
#module-sidebar {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90vw; /* Largeur de 90% de la vue */
    max-width: 1400px; /* Limite la largeur maximale */
    background-color: #F5F5F7;
    border-radius: 1.25rem;
    box-shadow: 0 1rem 2.5rem rgba(0,0,0,0.15);
    z-index: 1002;
    display: none;
    flex-direction: column;
    overflow: visible;
    padding: 1.25rem;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, height 0.5s ease-in-out;
}

#module-sidebar.open {
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.sidebar .close-btn {
   position: absolute;
   top: 10px;
   right: 15px;
   background: none;
   border: none;
   font-size: 2em;
   cursor: pointer;
   color: #aaa;
   transition: color 0.3s;
}

.sidebar .close-btn:hover {
   color: #1d1d1f;
}

.sidebar h2 {
   margin-top: 0; /* Ajusté car le padding est maintenant interne */
   font-size: 1.5em;
   font-weight: 600;
   color: #1d1d1f;
   margin-bottom: 20px;
}

.sidebar ol,
.info-card ol {
   padding-left: 20px;
   display: flex;
   flex-direction: column;
   gap: 15px; /* Espace entre les points */
}

.sidebar li,
.info-card li {
   font-size: 1.1em;
   color: #333;
}

.sidebar li::marker,
.info-card li::marker {
   font-weight: bold;
   color: #007AFF;
}

/* L'overlay est de nouveau nécessaire pour l'arrière-plan */
#sidebar-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0,0,0,0.4);
   z-index: 1001;
   opacity: 0;
   visibility: hidden;
   transition: opacity 0.3s ease, visibility 0.3s;
}

#sidebar-overlay.open {
   opacity: 1;
   visibility: visible;
}

/* =======================================================================
   5. MISE EN PAGE PRINCIPALE (CONTENEUR, CARTES)
   ======================================================================= */
.info-card,
.prompt-generator,
.module-container {
    background-color: #FFFFFF;
    border-radius: 20px;
    padding: 0; /* Retiré pour permettre au bandeau de toucher les bords */
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* overflow: hidden; */ /* Important pour les coins arrondis du conteneur, mais empêche les dropdowns de déborder */
}

.prompt-generator {
   margin-top: 30px;
}

.info-card h2 {
    margin-top: 0;
    font-size: 1.5em;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 20px;
}

/* Section "Comment utiliser" */

/* =======================================================================
   6. GÉNÉRATEUR DE PROMPT ET MODES
   ======================================================================= */
.prompt-generator {
    display: flex;
    flex-direction: column;
    /* Le gap est géré par les marges internes maintenant */
}

/* Design "intégré" pour les onglets de mode */
.mode-tabs {
    display: flex;
    width: 100%;
    background-color: #f9f9f9; /* Fond très clair pour le bandeau */
    border-bottom: 1px solid #e5e5e5; /* Séparateur subtil */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.mode-tab {
    flex: 1; /* Chaque onglet prend 50% de la largeur */
    padding: 12px 20px; /* Padding vertical réduit */
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1.1em;
    font-weight: 500;
    color: #6e6e73; /* Couleur du texte inactif */
    text-align: center;
    transition: all 0.3s ease;
}

.mode-tab:hover {
    background-color: #f0f0f0; /* Léger feedback au survol */
}

.mode-tab.active {
    color: #007AFF; /* Texte bleu pour l'actif */
    font-weight: 600;
    background-color: #ffffff; /* Se fond avec le reste de la carte */
    border-top: 3px solid #007AFF;
}

.mode-tab:first-child.active {
    border-top-left-radius: 20px;
}

.mode-tab:last-child.active {
    border-top-right-radius: 20px;
}

.mode-content {
    display: none;
    flex-direction: column;
    gap: 12px; /* Espacement réduit */
    /* Padding géré par le conteneur parent */
}

.mode-content.active {
    display: flex;
}


#advanced-mode {
    display: none;
}

#advanced-mode.active {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

#advanced-mode textarea {
    grid-column: 1 / -1;
    min-height: 60px; /* Hauteur minimale réduite */
    resize: vertical;
}

.prompt-generator input[type="text"],
.prompt-generator input[type="number"] {
    padding: 12px 15px; /* Padding réduit */
    border: 1px solid #dcdcdc;
    border-radius: 12px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
    background-color: #fcfcfc;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.prompt-generator input[type="text"]:focus,
.prompt-generator input[type="number"]:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.prompt-form-container {
    padding: 20px 25px; /* Padding réduit */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Espacement réduit */
}


.prompt-generator button#generateBtn {
    padding: 15px;
    background-color: #007AFF;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.2);
    width: 100%;
}

.prompt-generator button#generateBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
}

/* =======================================================================
   7. SYSTÈME D'ONGLETS ET GRILLE DE MODULES
   ======================================================================= */
.tabs {
    display: flex;
    justify-content: space-around; /* Modifié de 'center' pour permettre le défilement */
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Pour un défilement fluide sur iOS */
    overscroll-behavior-y: contain !important; /* Empêche le défilement vertical lors du scroll horizontal */
    touch-action: pan-x !important; /* Force le défilement tactile à être uniquement horizontal */
    cursor: grab; /* Indique que l'élément est déplaçable */
    scrollbar-width: none; /* Pour Firefox */
}

.tabs::-webkit-scrollbar {
    display: none; /* Pour Chrome, Safari, etc. */
}

.tabs.grabbing {
    cursor: grabbing; /* Change le curseur pendant le glissement */
}

.tab-link {
    padding: 12px 25px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1.2em;
    font-weight: 500;
    color: #8e8e93; /* Gris clair pour inactif */
    position: relative;
    transition: color 0.3s;
    flex-shrink: 0; /* Empêche les onglets de rétrécir */
}

.tab-link:hover {
    color: #1d1d1f;
}

.tab-link.active {
    color: #007AFF; /* Bleu pour actif */
    font-weight: 600;
}

.tab-link::after {
    content: '';
    position: absolute;
    bottom: -1px; /* Aligné avec la bordure du conteneur */
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #007AFF;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tab-link.active::after {
    transform: scaleX(1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Grille des modules */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

.h5p-tile {
    background-color: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    text-align: center;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 165px;
}

.h5p-tile:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.h5p-tile img {
    max-width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 15px;
}

.h5p-tile .tile-text {
    display: flex;
    flex-direction: column;
}

.h5p-tile .tile-name-fr {
    font-weight: 600;
    font-size: 1em;
    color: #1d1d1f;
}

.h5p-tile .tile-name-en {
    font-size: 0.85em;
    color: #8e8e93;
}

/* =======================================================================
   8. ÉLÉMENTS DE FORMULAIRE (TEXTAREA, BOUTONS)
   ======================================================================= */
.module-container h3,
.h5p-content-container h3 {
    margin-top: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #1C1C1E;
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    min-height: 12.5rem; /* Plus grand */
    resize: none; /* Permet uniquement le redimensionnement vertical */
    padding: 1.25rem; /* Plus aéré */
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    box-sizing: border-box;
    font-family: "SF Mono", "Menlo", "Monaco", monospace;
    font-size: 1em;
    margin-bottom: 20px;
    background-color: #FAFAFA; /* Fond légèrement contrasté */
    transition: border-color 0.3s, box-shadow 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

textarea::placeholder {
    color: #a0a0a0; /* Placeholder plus lisible */
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.copy-btn, .action-btn {
    padding: 12px 20px;
    border: none;
    background-color: #e9e9ed;
    color: #1C1C1E;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
    font-weight: 500;
    flex: 1; /* Tous les boutons d'action se partagent l'espace */
}

.copy-btn:hover, .action-btn:hover {
    background-color: #dcdce1;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Animation unifiée pour le groupe de boutons de génération */
.generation-button-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.generation-button-group .action-btn:hover {
    transform: none;
    box-shadow: none;
}

/* Conteneur de contenu H5P (remplace la modale) */
/* NOUVELLE STRUCTURE DE LA MODALE */
.modal-header-group {
    background-color: #fff;
    border-radius: 1rem;
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.07);
    flex-shrink: 0;
    padding: 0.625rem 1.25rem;
    position: relative;
    z-index: 10; /* z-index élevé pour être au-dessus du contenu */
}

.modal-header-actions .close-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}

@media (max-width: 768px) {
    .modal-header-actions .close-btn {
        display: block;
    }
}

.modal-header-actions .close-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}

@media (max-width: 768px) {
    .modal-header-actions .close-btn {
        display: block;
    }
}


.modal-title-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-controls-container {
    margin-left: auto;
    position: relative;
    z-index: 3; /* Au-dessus du wrapper tuto */
}

.modal-title-icon {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
}

.modal-title {
    margin: 0;
    font-size: 1.6em;
    font-weight: 600;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-controls-container {
    display: flex;
    align-items: center;
    gap: 20px;
}


.tuto-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    animation: fadeIn 0.3s ease-in-out;
    position: relative;
    z-index: 2; /* En dessous du conteneur des boutons */
}

.modal-tuto-content {
    flex-grow: 1;
}

.modal-tuto-content p {
    margin: 0;
    color: #6e6e73;
}

.modal-main-content {
    display: flex;
    gap: 1.25rem;
    flex-grow: 1;
    overflow: hidden; /* Empêche le débordement des enfants */
    max-height: 0;
    opacity: 0;
    transform: translateY(-20px);
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out, transform 0.5s ease-in-out, margin-top 0.5s ease-in-out;
    margin-top: 0;
    min-height: 0; /* Correction pour le flexbox shrink */
    position: relative; /* Crée un contexte de superposition */
    z-index: 1; /* Doit être en dessous de l'en-tête */
}

#module-sidebar.advanced-view {
    height: 95vh;
    overflow-y: auto;
}

#module-sidebar.advanced-view .modal-main-content {
    max-height: 1000px; /* Valeur suffisamment grande */
    opacity: 1;
    transform: translateY(0);
    margin-top: 1rem;
}


.modal-panels-container {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    overflow-y: auto; /* Permet le défilement vertical */
}

.modal-panel {
    background-color: #fff;
    border-radius: 1rem;
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.07);
    width: 50%;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Stratégie pour empêcher le débordement du contenu flex */
    padding: 1rem 1.25rem;
    gap: 1rem; /* Ajoute de l'espace entre les enfants flex */
}

.modal-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap; /* Permet aux éléments de passer à la ligne */
}

.modal-panel h3 {
    margin-top: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #1C1C1E;
    margin-bottom: 0; /* Ajusté */
}


/* La classe .active sur les tuiles est maintenant gérée par JS pour le panneau latéral,
   mais on peut garder un style pour indiquer la sélection. */
.h5p-tile.active {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0, 122, 255, 0.2);
    border: 1px solid #007AFF;
}

.h5p-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px; /* Espacement réduit avec le sous-titre */
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5;
}

.h5p-content-header h2 {
    margin: 0;
    font-size: 2.2em; /* Plus gros et gras */
    font-weight: 700;
    color: #1C1C1E;
}


.h5p-content-description {
    font-size: 1.2em;
    color: #6c6c70; /* Gris doux */
    margin-bottom: 40px; /* Espacement généreux */
    max-width: 80ch; /* Limite la largeur pour la lisibilité */
}

/* Blocs de contenu dans le panneau */
.h5p-prompt-block, .h5p-processor {
    background-color: #FAFAFA;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    position: relative; /* Nécessaire pour positionner le spinner à l'intérieur */
}

.h5p-processor {
    margin-top: 0; /* Remplacé par le margin-bottom du bloc précédent */
    padding-top: 25px;
}

.h5p-processor h3 {
    margin-top: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #1C1C1E;
}

.h5p-processor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.h5p-processor-header h3 {
    margin: 0;
}

.albert-generation-controls {
    display: flex;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    overflow: hidden;
    background-color: #3b82f6;
}

.albert-generation-controls .action-btn {
    background-color: transparent !important; /* Force la transparence pour outrepasser les autres règles */
    transition: none;
    border-radius: 0;
}

.albert-generation-controls .action-btn:hover {
    transform: none;
    box-shadow: none;
}

.model-selector-container {
    display: flex;
}

.albert-generation-controls .model-selector-btn {
    border-left: 1px solid #2563eb;
    padding: 0 10px;
    min-width: 44px;
}

.library-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #6e6e73;
}

.library-toggle input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.download-btn {
    display: block; /* Prend toute la largeur */
    width: 100%;
    padding: 20px;
    background-color: #007AFF; /* Bleu profond */
    color: white;
    border: none;
    border-radius: 20px; /* Coins plus arrondis */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
    margin-top: 15px;
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.2);
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
    background-color: #0071e3;
}

/* =======================================================================
   9. FOOTER
   ======================================================================= */
.footer {
    background-color: #ffffff;
    padding: 10px 30px;
    font-size: 0.9em;
    color: #8e8e93;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 25px;
    text-align: center;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px; /* Hauteur fixe */
    box-sizing: border-box;
}

.footer a {
    color: #555;
    text-decoration: none;
    transition: color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Espace entre l'icône et le texte */
}

.footer a:hover {
    color: #007AFF;
    text-decoration: none;
}

/* =======================================================================
   10. NOTIFICATIONS
   ======================================================================= */
#notification-container {
    position: fixed;
    top: 75px;
    right: 5px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background-color: #fff;
    color: #1d1d1f;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.5s, transform 0.5s;
    border-left: 5px solid #007AFF;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.error {
    border-left-color: #FF3B30; /* Rouge Apple */
}



/* =======================================================================
   11. STYLES RESPONSIVES
   ======================================================================= */
@media (max-width: 768px) {
    .header-right {
        gap: 0;
        justify-content: flex-end;
        flex-grow: 1;
    }

    .language-btn, .help-btn {
        padding: 0 6px;
    }

    .subtitle {
        display: none;
    }

    body {
        padding-bottom: 0;
    }

    .app-bar h1 {
        font-size: 1.2em;
    }

    .logo {
        height: 35px;
    }

    .footer {
        position: relative;
        height: auto;
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    #module-sidebar {
        width: 95vw;
        padding: 1rem;
    }

    #module-sidebar.menu-open {
        height: 69vh; /* Hauteur augmentée pour faire de la place au menu */
    }

    #module-sidebar.advanced-view {
        height: 97vh;
    }


    .modal-main-content {
        flex-direction: column;
        overflow-y: auto;
    }

    #module-sidebar:not(.advanced-view) .modal-main-content {
        display: none;
    }

    #module-sidebar.advanced-view .modal-main-content {
        display: flex;
    }



    .modal-panel {
        width: 100%;
    }
}


.toolbar-btn i {
    font-size: 20px;
    margin-bottom: 2px;
}


@media (min-width: 769px) {
    .modal-header {
        justify-content: space-between;
    }

    .modal-panel {
        flex: 1;
        min-height: 0;
    }
}

/* =======================================================================
   12. MODALE (MENTIONS LÉGALES, AIDE)
   ======================================================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: #F5F5F7;
    margin: 5% auto;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 80%;
    max-width: 1200px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #1d1d1f;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 20px;
    padding: 15px 0;
    background-color: #FFFFFF;
    color: #1d1d1f;
    border-bottom: 1px solid #e5e5e5;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
}

.close-modal-btn {
    color: #8e8e93;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal-btn:hover,
.close-modal-btn:focus {
    color: #1d1d1f;
    text-decoration: none;
}

.modal-body {
    padding: 30px;
    line-height: 1.6;
}

#legal-mentions-content h3 {
    text-align: left;
    font-size: 1.8em;
    margin-bottom: 20px;
}

#legal-mentions-content h4 {
    font-size: 1.3em;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes slideIn {
    from {transform: scale(0.95); opacity: 0.5;}
    to {transform: scale(1); opacity: 1;}
}



/* =======================================================================
   13. ANIMATION DE CHARGEMENT
   ======================================================================= */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Styles pour les boutons de langue et d'aide inspirés de LinkedIn */
.language-btn, .help-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    color: #666666;
    padding: 0 12px;
    height: 52px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    transition: color 0.2s, background-color 0.3s;
}

.language-btn:hover, .help-btn:hover {
    color: #000000;
}

.language-btn .fi, .help-btn .fas {
    font-size: 20px;
    line-height: 1;
}

.language-btn span, .help-btn span {
    display: block;
}


.language-btn .fi {
    font-size: 18px;
}

/* =======================================================================
   14. BARRE D'OUTILS FLOTTANTE
   ======================================================================= */
.prompt-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.textarea-container {
    position: relative;
    flex: 1;
    display: flex;
}

.textarea-container textarea {
    flex: 1;
    margin-bottom: 0; /* L'espacement est géré par le gap du parent */
    min-height: 0; /* Hauteur minimale pour le mode smartphone */
}

.floating-toolbar {
    display: flex;
    gap: 1rem;
    z-index: 5;
    align-self: flex-start;
    opacity: 1;
    visibility: visible;
    background-color: transparent;
    padding: 0;
    justify-content: space-around; /* Répartir l'espace */
    width: 100%;
}

.toolbar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    font-size: 0.75rem; /* Taille de police pour le texte */
    color: #6e6e73; /* Couleur de texte grise */
    transition: color 0.2s;
    position: relative;
    display: flex;
    flex-direction: column; /* Icône au-dessus du texte */
    align-items: center;
    gap: 0.25rem; /* Espace entre l'icône et le texte */
    flex: 1; /* Pour que les boutons occupent l'espace */
    text-align: center;
}

.toolbar-btn-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%; /* S'assurer que le span prend toute la largeur du bouton */
}

.toolbar-btn i {
    font-size: 18px; /* Taille de l'icône */
    margin-bottom: 2px; /* Petit espace sous l'icône */
}

.toolbar-btn:hover {
    color: #007AFF;
    background-color: #f0f0f0; /* Léger fond gris au survol */
    border-radius: 8px; /* Coins arrondis pour le fond */
}

/* Style pour les infobulles (supprimé car le texte est maintenant visible) */
.toolbar-btn::after,
.toolbar-btn::before {
    display: none !important;
}

/* Style pour le mode plein écran */
/* Superposition pour le mode plein écran */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1999; /* Juste en dessous de la barre d'outils */
    padding: 0; /* Retiré pour que l'overlay prenne tout l'écran */
    box-sizing: border-box;
}

.textarea-fullscreen {
    width: 85vw;  /* Occupe 85% de la largeur de la fenêtre */
    height: 85vh; /* Occupe 85% de la hauteur de la fenêtre */
    resize: none; /* Empêcher le redimensionnement en plein écran */
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.2em;
    line-height: 1.6;
    padding: 1.25rem; /* Ajout d'un padding interne */
    box-sizing: border-box;
}


.mode-switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch-label {
    font-size: 0.9em;
    color: #6e6e73;
}

.switch {
    position: relative;
    display: inline-block;
    width: 3.75rem;
    height: 2.125rem;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.625rem;
    width: 1.625rem;
    left: 0.25rem;
    bottom: 0.25rem;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #007AFF;
}

input:checked + .slider:before {
    transform: translateX(1.625rem);
}

.slider.round {
    border-radius: 2.125rem;
}

.slider.round:before {
    border-radius: 50%;
}

/* Styles pour le conteneur de la modale en plein écran */
.fullscreen-modal-container {
    width: 85vw;
    height: 85vh;
    display: flex;
    flex-direction: column;
    background-color: #fff; /* Ajout d'un fond pour la visibilité */
    border-radius: 0.75rem;
    overflow: hidden; /* Pour que le textarea ne dépasse pas */
}

.fullscreen-modal-container .unified-rag-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* La barre d'outils en plein écran */
.fullscreen-modal-container .floating-toolbar {
flex-shrink: 0; /* Empêche la barre d'outils de se réduire */
padding: 0.625rem 1rem;
background-color: #f8f8f8;
border-bottom: 1px solid #e5e5e5;
    width: 100%;
    justify-content: flex-start; /* Aligner à gauche */
}

/* Le textarea en plein écran prend le reste de la place */
.fullscreen-modal-container .textarea-fullscreen {
    flex-grow: 1;
    border: none; /* Supprimer les bordures inutiles */
    border-radius: 0;
    width: 100%;
    height: 100%;
    padding: 1.25rem;
    box-sizing: border-box;
}

/* Animation de chargement "Caramel" */
#caramel-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    flex-direction: column;
}

.marmite {
    width: 200px;
    height: 150px;
    position: relative;
    filter: drop-shadow(-10px 10px 8px rgba(0,0,0,0.3)); /* Ombre portée pour l'effet cartoon */
    animation: shake 0.5s infinite; /* Ajout de l'animation de tremblement */
}

.marmite::before { /* Corps de la casserole */
    content: '';
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8B4513 25%, #A0522D 25%, #A0522D 50%, #8B4513 50%, #8B4513 75%, #A0522D 75%, #A0522D 100%);
    background-size: 80px 80px;
    border-radius: 10px 10px 80px 80px;
    border: 6px solid #000;
    box-sizing: border-box;
    z-index: 1;
}

.marmite::after { /* Anse de la casserole */
    content: '';
    position: absolute;
    top: 20px;
    right: -40px;
    width: 80px;
    height: 40px;
    border: 6px solid #000;
    border-radius: 20px;
    background-color: #A0522D;
    z-index: 0;
}

.marmite-content {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 80%;
    background: #D2691E; /* Couleur caramel */
    border-radius: 0 0 60px 60px;
    overflow: hidden;
    z-index: 2;
    animation: bubble 2s infinite ease-in-out, caramelize 10s linear forwards; /* Combinaison des animations */
}

.marmite-content::before { /* Brillance sur le caramel */
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

#recipe-steps {
    margin-top: 20px;
    color: white;
    font-size: 1.2em;
    text-align: center;
    height: 50px;
}

#success-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    color: white;
    font-size: 2em;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s;
}

#success-message.hidden {
    display: none;
}

@keyframes bubble {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

@keyframes caramelize {
    0% { background-color: #FFD700; } /* Or clair (sucre) */
    50% { background-color: #DAA520; } /* Or plus foncé */
    100% { background-color: #D2691E; } /* Caramel ambré */
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: yellow;
    border-radius: 50%;
    animation: sparkle-anim 1s ease-out infinite;
    opacity: 0;
}

@keyframes sparkle-anim {
    0% { transform: translateY(0) scale(0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: translateY(-80px) scale(1.5); opacity: 0; }
}

.bubble {
    position: absolute;
    background: rgba(255, 204, 102, 0.6);
    border-radius: 50%;
    animation: bubble-rise 2s ease-in-out infinite;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

/* =======================================================================
   15. UPLOAD PDF ET OCR (RAG)
   ======================================================================= */
.file-upload-container {
    grid-column: 1 / -1;
    margin-top: 10px;
    border: 2px dashed #dcdcdc;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background-color: #fcfcfc;
    transition: border-color 0.3s, background-color 0.3s;
}

.file-upload-container:hover {
    border-color: #007AFF;
    background-color: #f5faff;
}

.file-upload-label {
    cursor: pointer;
    color: #007AFF;
    font-weight: 500;
}

input[type="file"] {
    display: none;
}

#ocr-status {
    margin-top: 15px;
    font-style: italic;
    color: #6e6e73;
}

#ocr-output-container {
    grid-column: 1 / -1;
    position: relative;
    margin-top: 10px;
}

.ocr-output-header {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 5px 10px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #e5e5e5;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.ocr-output-header button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #6e6e73;
    transition: color 0.2s;
}

.ocr-output-header button:hover {
    color: #007AFF;
}

#ocr-output {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-bottom: 0;
    height: 200px;
}

#ocr-output-container:fullscreen {
    padding: 20px;
    background-color: #F5F5F7;
    display: flex;
    flex-direction: column;
}

#ocr-output-container:fullscreen #ocr-output {
    height: 100%;
    flex-grow: 1;
}

/* =======================================================================
   16. STYLES POUR L'INTERRUPTEUR RAG
   ======================================================================= */

#rag-section-container {
    grid-column: 1 / -1;
    margin-top: 10px;
}

.rag-section-header {
    margin-bottom: 5px;
}

.rag-toggle-container {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 12px;
}

.rag-title {
    margin: 0;
    text-align: right;
    flex-grow: 1;
}

.rag-content-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rag-top-row {
    display: flex;
    gap: 15px;
}

.unified-rag-area,
.drag-drop-area {
    flex: 1 1 50%; /* Base de 50%, peut grandir et rétrécir */
    box-sizing: border-box; /* S'assure que le padding/border est inclus dans la largeur */
}

.rag-content-area.fullscreen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.rag-content-area.fullscreen .unified-rag-area {
    flex-grow: 1;
}

.unified-rag-area {
    position: relative;
    border: 1px solid #dcdcdc;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 200px; /* Hauteur minimale pour l'ensemble */
}

.unified-rag-area.fullscreen {
    height: 100%;
    width: 100%;
    border: none;
}

.unified-rag-area.fullscreen #ocr-output {
    flex-grow: 1;
    height: auto; /* Permet au flex-grow de fonctionner */
    max-height: none; /* Supprime la limite de hauteur en plein écran */
}

#ocr-output[contenteditable="true"] {
    flex-grow: 1;
    resize: none !important;
    padding: 20px;
    border: none;
    border-radius: 0;
    font-family: "SF Mono", "Menlo", "Monaco", monospace;
    font-size: 1em;
    background-color: #FAFAFA;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
}

#ocr-output[contenteditable="true"]:focus {
    outline: none; /* Supprime le cadre au focus */
}

#ocr-output[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #a0a0a0;
    pointer-events: none;
}

#ocr-output mark {
    padding: 2px 0;
    border-radius: 3px;
}

.unified-rag-area .floating-toolbar {
    background-color: #f8f8f8;
    border-bottom: 1px solid #e5e5e5;
    padding: 5px;
    justify-content: flex-end;
}

.unified-rag-area textarea {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    min-height: 7.5rem;
    flex-grow: 1;
}

.drag-drop-area {
    padding: 20px;
    text-align: center;
    background-color: #fcfcfc;
    transition: background-color 0.3s;
    border: 2px dashed #dcdcdc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-drop-area.drag-over {
    background-color: #f5faff;
}

.drag-drop-content i {
    font-size: 2em;
    color: #007AFF;
    margin-bottom: 10px;
}

.drag-drop-content p {
    margin: 5px 0;
    color: #6e6e73;
}

.file-upload-label {
    cursor: pointer;
    color: #007AFF;
    font-weight: 500;
    text-decoration: underline;
}

.rag-toggle-container {
    grid-column: 1 / -1;
    display: flex;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background-color: #fcfcfc;
    transition: border-color 0.3s, background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.drag-drop-area.drag-over {
    border-color: #007AFF;
    background-color: #f5faff;
}

.drag-drop-content i {
    font-size: 3em;
    color: #007AFF;
    margin-bottom: 15px;
}

.drag-drop-content p {
    margin: 5px 0;
    color: #6e6e73;
}

.file-upload-label {
    cursor: pointer;
    color: #007AFF;
    font-weight: 500;
    text-decoration: underline;
}

.rag-toggle-container {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 12px;
}

.rag-toggle-label {
    font-weight: 500;
    color: #1d1d1f;
}

.rag-title {
    grid-column: 1 / -1;
    font-size: 1.1em;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 10px;
    text-align: center;
}

.rag-note {
    grid-column: 1 / -1;
    font-size: 0.9em;
    color: #6e6e73;
    margin-top: -10px;
    margin-bottom: 10px;
    text-align: center;
}

/* Styles pour l'infobulle */
[data-tooltip-key] {
    position: relative;
}

[data-tooltip-key]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    white-space: pre-wrap;
    width: max-content;
    max-width: 300px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
}

[data-tooltip-key]:hover::after {
    opacity: 1;
    visibility: visible;
}

[data-tooltip-key]::before {
    content: '';
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    border-style: solid;
    border-width: 6px 6px 0;
    border-color: #333 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    margin-bottom: -6px; /* Position the arrow correctly */
}

[data-tooltip-key]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Adjust after pseudo-element to be above the arrow */
[data-tooltip-key]::after {
    bottom: calc(125% + 6px);
}

/* =======================================================================
   17. STYLES POUR LES BOUTONS DE LA MODALE
   ======================================================================= */

.modal-panel-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 0.625rem;
    align-items: stretch; /* Assure que les enfants prennent la même hauteur */
}

.action-buttons-group {
    display: flex;
    gap: 0.625rem;
    flex-grow: 1;
}

.generation-button-group {
    gap: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 1rem; /* Appliquer le radius au conteneur pour l'ombre */
}




.action-btn.secondary-btn {
    background-color: #FFFFFF;
    color: #007AFF;
    border: 1px solid #007AFF;
    margin-left: 10px;
}

.action-btn.secondary-btn:hover {
    background-color: #f0f8ff;
}

.action-btn.primary-btn {
    background-color: #007AFF;
    color: white;
    border: none;
}

.action-btn.primary-btn:hover {
    background-color: #0056b3;
}

.generation-button-group:hover .action-btn.primary-btn {
    background-color: #0056b3;
}


/* Assurer la même hauteur pour tous les boutons */
.modal-panel-footer .action-btn {
    padding: 1rem;
    font-size: 1.1em;
    font-weight: 500;
    border-radius: 1rem;
    text-align: center;
    flex-grow: 1;
}

.main-action-button {
    flex-grow: 1;
    display: flex;
}

.main-action-button .action-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    width: 100%;
}

.more-actions-button {
    position: relative;
    display: flex;
    margin-left: -1px; /* Superposition pour joindre les boutons */
}

.more-actions-button .dropdown-toggle {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.more-actions-button .dropdown-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    list-style: none;
    padding: 5px 0;
    margin: 0 0 5px 0;
    min-width: 150px;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.more-actions-button .dropdown-menu.show {
    display: block;
}

.more-actions-button .dropdown-menu li a {
    display: block;
    padding: 8px 15px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.more-actions-button .dropdown-menu li a:hover {
    background-color: #f5f5f5;
}
/* Style spécifique pour le bouton Copier dans la modale */
.toolbar-btn.copy-prompt-btn {
    background-color: transparent; /* Fond transparent par défaut */
    color: #6e6e73; /* Texte gris comme les autres boutons de la barre d'outils */
    border-radius: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.toolbar-btn.copy-prompt-btn:hover {
    background-color: #f0f0f0; /* Léger fond gris au survol */
    color: #007AFF;
}

/* Style pour le bouton Copier lorsqu'il est cliqué (succès) */
.toolbar-btn.copy-prompt-btn.copied {
    background-color: #007AFF; /* Fond bleu */
    color: white; /* Texte blanc */
}


/* Style pour l'icône Tchap */
#tchap-button {
    text-decoration: none;
}

.tchap-icon {
    width: 40px;
    height: 20px;
    object-fit: contain;
}


.model-selector-dropdown {
    max-width: 90%; /* Limite la largeur */
    word-wrap: break-word; /* Permet au texte de revenir à la ligne */
}

.expand-button-container {
    text-align: center;
    margin-top: 10px;
}

.expand-btn {
    background-color: #e9e9ed;
    color: #007AFF;
    border: 1px solid #007AFF;
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    font-weight: 500;
}

.expand-btn:hover {
    background-color: #f0f8ff;
}

/* Améliorations responsives pour les modales */
@media (max-width: 768px) {
    .rag-top-row {
            flex-direction: column;
        }
    
        .unified-rag-area,
        .drag-drop-area {
            flex-basis: 100%; /* Prend toute la largeur sur les petits écrans */
        }
        .rag-content-area {
            grid-template-columns: 1fr;
        }

    .modal-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .modal-title-container {
        order: 1;
    }

    .top-controls-container {
        margin-left: 0;
        order: 2;
    }

    .tuto-controls-wrapper {
        flex-direction: column;
        align-items: center; /* Centrer le switch */
        gap: 15px;
        width: 100%;
    }

    .modal-tuto-content {
        text-align: center;
    }

    #module-sidebar {
        overflow-y: auto; /* Activer le défilement sur toute la modale */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain; /* Empêche le défilement de l'arrière-plan */
    }

    .modal-main-content {
        overflow: visible !important; /* Forcer la désactivation du défilement sur ce conteneur */
    }
}
.hidden {
    display: none;
}

/* PDF Tags and Character Counter */
#pdf-tags-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    justify-content: flex-start;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background-color: #f9f9f9;

}

.pdf-tag {
    display: flex;
    align-items: center;
    background-color: #e0e0e0;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px; /* Augmentation de la largeur maximale */
}

.pdf-tag .filename {
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 8px;
}

.rag-tags-tuto {
    font-size: 0.9em;
    color: #6e6e73;
    text-align: center;
    margin: 0 0 0 0;
}

.pdf-tag .color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0; /* Empêche le rétrécissement de la bulle */
}

.pdf-tag .color-picker::-webkit-color-swatch {
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
}

.pdf-tag .color-picker::-moz-color-swatch {
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
}

.pdf-tag .remove-tag-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    margin-left: 5px;
    line-height: 1;
}

.pdf-tag .remove-tag-btn:hover {
    color: #333;
}

.char-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    color: #666;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
}

.char-counter.warning {
    color: #e67e22;
    font-weight: bold;
}

.char-counter.error {
    color: #e74c3c;
    font-weight: bold;
}

.ia-guidance-text {
    font-size: 0.9em;
    color: #6e6e73;
    line-height: 1.4;
    margin: 0;
    text-align: left;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* Limite le texte à 3 lignes */
    line-clamp: 3; /* Propriété standard */
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.2em; /* Environ 3 lignes (3 * 1.4em) */
}

.ia-guidance-text .fa-info-circle {
    margin-right: 0.3em;
    color: #007AFF;
}
