
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --success-color: #27ae60;
            --warning-color: #f39c12;
            --danger-color: #e74c3c;
            --light-bg: #ecf0f1;
            --dark-bg: #34495e;
            --text-light: #7f8c8d;
            --border-radius: 8px;
            --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: #f8f9fa;
            min-height: 100vh;
            margin: 0;
            padding: 0;
        }

        .container {
            width: 100%;
            height: 100vh;
            background: white;
            display: flex;
            overflow: hidden;
            position: relative;
        }

        /* Sidebar - Visible par défaut sur desktop */
        /* Note: Les styles de scrollbar sont gérés dans menu-scrollbar.css */
        .sidebar {
            width: 280px;
            background: var(--primary-color);
            color: white;
            padding: 20px 15px;
            display: flex;
            flex-direction: column;
            border-right: 1px solid #e0e0e0;
            flex-shrink: 0; /* Important : empêche la sidebar de rétrécir */
            position: relative; /* Position relative sur desktop */
            transition: transform 0.3s ease;
        }

        /* Toggle button pour mobile */
        .sidebar-toggle {
            display: none;
            position: fixed;
            top: 15px;
            left: 15px;
            z-index: 1000;
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 10px;
            border-radius: 5px;
            cursor: pointer;
        }

        /* Media queries pour responsive */
        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: 0;
                top: 0;
                height: 100vh;
                z-index: 999;
                transform: translateX(-100%);
                width: 250px;
            }
            
            .sidebar.active {
                transform: translateX(0);
                box-shadow: 2px 0 10px rgba(0,0,0,0.1);
            }
            
            .sidebar-toggle {
                display: block;
            }
            
            .main-content {
                width: 100%;
                margin-left: 0;
            }

            .search-bar {
                max-width: 100%;
            }
            
            .status-indicator {
                display: none; /* Cacher sur mobile */
            }
            
            .chat-container {
                
                padding: 10px;
            }
            
            .message-bubble {
                max-width: 90%;
            }
            
            .command-buttons {
                overflow-x: auto;
                flex-wrap: nowrap;
                padding-bottom: 10px;
            }
            
            .cmd-btn {
                flex-shrink: 0;
            }
        }

        @media (max-width: 480px) {
            .sidebar {
                width: 100%;
            }
            
            .message-bubble {
                max-width: 95%;
                font-size: 14px;
            }
            
            .input-container {
                padding: 10px;
            }
            
            .chat-input {
                font-size: 14px;
                padding: 10px;
            }
            
            .btn-primary {
                padding: 10px 15px;
                font-size: 14px;
            }
        }

        /* Ajustements pour tablettes */
        @media (min-width: 769px) and (max-width: 1024px) {
            .sidebar {
                width: 220px;
            }
            
            .message-bubble {
                max-width: 80%;
            }
        }

        .conversations-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 300px;
            margin: 10px 0;
            overflow: hidden;
        }

        .conversations-section {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            min-height: 100px;
        }

        .logo {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 30px;
            text-align: center;
            padding: 15px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: var(--border-radius);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .menu-section {
            margin-bottom: 10px;
        }

        .menu-title {
            font-size: 12px;
            text-transform: uppercase;
            color: #95a5a6;
            opacity: 1;
            margin-bottom: 15px;
            letter-spacing: 1px;
        }

        .menu-item {
            padding: 12px 15px;
            margin-bottom: 8px;
            border-radius: var(--border-radius);
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            gap: 10px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid transparent;
        }

        .menu-item:hover {
            background: rgba(255, 255, 255, 0.15);
            transform: translateX(5px);
            border-color: rgba(255, 255, 255, 0.2);
        }

        .menu-item.active {
            background: var(--secondary-color);
            box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
        }

        .stats-box {
            background: rgba(255, 255, 255, 0.1);
            padding: 10px;
            border-radius: var(--border-radius);
            margin-top: auto;
            flex-shrink: 0;
        }

        @media (max-width: 768px) {
            .stats-box {
                font-size: 12px;
            }
            
            .stat-item {
                font-size: 12px;
            }
        }

        .stat-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 13px;
        }

        .stat-value {
            font-weight: bold;
            color: #3498db;
        }

        /* Main Content */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #f8f9fa;
            min-width: 0; /* Important : permet au contenu de rétrécir */
        }

        .header {
            
            background: white;
            padding: 20px 30px;
            border-bottom: 1px solid #e0e0e0;
            display: flex;
            justify-content: start;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
            z-index: 1;
        }

        @media (max-width: 768px) {
            .header {
                
                padding: 10px 15px;
                z-index: 1;
            }
        }

        .search-bar {
            flex: 1;
            max-width: 500px;
            position: relative;
        }

        .search-input {
            width: 100%;
            padding: 12px 45px 12px 20px;
            border: 2px solid #e0e0e0;
            border-radius: 25px;
            font-size: 14px;
            transition: var(--transition);
            background: #f8f9fa;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--secondary-color);
            background: white;
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
        }

        .search-btn {
            position: absolute;
            right: 5px;
            top: 50%;
            transform: translateY(-50%);
            background: var(--secondary-color);
            border: none;
            padding: 8px 15px;
            border-radius: 20px;
            color: white;
            cursor: pointer;
            transition: var(--transition);
        }

        .search-btn:hover {
            background: #2980b9;
            transform: translateY(-50%) scale(1.05);
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 20px;
            background: #D88449;
            color: white;
            border-radius: 20px;
            font-size: 14px;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            background: white;
            border-radius: 50%;
            animation: blink 1.5s infinite;
        }

        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }

        

        .typing-indicator {
            display: none;
            padding: 15px;
            background: #f1f3f5;
            border-radius: 18px;
            width: fit-content;
            margin-bottom: 10px;
        }

        .typing-indicator.active {
            display: inline-block;
        }

        .typing-indicator span {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #999;
            margin: 0 2px;
            animation: typing 1.4s infinite;
        }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes typing {
            0%, 80%, 100% {
                transform: translateY(0);
                opacity: 0.5;
            }
            40% {
                transform: translateY(-10px);
                opacity: 1;
            }
        }

        /* Input Area */
        .input-container {
        position: fixed;
        bottom: 10px;
        left: 280px; /* Largeur de la sidebar + marge */
        right: 20px;
        width: auto;
        display: flex;
        gap: 10px;
        padding: 20px;
        background: white;
        border-radius: var(--border-radius);
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
        z-index: 999999;
    }

        .input-wrapper {
            flex: 1;
            display: flex;
            gap: 10px;
            align-items: flex-end;
        }

        @media (max-width: 480px) {
            .input-wrapper {
                gap: 5px;
            }
        }

        .chat-input {
            flex: 1;
            padding: 15px;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            font-size: 15px;
            resize: none;
            transition: var(--transition);
            font-family: inherit;
        }

        .chat-input:focus {
            outline: none;
            border-color: var(--secondary-color);
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
        }

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;
        }

        .btn-primary {
            background: linear-gradient(135deg, #3498db 0%, #3498db 100%);
            color: white;
        }

        .btn-primary:hover {
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #ED7470;
            color: white;
        }

        .btn-secondary:hover {
            background: #ED7470;
        }

        .btn-grey {
            background: #e0e0e0;
            color: black;
        }

        .btn-grey:hover {
            background: #6e6e6e8c;
        }

        .btn-close-conv {
            margin-top: 15px;
            background: #95a5a6;
            color: white;
        }

        .btn-close-conv:hover {
            background: #859293;
        }

        /* Command Buttons */
        .command-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            flex-wrap: wrap;
        }

        .cmd-btn {
            padding: 8px 16px;
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 20px;
            font-size: 13px;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .cmd-btn:hover {
            border-color: var(--secondary-color);
            background: var(--secondary-color);
            color: white;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
        }

        /* Source Cards */
        .source-card {
            background: #f8f9fa;
            border-left: 4px solid var(--secondary-color);
            padding: 12px;
            margin: 10px 0;
            border-radius: 0 var(--border-radius) var(--border-radius) 0;
            font-size: 13px;
        }

        .source-title {
            font-weight: bold;
            color: var(--primary-color);
            margin-bottom: 5px;
        }

        .source-score {
            display: inline-block;
            padding: 2px 8px;
            background: #D88449;
            color: white;
            border-radius: 12px;
            font-size: 11px;
            margin-left: 10px;
        }

        /* Loading Animation */
        .loader {
            display: none;
            width: 40px;
            height: 40px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid var(--secondary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 20px auto;
        }

        .loader.active {
            display: block;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .conversation-item {
            padding: 10px;
            margin-bottom: 5px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 6px;
            cursor: pointer;
            transition: var(--transition);
            font-size: 13px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;  /* Ajouter un gap pour espacer */
        }

        .conversation-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .conversation-item.active {
            background: rgba(52, 152, 219, 0.3);
            border-left: 3px solid var(--secondary-color);
        }

        .conversation-title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .conversation-date {
            font-size: 11px;
            opacity: 0.7;
        }

        .delete-conversation {
            padding: 5px 8px;
            background: #ED7470;  /* Plus visible */
            border: 1px solid #ED7470;  /* Bordure pour visibilité */
            border-radius: 4px;
            color: white;
            cursor: pointer;
            opacity: 1;  /* Toujours visible */
            transition: all 0.2s;
            font-size: 16px;
        }

        .conversation-item:hover .delete-conversation {
            opacity: 1;
            background: #ED7470;
        }

        .delete-conversation:hover {
            background: var(--danger-color);
        }

        .conversation-controls {
            padding: 10px 0;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            flex-shrink: 0;
            margin-bottom: 10px;
        }

        .btn-small {
            padding: 6px 12px;
            font-size: 12px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            border-radius: 4px;
            cursor: pointer;
            transition: var(--transition);
            width: 100%;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }

        .btn-small:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .btn-small.danger {
            background: #ED7470;
            border-color: #ED7470;
        }

        .btn-small.danger:hover {
            background: #ED7470;
        }

        .btn-export {
            background: var(--secondary-color);
            border: none;
            padding: 15px 15px;
            border-radius: 20px;
            color: white;
            cursor: pointer;
            transition: var(--transition);
        }

        .btn-export:hover {
            background: var(--primary-color);
            transform: scale(1.05);
        }

        .btn-reinit {
            background: #ED7470;
            color: white;
            padding: 15px;
            margin: 10px;
        }

        .btn-reinit:hover {
            background: #ED7470;
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(39, 124, 174, 0.4);
        }

        .btn-reinit-export {
            background: #3498db;
            color: white;
            padding: 15px;
            margin: 10px;
        }

        .btn-reinit-export:hover {
            background: #3498db;
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(39, 124, 174, 0.4);
        }

        /* Panneau des paramètres avancés */
.advanced-panel {
    
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    margin: 15px 0;
    padding: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

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

.panel-header {
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    z-index: 100;
}

.panel-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 16px;
}

.btn-close {
    background: #3B4858;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #3B4858;
    color: white;
}

.params-grid {
    overflow: visible !important;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.param-group {
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-group label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.param-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.param-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    transition: all 0.2s;
}

.param-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.param-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    border: none;
}

.param-group span {
    color: var(--secondary-color);
    font-weight: bold;
}

/* Remplacer le .param-help existant par ceci */
.param-help {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #f0f0f0;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-size: 11px;
    cursor: help;
    color: #999;
    position: relative;
    transition: all 0.2s;
}

.param-help:hover {
    background: var(--secondary-color);
    color: white;
    transform: scale(1.1);
}

/* Tooltip content avec z-index très élevé */
.param-help .tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    max-width: 250px;
    z-index: 999999;  /* Z-index très élevé pour être toujours devant */
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Alternative : tooltip plus large */
.param-help .tooltip-content.wide {
    white-space: normal;
    width: 250px;
    text-align: left;
    line-height: 1.4;
    z-index: 999999;  /* Même z-index élevé pour les tooltips larges */
}

/* Flèche du tooltip */
.param-help .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    z-index: 999999;  /* Même z-index pour la flèche */
}

/* Afficher le tooltip au survol */
.param-help:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
    z-index: 999999;  /* Assurer que le z-index reste élevé */
}

.param-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 15px 0 0 0;
    margin-top: 20px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.param-actions button {
    padding: 8px 16px;
    min-width: 150px;
}

/* Pour les tooltips dans le contexte spécifique de prompt-type */
.prompt-type-label .param-help {
    z-index: 20;  /* Un peu plus élevé dans ce contexte */
}

.prompt-type-label .param-help:hover {
    z-index: 10002;
}

.prompt-type-label .param-help .tooltip-content {
    z-index: 999999;  /* Encore plus élevé pour être sûr */
}

/* Fix pour les tooltips qui pourraient être cachés par d'autres éléments */
.advanced-panel {
    overflow: visible !important;
    position: relative;
    z-index: 100;  /* Z-index de base pour le panneau */
}

/* S'assurer que les modals sont encore au-dessus */
.modal {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 100001;  /* Les modals restent au-dessus des tooltips */
}

.modal-content {
    z-index: 100002;
}

.checkbox-group {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.checkbox-group label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.param-actions {
    grid-column: span 2;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 15px;
}

.advanced-toggle {
    margin: 10px 0;
    text-align: center;
}

.btn-toggle {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle:hover {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Indicateur des paramètres actifs */
.params-indicator {
    display: inline-block;
    background: #D88449;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .params-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group,
    .param-actions {
        grid-column: span 1;
    }
    
    .param-actions {
        flex-direction: column;
    }
    
    .param-actions button {
        width: 100%;
    }
}

/* Boutons de presets */
.preset-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    flex-direction: row;
    align-content: center;
    justify-content: center;
}

.preset-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.preset-btn:hover {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.preset-btn:active {
    transform: translateY(0);
}

/* Indicateur de preset actif */
.preset-btn.active {
    background: var(--secondary-color);
    color: white;
}

/* Mode de recherche */
.search-mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.mode-btn {
    padding: 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
}

.mode-btn:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.mode-btn.active .mode-desc {
    color: rgba(255, 255, 255, 0.9);  /* Blanc semi-transparent */
    font-weight: 400;  /* Un peu plus léger */
}

.mode-desc {
    font-size: 11px;
    opacity: 0.8;
    display: block;
}

.hybrid-only {
    animation: fadeIn 0.3s;
}

/* Indicateur de cache */
.cache-indicator {
    position: relative;
    background: white;
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    white-space: nowrap;
    margin-left: auto;
}

.cache-label {
    font-weight: bold;
    color: var(--primary-color);
}

/* Groupe de boutons d'action dans le header */
.header-actions-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    flex-shrink: 0;
}

/* Boutons d'action dans le header */
.header-action-btn {
    background: #3B4757;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    flex-shrink: 0 !important;
    position: relative !important;
    float: none !important;
    clear: none !important;
}

.header-action-btn:hover {
    background: #4a5766;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.header-action-btn:active {
    transform: translateY(0);
}

.header-action-btn.active {
    background: var(--primary-color);
}

#cacheHitRatio {
    color: var(--success-color);
    font-weight: bold;
}

@media (max-width: 768px) {
    .search-mode-selector {
        grid-template-columns: 1fr;
    }

    .cache-indicator {
        font-size: 12px;
        padding: 8px 12px;
        flex-basis: 100%;
        margin-left: 0;
        justify-content: center;
    }

    .header-action-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 10px;
        font-size: 12px;
    }
}

/* Sections de presets */
.preset-section {
    margin-bottom: 15px;
}

.preset-group-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Séparateur entre les groupes */
.preset-separator {
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #e0e0e0 20%, 
        #e0e0e0 80%, 
        transparent 100%);
    margin: 20px 0;
    position: relative;
}

.preset-separator::after {
    content: "OU";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 15px;
    color: #999;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
}



.preset-btn {
    position: relative;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 100px;
    justify-content: center;
}

/* Style spécial pour les presets hybrides */
.preset-btn.hybrid-preset {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-color: var(--secondary-color);
    border-style: dashed;
}

.preset-btn:hover {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.preset-btn.hybrid-preset:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    border-style: solid;
}

/* Tooltip amélioré pour les presets */
.preset-btn .preset-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 15px);  /* Plus d'espace au-dessus du bouton */
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(0, 0, 0, 0.95);  /* Fond plus sombre */
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    white-space: normal;
    z-index: 99999;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);  /* Animation élastique */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    width: 220px;
    text-align: center;
    line-height: 1.5;
}

/* Animation d'apparition améliorée */
.preset-btn:hover .preset-tooltip {
    visibility: visible;
    z-index: 99999;
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Flèche plus visible */
.preset-btn .preset-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 99999;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
}

/* Flèche du tooltip */
.preset-btn .preset-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 99999;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

/* Afficher le tooltip au survol */
.preset-btn:hover .preset-tooltip {
    visibility: visible;
    opacity: 1;
    z-index: 10000;
    transform: translateX(-50%) translateY(-10px);
}

/* Animation de sélection */
.preset-btn:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.preset-btn.active {
    background: var(--secondary-color);
    color: white;
    animation: pulse 0.5s;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .preset-buttons {
        flex-direction: column;
    }
    
    .preset-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 16px;
    }
    
    .preset-btn .preset-tooltip {
        display: none; /* Masquer les tooltips sur mobile */
    }
    
    .preset-separator {
        margin: 15px 0;
    }
}

/* Badge indicateur pour les presets hybrides */
.hybrid-badge {
    display: inline-block;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal pour le contexte */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: relative;
    line-height: 30px;     /* Même hauteur que le conteneur */
    text-align: center;    /* Centre horizontalement */
}

.modal-close:hover {
    background: #303D4E;
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

/* Styles généraux pour textarea dans les modales et formulaires */
.modal-body textarea,
.modal-content textarea,
form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.modal-body textarea:focus,
.modal-content textarea:focus,
form textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background-color: #fafbfc;
}

.modal-body textarea:hover,
.modal-content textarea:hover,
form textarea:hover {
    border-color: #bbb;
}

.modal-body textarea::placeholder,
.modal-content textarea::placeholder,
form textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* Style spécifique pour textarea avec attribut rows */
.modal-body textarea[rows="3"],
.modal-content textarea[rows="3"] {
    min-height: 80px;
}

/* Styles pour les labels dans les formulaires de modales */
.modal-body label,
.modal-content label,
.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Styles pour les form-row */
.form-row {
    margin-bottom: 20px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background-color: #fafbfc;
}

.form-row input:hover,
.form-row select:hover {
    border-color: #bbb;
}

.context-stats {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: var(--secondary-color);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.stat-badge.warning {
    background: var(--warning-color);
}

.stat-badge.success {
    background: #D88449;
}

/* Tabs pour le contexte */
.context-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: var(--secondary-color);
    color: white;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--secondary-color);
}

.context-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Contenu du contexte */
.context-chunk {
    background: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.chunk-source {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 14px;
}

.chunk-score {
    background: var(--success-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.chunk-text {
    color: #333;
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Source list dans la modal */
.source-item {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.source-item:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.source-name {
    font-weight: 600;
    color: var(--primary-color);
}

.source-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.modal-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Debug info */
.debug-info {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #2c3e50;
    color: #0f0;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}

.debug-line {
    margin-bottom: 5px;
}

.debug-label {
    color: #ff0;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        height: 95vh;
        margin: 2.5vh auto;
    }
    
    .context-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .floating-btn {
        bottom: 120px;
        right: 10px;
        padding: 10px 15px;
        font-size: 12px;
    }
}

/* Bouton inline dans les messages */
.btn-inline {
    display: inline-block;
    margin: 10px 0;
    padding: 8px 16px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.btn-inline:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-inline:active {
    transform: translateY(0);
}

/* Style pour les boutons dans les bulles de message */
.message-bubble .btn-inline {
    margin-top: 15px;
    margin-bottom: 5px;
}

/* Assurer que les boutons dans les messages sont cliquables */
.message-bubble button {
    z-index: 10;
}

/* Sélecteur de type de prompt */
.prompt-type-selector {
    
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 15px 15px 5px 15px;
    margin-bottom: 15px;
    animation: fadeIn 0.3s;
}

.prompt-type-header {
    overflow: visible !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.prompt-type-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.prompt-type-indicator {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #f0f0f0;
    color: #666;
    transition: all 0.3s;
}

.prompt-type-indicator.auto {
    background: #D88449;
    color: white;
}

.prompt-type-indicator.juridique {
    background: var(--primary-color);
    color: white;
}

.prompt-type-indicator.synthese {
    background: var(--success-color);
    color: white;
}

.prompt-type-indicator.analyse {
    background: var(--secondary-color);
    color: white;
}

.prompt-type-indicator.comparaison {
    background: var(--warning-color);
    color: white;
}

.prompt-type-indicator.chronologie {
    background: #9b59b6;
    color: white;
}

.prompt-type-indicator.standard {
    background: #95a5a6;
    color: white;
}

.prompt-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.prompt-type-btn {
    padding: 10px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
}

.prompt-type-btn:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.prompt-type-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.prompt-type-btn.active::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    background: white;
    color: var(--secondary-color);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animation de sélection */
.prompt-type-btn:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .prompt-type-buttons {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    
    .prompt-type-btn {
        padding: 8px;
        font-size: 12px;
    }
    
    .prompt-type-selector {
        padding: 10px;
    }
}

/* Indicateur flottant de type détecté */
/* Toast de détection de type */
.detected-type-toast {
position: fixed;
top: 80px;
right: 20px;
background: white;
padding: 12px 20px;
border-radius: 25px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
gap: 10px;
z-index: 999999;
animation: slideInRight 0.3s ease-out, fadeOutRight 0.3s 2.7s forwards;
font-size: 14px;
font-weight: 500;
}
.detected-type-toast strong {
color: var(--secondary-color);
font-weight: 600;
}
@keyframes slideInRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes fadeOutRight {
to {
opacity: 0;
transform: translateX(20px);
}
}
/* Section des sources */
.sources-section {
    margin-top: 20px;
    padding: 15px 0;
}

.sources-section strong {
    display: block;
    margin-bottom: 12px;
    color: #333;
    font-size: 15px;
}

/* Sources cliquables */
.source-card.clickable {
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.source-card.clickable:hover {
    background: #e8f4fd;
    border-left-color: #2196F3;
    transform: translateX(5px);
}

.source-action {
    float: right;
    font-size: 12px;
    color: var(--secondary-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.source-card.clickable:hover .source-action {
    opacity: 1;
}

/* Modal pour les sources */
.source-modal-content {
    position: relative;
    background-color: white;
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s;
}

.source-modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #303D4E 0%, #303D4E 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.source-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.source-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.source-modal-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Stats du document */
.source-stats {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.source-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.source-stats .stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.source-stats .stat-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Info sur les chunks */
.source-chunks-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.source-chunks-info h4 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 14px;
}

.chunks-list {
    display: grid;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.chunk-preview {
    background: #f8f9fa;
    padding: 10px;
    border-left: 3px solid var(--secondary-color);
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.chunk-preview:hover {
    background: #e8f4fd;
    transform: translateX(3px);
}

.chunk-id {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 12px;
}

.chunk-score {
    float: right;
    background: #D88449;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.chunk-excerpt {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Contenu du document */
.source-content-wrapper {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.source-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.source-content-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 14px;
}

.source-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.document-pre {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

/* Chunks surlignés dans le document */
.highlighted-chunk {
    background: yellow;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.chunk-highlight-animation {
    animation: pulseHighlight 2s;
}

@keyframes pulseHighlight {
    0%, 100% { background: yellow; }
    50% { background: #ffeb3b; box-shadow: 0 0 10px yellow; }
}

/* Loading state */
.source-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.source-loading p {
    margin-top: 20px;
    color: #666;
}

/* Error state */
.source-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--danger-color);
}

.source-error span {
    font-size: 48px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .source-modal-content {
        width: 95%;
        height: 90vh;
        margin: 5vh auto;
    }
    
    .source-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .chunks-list {
        max-height: 150px;
    }
}

/* Pour Font Awesome et Lucide */
.fas, .far, .fab, [data-lucide] {
    margin-right: 8px;
    font-size: 16px;
    vertical-align: middle;
}

/* Pour Material Icons */
.material-icons {
    margin-right: 8px;
    font-size: 18px;
    vertical-align: middle;
}

/* Icône inline dans les boutons */
.icon-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: text-bottom;
}

/* Styles pour la modal de liste des documents */
.documents-list-modal-content {
    position: relative;
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s;
}

.documents-list-header {
    flex-shrink: 0;
}

.documents-list-body {
    flex: 1;
    min-height: 0;
}

.documents-list-footer {
    flex-shrink: 0;
}

.documents-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.documents-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--danger-color);
}

.documents-error span {
    font-size: 48px;
    margin-bottom: 20px;
}

.document-category {
    animation: fadeIn 0.3s;
}

.document-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive pour la modal de documents */
@media (max-width: 768px) {
    .documents-list-modal-content {
        width: 95%;
        height: 90vh;
        margin: 5vh auto;
    }
    
    .document-item {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .document-item > div:last-child {
        width: 100%;
        margin-top: 10px;
        justify-content: flex-end;
    }
}

.gpt-oss-separator::after {
    content: "GPT-OSS 20B";
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
    color: white;
    font-weight: bold;
    padding: 2px 20px;
}

.preset-btn.gpt-oss-preset {
    background: linear-gradient(135deg, #5296D5 0%, #5296D5 100%);
    color: white;
    border: 2px solid transparent;
    font-weight: 600;
}

.preset-btn.gpt-oss-preset:hover {
    background: linear-gradient(135deg, #5296D5 0%, #5296D5 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.large-context-indicator {
    position: fixed;
    top: 110px;
    right: 20px;
    background: linear-gradient(135deg, #5296D5 0%, #5296D5 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    animation: pulse 2s infinite;
}

.large-context-indicator .indicator-text {
    color: white;
}

.large-context-indicator .indicator-details {
    color: white;
}

.indicator-icon {
    font-size: 20px;
    animation: flame 1s infinite;
}

@keyframes flame {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.indicator-details {
    font-size: 12px;
    opacity: 0.9;
    background: rgba(0,0,0,0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .large-context-indicator {
        top: auto;
        bottom: 100px;
        right: 10px;
        font-size: 12px;
    }
}

/* Toast de détection de type */
.detected-type-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out, fadeOutRight 0.3s 2.7s forwards;
    font-size: 14px;
    font-weight: 500;
}

.detected-type-toast strong {
    color: var(--secondary-color);
    font-weight: 600;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Toast générique pour showToast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-info {
    border-left: 4px solid var(--secondary-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

/* Responsive pour les toasts */
@media (max-width: 768px) {
    .detected-type-toast {
        top: auto;
        bottom: 100px;
        right: 10px;
        left: 10px;
        font-size: 13px;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        bottom: 10px;
    }
}

/* CSS pour les chunks mis en évidence */
.highlighted-chunk {
    background: linear-gradient(135deg, #ffeb3b 0%, #ffc107 100%);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.highlighted-chunk:hover {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

/* Animation de pulsation pour la mise en évidence */
.chunk-highlight-animation {
    animation: pulseHighlight 2s;
}

@keyframes pulseHighlight {
    0% { 
        background: linear-gradient(135deg, #ffeb3b 0%, #ffc107 100%);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% { 
        background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
        box-shadow: 0 0 20px 10px rgba(255, 87, 34, 0.3);
    }
    100% { 
        background: linear-gradient(135deg, #ffeb3b 0%, #ffc107 100%);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

/* Tooltip au survol des chunks */
.highlighted-chunk::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.highlighted-chunk:hover::before {
    opacity: 1;
}

/* Style pour les chunks dans la liste */
.chunk-preview {
    background: #f8f9fa;
    padding: 12px;
    border-left: 3px solid var(--secondary-color);
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.chunk-preview:hover {
    background: #e8f4fd;
    transform: translateX(3px);
    border-left-color: #2196F3;
}

.chunk-preview.active {
    background: #ffe0b2;
    border-left-color: #ff9800;
}

/* Styles pour l'éditeur de prompts - À ajouter dans style.css */

/* Bouton d'édition dans les boutons de prompt */
.edit-prompt-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.7;
}

.edit-prompt-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.edit-prompt-btn i {
    font-size: 12px;
    color: inherit;
}

/* Indicateur de prompt personnalisé */
.preset-btn.custom-prompt {
    background: #61C276;
    border-color: #55AC68;
    color: white;
}

.custom-indicator {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateY(-50%) scale(1.2); }
}

/* Modal d'édition de prompt */
.prompt-edit-modal .modal-content {
    max-width: 900px;
    width: 90%;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.prompt-edit-content {
    overflow: hidden;
}

.prompt-status {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-custom {
    color: #764ba2;
    font-weight: 600;
}

.status-default {
    color: #666;
    font-weight: 600;
}

/* Éditeur de prompt */
.prompt-editor {
    margin-bottom: 20px;
}

.prompt-textarea {
    width: 100%;
    height: 450px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.prompt-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 13px;
    color: #666;
}

.prompt-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Variables de prompt */
.prompt-variables {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.prompt-variables h4 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 14px;
}

.variable-list {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.variable-tag {
    display: inline-block;
    padding: 5px 12px;
    background: #ffc107;
    color: #333;
    border-radius: 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.variable-tag:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.variable-help {
    margin: 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Actions du prompt */
.prompt-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.prompt-actions button {
    flex: 1;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

/* Modal de comparaison */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.compare-column h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.compare-column pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .prompt-edit-modal .modal-content {
        width: 95%;
        height: 90vh;
    }
    
    .prompt-textarea {
        min-height: 200px;
        font-size: 12px;
    }
    
    .prompt-actions {
        flex-direction: column;
    }
    
    .prompt-actions button {
        width: 100%;
    }
    
    .compare-grid {
        grid-template-columns: 1fr;
    }
    
    .variable-list {
        flex-wrap: wrap;
    }
    
    .edit-prompt-btn {
        width: 20px;
        height: 20px;
    }
    
    .preset-btn {
        padding-right: 30px;
    }
}

/* Animation de sauvegarde */
@keyframes saveSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.save-success {
    animation: saveSuccess 0.5s ease;
}

/* Boutons d'import/export dans la sidebar */
.prompt-management-section {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.prompt-management-section h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    text-transform: uppercase;
    opacity: 0.7;
}

.prompt-management-buttons {
    display: flex;
    gap: 5px;
    flex-direction: column;
}

.prompt-management-buttons button {
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.prompt-management-buttons button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(3px);
}

/* Pastille pour le compteur de conversations */
.conversations-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #D88449;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    float: right;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Style du titre avec la pastille */
.conversations-container .menu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #95a5a6;
    text-transform: uppercase;
    opacity: 1;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

/* Masquer la pastille quand elle est à zéro */
.conversations-count:empty,
.conversations-count[data-count="0"] {
    display: none;
}

/* Effet hover sur la pastille */
.conversations-count:hover {
    transform: scale(1.1);
    background: #D88449;
    transition: all 0.2s ease;
}

/* Adaptation pour mobile */
@media (max-width: 768px) {
    .conversations-count {
        font-size: 10px;
        padding: 1px 5px;
        min-width: 18px;
        height: 18px;
    }
}

/* ======================================== */
/* STYLES POUR LA DÉTECTION AUTOMATIQUE */
/* ======================================== */

/* Bouton en mode auto-detecting (le bouton Auto quand il détecte) */
.preset-btn.auto-detecting {
    background: #D88449;
    color: white;
    position: relative;
    overflow: visible;
}

.preset-btn.auto-detecting::before {
    content: '🔍';
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: rotate 2s linear infinite;
}

/* Bouton du type auto-détecté */
.preset-btn.auto-detected {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
    position: relative;
}

.preset-btn.auto-detected::after {
    content: '✨';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f39c12;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    animation: bounceIn 0.5s ease-out;
}

/* Indicateur avec type auto-détecté */
.prompt-type-indicator[class*="auto-detected-"] {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    position: relative;
    padding-right: 25px;
}

.prompt-type-indicator[class*="auto-detected-"]::after {
    content: '🎯';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideInScale {
    0% {
        transform: translateX(-10px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Toast amélioré pour la détection */
.detected-type-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 999999;
    animation: slideInRight 0.3s ease-out;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid #3498db;
}

.detected-type-toast::before {
    font-size: 18px;
    animation: pulse 1s ease-out;
}

.detected-type-toast strong {
    color: #2980b9;
    font-weight: 600;
}

/* Transition douce pour les changements de classe */
.preset-btn {
    transition: all 0.3s ease, transform 0.2s ease;
}

.prompt-type-indicator {
    transition: all 0.3s ease;
}

/* Effet de survol amélioré pour les boutons auto-détectés */
.preset-btn.auto-detected:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.4);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .preset-btn.auto-detected::after,
    .preset-btn.auto-detecting::before {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
    
    .detected-type-toast {
        right: 10px;
        top: 60px;
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* Scroll pour le panneau des paramètres avancés */
.advanced-panel {
    max-height: 55vh !important;  /* Limite la hauteur à 70% de la fenêtre */
    overflow-y: auto !important;   /* Active le scroll vertical */
    overflow-x: hidden !important; /* Masque le scroll horizontal */
}

.params-grid {
    max-height: calc(70vh - 100px); /* Hauteur moins le header et les boutons */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px; /* Espace pour la scrollbar */
    margin-right: -10px; /* Compense le padding */
}

/* Style de la scrollbar personnalisée */
.params-grid::-webkit-scrollbar {
    width: 8px;
}

.params-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.params-grid::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.params-grid::-webkit-scrollbar-thumb:hover {
    background: #3498db;
}

/* Fix pour que les boutons d'action restent visibles */
.param-actions {
    position: sticky;
    bottom: 0;
    padding: 15px 0;
    margin-top: 20px;
    z-index: 10;
}

/* Amélioration de l'espacement */
.param-group {
    overflow: visible !important;
    margin-bottom: 20px;
}

/* Animation smooth du scroll */
.params-grid {
    scroll-behavior: smooth;
}

.fa-lg {
    line-height: 1 !important; /* ou la valeur que vous souhaitez */
}

.icon-btn {
  background-color: black;     /* fond noir */
  border-radius: 50%;          /* arrondi pour cercle */
  width: 30px;                 /* largeur du bouton */
  height: 30px;                /* hauteur du bouton */
  display: flex;               /* centrage */
  align-items: center;
  justify-content: center;
  border: none;                /* retire la bordure */
  cursor: pointer;             /* effet clic */
}

.icon-btn i {
  color: white;                /* couleur de l'icône */
  font-size: 14px;             /* taille de l'icône */
}

.search-header {
    margin: 10px 10px 10px 10px;
}

/* ===== TOGGLE SWITCHES MODERNES ===== */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    cursor: pointer;
    padding: 8px 0;
}

.toggle-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success-color);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 4px var(--success-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Variante bleue pour les nouvelles features */
.toggle-switch input:checked + .toggle-slider.blue {
    background-color: var(--secondary-color);
}

/* Animation au hover */
.toggle-label:hover .toggle-slider {
    opacity: 0.9;
}

/* Disabled state */
.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Param help ajusté pour toggles */
.toggle-label .param-help {
    flex-shrink: 0;
    margin-left: 4px;
}