/* Styles de base */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

button {
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    color: white;
}

button:hover {
    opacity: 0.9;
}

.create-question-btn {
    background-color: #f4cf8f;
    color: #333;
}

.create-information-btn {
    background-color: #f0ece1;
    color: #333;
}

#createConnectionBtn {
    background-color: #808080;
}

#createConnectionBtn.active {
    background-color: #606060;
}

#clearBtn {
    background-color: #f44336;
}

/* Workspace - MODIFICATIONS IMPORTANTES */
.workspace-container {
    position: relative;
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 4px;
    overflow: auto; /* Garder auto pour les deux axes */
    background-color: #f9f9f9;
    
    /* Forcer l'affichage des barres de défilement */
    scrollbar-width: auto; /* Pour Firefox */
    -ms-overflow-style: auto; /* Pour IE/Edge */
    
    /* Toujours montrer la barre horizontale */
    overflow-x: scroll;
    overflow-y: auto;
}

/* Personnalisation de la barre de défilement pour Webkit (Chrome, Safari, etc.) */
.workspace-container::-webkit-scrollbar {
    width: 12px; /* Largeur de la barre verticale */
    height: 12px; /* Hauteur de la barre horizontale */
}

.workspace-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.workspace-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.workspace-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.workspace-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* Ajustement pour le workspace */
.workspace {
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: visible; /* Changer de hidden à visible pour voir le dépassement */
    position: relative;
    min-width: 100%;
    min-height: 100%;
    background-color: white;
    transform-origin: 0 0;
    /* IMPORTANT: Supprimer la transition pendant les déplacements */
    transform: translate(0, 0);
    /* S'assurer que le workspace peut s'étendre */
    display: inline-block;
}

/* Fenêtres */
.window {
    position: absolute;
    min-width: 200px;
    min-height: 100px;
    background-color: #f0f0f0;
    border: 2px solid #333;
    border-radius: 6px;
    box-shadow: 3px 3px 5px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transform-origin: 0 0;
    /* Assurer que les fenêtres peuvent être placées en dehors du viewport initial */
    max-width: none;
    max-height: none;
    /* IMPORTANT: Transition uniquement pour les propriétés non positionnelles */
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.window[data-type="question"] {
    border-color: #aaa;
}

.window[data-type="information"] {
    border-color: #aaa;
}

/* En-tête de fenêtre */
.window-header {
    color: #333;
    padding: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    cursor: move;
    gap: 10px;
}

.window[data-type="question"] .window-header {
    background-color: #f4cf8f;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.window-header-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0; /* Ajouté pour empêcher le débordement */
}

/* Contenu de fenêtre */
.window-content {
    padding: 4px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: 1px solid #aaa;
}

/* Image attachée - MODIFIÉ */
.window-image-attachment {
    display: none; /* Caché car nous n'utilisons plus cette approche */
}

.window-image-attachment img {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Boutons d'action */
.add-image-btn {
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
}

.add-image-btn:hover {
    background-color: #0b7dda;
}

.add-link-btn {
    background-color: #154c79;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
}

.add-link-btn:hover {
    background-color: #1e81b0;
}

.window-close {
    background-color: #d9534f;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    padding: 0;
    margin: 0;
}

.window-close:hover {
    background-color: #c9302c;
}

/* ================= CONNECTIONS OPTIMISÉES POUR SYNCHRONISATION ================= */

/* Styles améliorés pour le chemin de connexion - OPTIMISÉ */
.connection-path {
    stroke: #666;
    stroke-width: 3;
    fill: none;
    pointer-events: visibleStroke;
    /* IMPORTANT: Pas de transition pour le mouvement */
    transition: stroke 0.2s, stroke-width 0.2s;
    cursor: pointer;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
    will-change: transform; /* Optimiser pour les transformations */
}

/* Styles améliorés pour la flèche - OPTIMISÉ */
.arrow-head {
    fill: #666;
    pointer-events: bounding-box;
    /* IMPORTANT: Pas de transition pour le mouvement */
    transition: fill 0.2s;
    cursor: pointer;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.3));
    will-change: transform; /* Optimiser pour les transformations */
}

/* Effets au survol - seulement après déplacement */
.window:not(.dragging) .connection-path:hover {
    stroke: #ff6b6b;
    stroke-width: 4;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.4));
}

.window:not(.dragging) .arrow-head:hover {
    fill: #ff6b6b;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.4));
}

/* Styles pour les connexions sélectionnées */
.connection-path.selected {
    stroke: #ffd700;
    stroke-width: 4;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.7));
}

.arrow-head.selected {
    fill: #ffd700;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.7));
}

/* Animation pour les nouvelles connexions - seulement quand pas en déplacement */
.window:not(.dragging) .connection-path.new-connection {
    animation: connectionPulse 1s ease-in-out;
}

@keyframes connectionPulse {
    0% {
        stroke-width: 3;
        filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
    }
    50% {
        stroke-width: 5;
        filter: drop-shadow(0 0 8px rgba(102, 102, 102, 0.6));
    }
    100% {
        stroke-width: 3;
        filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
    }
}

/* Styles améliorés pour les connecteurs (points de connexion) */
.window-connector {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: #666;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    /* IMPORTANT: Pas de transition pendant le déplacement */
    transition: opacity 0.2s, background-color 0.2s;
    border: 3px solid white;
    z-index: 1000 !important;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    will-change: transform; /* Optimiser pour les transformations */
}

.connection-mode .window-connector {
    opacity: 1;
}

.window:not(.dragging) .window-connector:hover {
    background-color: #ff6b6b;
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.8);
}

.window-connector.active {
    background-color: #ffd700;
    transform: scale(1.5);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.9);
    z-index: 1001 !important;
}

/* Connexions */
.connection {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    overflow: visible;
    pointer-events: auto;
    /* IMPORTANT: Pas de transition pour les déplacements */
    will-change: transform; /* Optimiser pour les transformations */
}

[data-connection] {
    pointer-events: none;
    z-index: 2;
}

[data-connection] path,
[data-connection] polygon {
    pointer-events: all;
    cursor: pointer;
}

/* IMPORTANT: Désactiver les transitions pendant le déplacement */
.window.dragging ~ .connection * {
    transition: none !important;
    animation: none !important;
}

/* Désactiver les effets pendant le déplacement pour améliorer les performances */
body.dragging-active .connection-path,
body.dragging-active .arrow-head {
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.2)) !important;
}

/* Optimisation: Rendre les transitions plus simples */
.workspace {
    transition: transform 0.05s linear; /* Très rapide pour suivre */
}

/* Formulaires */
.form-group {
    margin-bottom: 10px;
}

input[type="text"], textarea {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: none;
    box-sizing: border-box;
}

/* Liens */
.links-container {
    margin-top: 5px;
    border-top: 1px solid #ddd;
    padding-top: 5px;
}

.link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
}

.link-item a {
    color: #0645ad;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
}

.link-item a:hover {
    text-decoration: underline;
}

.delete-link-btn {
    color: #f44336;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 5px;
    font-size: 16px;
}

/* Redimensionnement */
.resize-handle {
    position: absolute;
    width: 15px;
    height: 15px;
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
    border-radius: 0 0 4px 0;
    overflow: hidden;
}

.resize-handle::before {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 15px 15px;
    border-color: transparent transparent #AAA transparent;
}

/* Titres */
.title-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.window-title {
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    padding: 0;
}

.title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
}

.edit-title-icon {
    margin-left: 8px;
    font-size: 0.8em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    color: #555;
    padding: 2px;
}

.window-header:hover .edit-title-icon {
    opacity: 1;
}

.title-input {
    display: none;
    padding: 2px 5px;
    margin: 0;
    font-size: 14px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.8);
    box-sizing: border-box;
}

/* Icônes */
.question-icon {
    font-size: 1.4em;
    vertical-align: middle;
    margin-right: 4px;
}

/* Zoom */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 10px;
}

.zoom-label {
    font-size: 14px;
    color: white;
}

#zoomSlider {
    width: 100px;
    cursor: pointer;
}

#zoomValue {
    min-width: 40px;
    text-align: center;
    color: white;
    font-size: 14px;
}

/* Statut */
.status {
    margin: 0 10px 10px 10px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    flex-shrink: 0;
}

.background-image {
    position: absolute;
    z-index: -1;
    /* Aucune propriété de dimensionnement */
    all: unset;
}

/* Ajustement de la fenêtre pour indiquer qu'elle a une image */
.window.has-image {
    border-bottom: 2px dashed #aaa;
}

.image-container {
    position: relative;
    display: inline-block;
}

.delete-image-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-container:hover .delete-image-btn {
    opacity: 1;
}

.delete-image-btn:hover {
    background-color: #d32f2f;
}

.add-doc-btn {
    background-color: #333;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
    margin-right: 0px;
}

.add-doc-btn:hover {
    background-color: #888;
}

.ai-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: none; /* Masqué par défaut */
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
    margin-right: 0px;
}

.ai-btn:hover {
    background-color: #388E3C;
}

/* Ajustez l'espacement entre les boutons */
.window-header-controls {
    gap: 5px;
}

/* Ajoutez ces styles */
.context-btn {
    background-color: #9C27B0;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
    margin-right: 0px;
}

.context-btn:hover {
    background-color: #7B1FA2;
}

.context-container {
    margin: 0 10px 10px 10px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    flex-shrink: 0;
    border-top: 3px solid #9C27B0;
}

.context-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #9C27B0;
    font-size: 16px;
}

.context-content {
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    max-height: 200px;
    overflow-y: auto;
}

.toolbar button {
    padding: 8px 15px 8px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toolbar button i {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* Style spécifique pour le bouton de zoom */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 10px;
}

.zoom-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: white;
}

.zoom-label i {
    font-size: 14px;
}

/* Ajoutez ces styles */
.information-icon {
    font-size: 1.4em;
    vertical-align: middle;
    margin-right: 4px;
    color: #333;
}

.window[data-type="information"] .window-header {
    background-color: #f0ece1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

/* Ajoutez ces styles dans le fichier CSS */
.save-project-btn {
    background-color: #2196F3;
    color: white;
}

.load-project-btn {
    background-color: #2196F3;
    color: white;
}

/* Toolbar principale */
.toolbar {
    background-color: #333;
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 10px;
}

/* Groupe de gauche */
.toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Groupe de droite */
.toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: auto;
}

/* Zoom controls - ajustements */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 0;
}

/* Boutons - conserver les styles existants */
button {
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    color: white;
}

.ai-settings {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: 10px;
}

#aiProvider {
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

#apiKeyInput {
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ccc;
  width: 200px;
}

.model-info {
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
    padding: 3px;
    background-color: #f5f5f5;
    border-top: 1px solid #eee;
    text-align: right;
    font-style: italic;
}

/* Styles pour le popup de démarrage */
.startup-popup {
    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: 1000;
}

.startup-popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.startup-popup img {
    width: 800px;
    height: 451px;
    object-fit: contain;
}

.close-popup-btn {
    margin-top: 0px;
    padding: 8px 20px;
    background-color: #000;
    color: white;
    border: 2px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 15px;
}

.popup-text {
    font-size: 20px;
    color: #333;
    font-weight: bold;
    margin-right: 20px;
}

.close-popup-btn:hover {
    background-color: #333;
}

.generate-question-btn {
    background: #f4cf8f;
    border: none;
    border-radius: 4px;
    color: black;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
    padding: 4px 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.generate-question-btn:hover {
    background: #e6bf7f;
    transform: scale(1.1);
}

.generate-question-btn i {
    font-size: 10px;
}

/* Styles pour le bouton de graphe */
.graph-btn {
    background-color: #f4cf8f;  /* Changé de #c49f5f à #f4cf8f */
    color: #333;                 /* Ajouté pour contraster avec le fond clair */
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
    margin-right: 0px;
}

.graph-btn:hover {
    background-color: #e6bf7f;
}

/* Styles améliorés pour le conteneur du graphe */
.d3-graph-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 300px;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
}

/* Ajustement de la zone de contenu pour le graphe */
.window-content.with-image {
    position: relative;
    padding: 0 !important;
}

.window-content.with-image .form-group {
    height: 100%;
    margin: 0;
}

/* Assurer que le SVG remplit tout l'espace */
.knowledge-graph {
    width: 100%;
    height: 100%;
    display: block;
}

/* Header de la fenêtre avec graphe */
.window[data-type="information"] .window-header {
    z-index: 1000;
    position: relative;
}

/* Ajustement du redimensionnement */
.resize-handle {
    z-index: 1001;
}

.graph-model-info {
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
}

.node-icon {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.node-icon-group {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.node-icon-group:hover {
    transform: scale(1.1);
}

.custom-node-icon-group {
    cursor: pointer;
}

/* Styles pour le support tactile */
.window {
    touch-action: none;
    user-select: none;
}

.window.dragging {
    opacity: 0.9;
    /* IMPORTANT: Pas de transition pendant le drag */
    transition: opacity 0.1s;
}

.window.resizing {
    opacity: 0.9;
}

/* Améliorations pour le support tactile */
.window-connector.touch-active {
    background-color: #ff4444 !important;
    transform: scale(1.3);
    transition: all 0.2s ease;
}

/* Styles pour le dragging tactile */
.window.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.window.resizing {
    opacity: 0.9;
}

/* Amélioration de la visibilité des connecteurs sur mobile */
@media (max-width: 768px) {
    .window-connector {
        width: 16px !important;
        height: 16px !important;
        border-width: 3px !important;
    }
    
    .window-header-controls button {
        min-width: 36px;
        min-height: 36px;
    }
}

/* Empêcher la sélection de texte pendant le drag */
.window {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.window textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Styles pour les fenêtres sélectionnées manuellement */
.window.selected {
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.7) !important;
    z-index: 1000;
}

.window.selected .window-header {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.window.selected .window-title {
    font-weight: bold;
    color: #333;
}

/* Styles pour les surbrillances de recherche */
.window.search-highlight {
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.7) !important;
    z-index: 999;
}

.window.search-highlight .window-header {
    background: linear-gradient(135deg, #4169e1, #6a8cff);
}

.window.search-highlight .window-title {
    font-weight: bold;
    color: white;
}

/* Animation pour les surbrillances */
.window {
    transition: box-shadow 0.3s ease-in-out;
}

/* Style pour le compteur de sélection manuelle */
.selection-counter {
    position: fixed;
    top: 60px;
    right: 20px;
    background: rgba(255, 215, 0, 0.9);
    color: #333;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 2px solid #ffd700;
}

/* Style pour le compteur de résultats de recherche */
.search-result-counter {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(65, 105, 225, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid #4169e1;
}

/* Styles pour les icônes de nœuds */
.node-icon-group {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.node-icon-group:hover {
    transform: scale(1.05);
}

.node-icon {
    font-family: 'Font Awesome 5 Free' !important;
    font-weight: 900 !important;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/*sélecteur de langue */
#languageSelect {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

#languageSelect:hover {
    border-color: #888;
}

/* Ajustez l'espacement des sélecteurs */
#aiProvider {
    min-width: 160px;
}

#languageSelect {
    min-width: 32px;
}

/* Styles pour la boîte de dialogue de mot de passe */
.password-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.password-dialog {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 350px;
    max-width: 90%;
    animation: dialogFadeIn 0.3s ease;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.password-dialog h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.password-dialog p {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.password-input-group {
    position: relative;
    margin-bottom: 20px;
}

.password-input-group:last-of-type {
    margin-bottom: 25px;
}

.password-input {
    width: 100%;
    padding: 10px 40px 10px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.toggle-password-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password-btn:hover {
    color: #333;
}

.password-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.password-dialog-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.password-dialog-btn.cancel {
    background-color: #f0f0f0;
    color: #333;
}

.password-dialog-btn.cancel:hover {
    background-color: #e0e0e0;
}

.password-dialog-btn.confirm {
    background-color: #2196F3;
    color: white;
}

.password-dialog-btn.confirm:hover {
    background-color: #0b7dda;
}

.password-dialog-btn.confirm:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Styles pour le bouton d'export HTML */
.export-html-btn {
    background-color: #2196F3;
    color: white;
}

.export-html-btn:hover {
    background-color: #0b7dda;
}




/* Styles pour le bouton Home modifié */
.home-link-button {
    background-color: #333;
    color: white;
    padding: 8px 15px;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 14px;
    margin-right: 0;
}

.home-link-button:hover {
    background-color: #444;
    border-color: #f4cf8f;
    transform: scale(1.05);
}

.home-link-button i {
    font-size: 16px;
    color: #f4cf8f;
}

.app-title {
    font-size: 16px;
    letter-spacing: 0.5px;
    font-weight: 800;
}

.app-title-highlight {
    color: #f4cf8f;
    font-weight: 900;
}

/* Ajuster l'espacement pour les autres éléments */
.toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Assurer que les autres boutons conservent leur style */
.toolbar-left button:not(.home-link-button) {
    margin: 0;
}

/* ================= OPTIMISATIONS SUPPLÉMENTAIRES ================= */

/* Désactiver complètement les transitions pendant le déplacement */
body.dragging-active * {
    transition: none !important;
    animation: none !important;
}

/* Optimiser le rendu pendant le drag */
.window.dragging {
    will-change: transform;
}

/* Améliorer les performances du SVG */
.connection svg {
    shape-rendering: geometricPrecision;
    text-rendering: geometricPrecision;
}

/* IMPORTANT: Classes pour optimiser les mouvements */
.connection.moving {
    transition: none !important;
}

/* Style pour indiquer que le système est en train de déplacer */
body.connection-moving .connection-path,
body.connection-moving .arrow-head {
    transition: none !important;
}

/* Optimisation pour le zoom */
.workspace.zooming .connection {
    opacity: 0.7;
    transition: opacity 0.1s;
}

/* ================= RECHERCHE ================= */

.search-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 0;
    width: auto; /* Supprimez toute largeur fixe */
}

.search-input {
    width: 180px; /* Largeur fixe pour le champ */
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.search-btn {
    background-color: #555;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px; /* Même hauteur que le champ */
    width: 38px; /* Largeur fixe pour le bouton */
}

.search-btn:hover {
    background-color: #666;
}

/* Style pour l'affichage du streaming */
.streaming-cursor {
    animation: blink 1s infinite;
    display: inline-block;
    width: 8px;
    height: 1em;
    background-color: #666;
    vertical-align: middle;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Améliorer l'affichage du texte streaming */
.window-content textarea {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Styles pour le menu Fichier */
.file-menu-container {
    position: relative;
    display: inline-block;
}

.file-menu-btn {
    background-color: #333;
    color: white;
    padding: 8px 15px;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: normal;
    font-size: 14px;
    margin-right: 0;
}

.file-menu-btn:hover {
    background-color: #444;
    border-color: #f4cf8f;
}

.file-menu-btn i {
    font-size: 14px;
}

.file-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 4px;
    z-index: 1000;
    padding: 5px 0;
    border: 1px solid #ddd;
}

.file-menu-container:hover .file-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
    color: #000;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

/* Spécifiques couleurs pour les boutons du menu déroulant */
#dropdownSaveBtn i {
    color: #2196F3;
}

#dropdownLoadBtn i {
    color: #2196F3;
}

#dropdownClearBtn i {
    color: #f44336;
}

.dropdown-divider {
    margin: 5px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* Bouton de téléchargement TXT */
.download-txt-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
    margin-right: 0px;
    transition: all 0.2s ease;
}

.download-txt-btn:hover {
    background-color: #45a049;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.download-txt-btn i {
    font-size: 10px;
}

/* Animation de téléchargement */
.download-txt-btn.downloading {
    animation: downloadPulse 0.5s ease-in-out;
}

@keyframes downloadPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: #2196F3; }
    100% { transform: scale(1); }
}

/* ================= PANEL LATERAL DROIT - EXPLORATEUR DE CONNAISSANCES ================= */
.knowledge-panel-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: #2c3e50;
    border-left: 3px solid #f4cf8f;
    z-index: 950;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    color: #ecf0f1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    transform: translateX(100%); /* Complètement caché par défaut */
}

.knowledge-panel-container:not(.collapsed) {
    transform: translateX(0); /* Visible quand ouvert */
}

.knowledge-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(244, 207, 143, 0.15);
    border-bottom: 1px solid rgba(244, 207, 143, 0.3);
    flex-shrink: 0;
}

.knowledge-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f4cf8f;
}

.knowledge-panel-header h3 i {
    color: #f4cf8f;
}

.knowledge-panel-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.extract-entities-btn,
.refresh-knowledge-btn {
    background: #f4cf8f;
    border: none;
    color: #333;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 14px;
}

.extract-entities-btn:hover,
.refresh-knowledge-btn:hover {
    background: #e6bf7f;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(244, 207, 143, 0.6);
}

.knowledge-panel-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.knowledge-search {
    position: relative;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.knowledge-search-input {
    width: 100%;
    padding: 8px 32px 8px 10px;
    background: #34495e;
    border: 1px solid #4a5a6a;
    border-radius: 4px;
    color: #ecf0f1;
    font-size: 13px;
    box-sizing: border-box;
}

.knowledge-search-input::placeholder {
    color: #95a5a6;
}

.knowledge-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    font-size: 14px;
    pointer-events: none;
}

.knowledge-tree {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: #f4cf8f #34495e;
}

.knowledge-tree::-webkit-scrollbar {
    width: 6px;
}

.knowledge-tree::-webkit-scrollbar-track {
    background: #34495e;
    border-radius: 3px;
}

.knowledge-tree::-webkit-scrollbar-thumb {
    background: #f4cf8f;
    border-radius: 3px;
}

.knowledge-tree::-webkit-scrollbar-thumb:hover {
    background: #e6bf7f;
}

.knowledge-tree-loading {
    text-align: center;
    padding: 20px;
    color: #95a5a6;
}

.knowledge-tree-loading i {
    margin-right: 8px;
}

/* Catégories */
.knowledge-category {
    margin-bottom: 15px;
}

.knowledge-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #34495e;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.knowledge-category-header:hover {
    background: #3d566e;
}

.category-chevron {
    font-size: 12px;
    color: #f4cf8f;
    transition: transform 0.2s;
}

.category-icon {
    color: #f4cf8f;
    font-size: 14px;
    width: 16px;
}

.category-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #ecf0f1;
}

.category-count {
    font-size: 11px;
    background: #2c3e50;
    padding: 2px 6px;
    border-radius: 10px;
    color: #95a5a6;
}

.knowledge-category-content {
    margin-left: 20px;
    padding: 5px 0;
}

/* Entités */
.knowledge-entity {
    margin: 2px 0;
}

.knowledge-entity-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.knowledge-entity-header:hover {
    background: #3a4c5e;
}

.entity-chevron {
    font-size: 10px;
    color: #95a5a6;
    transition: transform 0.2s;
    width: 12px;
}

.entity-icon {
    color: #f4cf8f;
    font-size: 12px;
    width: 14px;
}

.entity-name {
    flex: 1;
    font-size: 12px;
    color: #ecf0f1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-window-count {
    font-size: 10px;
    background: #2c3e50;
    padding: 2px 4px;
    border-radius: 8px;
    color: #95a5a6;
    min-width: 18px;
    text-align: center;
}

.knowledge-entity-content {
    margin-left: 28px;
    padding: 5px 0;
    font-size: 11px;
}

.entity-description {
    color: #bdc3c7;
    margin-bottom: 5px;
    padding: 3px 0;
    font-style: italic;
}

.entity-properties {
    background: #2c3e50;
    border-radius: 3px;
    padding: 5px;
    margin-bottom: 5px;
}

.entity-property {
    display: flex;
    gap: 5px;
    font-size: 11px;
    padding: 2px 0;
}

.property-key {
    color: #f4cf8f;
    min-width: 60px;
}

.property-value {
    color: #ecf0f1;
    word-break: break-word;
}

.entity-windows,
.relation-windows {
    margin-top: 5px;
}

.entity-windows-header,
.relation-windows-header {
    font-size: 11px;
    color: #95a5a6;
    margin-bottom: 3px;
}

.entity-window-item,
.relation-window-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 5px;
    background: #34495e;
    border-radius: 3px;
    margin: 2px 0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
}

.entity-window-item:hover,
.relation-window-item:hover {
    background: #3d566e;
    transform: translateX(2px);
}

.entity-window-item i,
.relation-window-item i {
    color: #f4cf8f;
    font-size: 10px;
    width: 14px;
}

/* Relations */
.knowledge-relations {
    margin-top: 8px;
}

.knowledge-relations-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #34495e;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.knowledge-relations-header:hover {
    background: #3d566e;
}

.relations-chevron {
    font-size: 10px;
    color: #95a5a6;
    transition: transform 0.2s;
    width: 12px;
}

.relations-icon {
    color: #f4cf8f;
    font-size: 12px;
    width: 14px;
}

.relations-name {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: #ecf0f1;
}

.relations-count {
    font-size: 10px;
    background: #2c3e50;
    padding: 2px 4px;
    border-radius: 8px;
    color: #95a5a6;
}

.knowledge-relations-content {
    margin-left: 20px;
    padding: 5px 0;
}

.knowledge-relation {
    margin: 2px 0;
}

.knowledge-relation-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.knowledge-relation-header:hover {
    background: #3a4c5e;
}

.relation-chevron {
    font-size: 9px;
    color: #95a5a6;
    transition: transform 0.2s;
    width: 10px;
}

.relation-icon {
    color: #f4cf8f;
    font-size: 10px;
    width: 12px;
}

.relation-name {
    font-size: 11px;
    color: #f4cf8f;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-arrow {
    color: #95a5a6;
    font-size: 10px;
}

.relation-target {
    flex: 1;
    font-size: 11px;
    color: #ecf0f1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relation-window-count {
    font-size: 9px;
    background: #2c3e50;
    padding: 2px 3px;
    border-radius: 6px;
    color: #95a5a6;
    min-width: 16px;
    text-align: center;
}

.knowledge-relation-content {
    margin-left: 28px;
    padding: 5px 0;
    font-size: 11px;
}

.relation-description {
    color: #bdc3c7;
    margin-bottom: 5px;
    padding: 3px 0;
    font-style: italic;
}

/* État vide */
.knowledge-empty {
    text-align: center;
    padding: 20px;
    color: #95a5a6;
}

.knowledge-empty i {
    font-size: 48px;
    color: #f4cf8f;
    margin-bottom: 15px;
}

.knowledge-empty h4 {
    color: #ecf0f1;
    margin: 10px 0;
    font-size: 16px;
}

.knowledge-empty p {
    margin: 5px 0 20px;
    font-size: 13px;
}

.knowledge-empty-steps {
    text-align: left;
    margin: 20px 0;
    padding: 15px;
    background: #34495e;
    border-radius: 8px;
}

.empty-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #3d566e;
}

.empty-step:last-child {
    border-bottom: none;
}

.step-number {
    width: 24px;
    height: 24px;
    background: #f4cf8f;
    color: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.step-text {
    color: #ecf0f1;
    font-size: 12px;
}

.step-text .highlight {
    color: #f4cf8f;
    font-weight: bold;
}

.knowledge-empty-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.knowledge-demo-btn,
.knowledge-import-btn {
    background: #f4cf8f;
    color: #333;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.knowledge-import-btn {
    background: #34495e;
    color: #ecf0f1;
}

.knowledge-demo-btn:hover,
.knowledge-import-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.knowledge-demo-btn:hover {
    background: #e6bf7f;
}

.knowledge-import-btn:hover {
    background: #3d566e;
}

/* Statistiques */
.knowledge-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background: #34495e;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 12px;
    flex-shrink: 0;
}

.knowledge-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ecf0f1;
}

.knowledge-stats i {
    color: #f4cf8f;
    font-size: 12px;
}

/* BOUTON FLOTTANT POUR OUVRIR LE PANEL */
.open-knowledge-panel-btn {
    position: fixed;
    right: 20px;
    top: 70px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f4cf8f;
    color: #333;
    border: none;
    box-shadow: 0 4px 15px rgba(244, 207, 143, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    z-index: 1000;
    transition: all 0.3s ease;
    animation: pulseKnowledge 2s infinite;
}

.open-knowledge-panel-btn:hover {
    transform: scale(1.1);
    background: #e6bf7f;
    box-shadow: 0 6px 20px rgba(244, 207, 143, 0.6);
}

.open-knowledge-panel-btn.hidden {
    display: none;
}

@keyframes pulseKnowledge {
    0% {
        box-shadow: 0 4px 15px rgba(244, 207, 143, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(244, 207, 143, 0.8);
    }
    100% {
        box-shadow: 0 4px 15px rgba(244, 207, 143, 0.4);
    }
}

/* ZONE DE DROP */
.knowledge-drop-zone {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 250px;
    padding: 15px;
    background: rgba(44, 62, 80, 0.95);
    border: 2px dashed #f4cf8f;
    border-radius: 8px;
    color: #ecf0f1;
    text-align: center;
    font-size: 13px;
    z-index: 960;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    pointer-events: all;
    cursor: copy;
}

.knowledge-drop-zone.drag-over {
    background: rgba(244, 207, 143, 0.3);
    border-color: #ecf0f1;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(244, 207, 143, 0.4);
}

.knowledge-drop-zone.extracting {
    opacity: 0.7;
    pointer-events: none;
}

.knowledge-drop-zone.success {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
}

.knowledge-drop-zone.error {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
}

.knowledge-drop-zone i {
    font-size: 24px;
    color: #f4cf8f;
    margin-bottom: 8px;
    display: block;
}

.knowledge-drop-zone.drag-over i {
    color: #ecf0f1;
}

/* Notifications */
.knowledge-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    min-width: 200px;
    max-width: 300px;
    padding: 12px 20px;
    background: #2c3e50;
    border-left: 4px solid;
    border-radius: 4px;
    color: #ecf0f1;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.knowledge-notification.show {
    transform: translateX(0);
}

.knowledge-notification-success {
    border-left-color: #4CAF50;
}

.knowledge-notification-success i {
    color: #4CAF50;
}

.knowledge-notification-error {
    border-left-color: #f44336;
}

.knowledge-notification-error i {
    color: #f44336;
}

.knowledge-notification-warning {
    border-left-color: #ff9800;
}

.knowledge-notification-warning i {
    color: #ff9800;
}

.knowledge-notification-info {
    border-left-color: #2196F3;
}

.knowledge-notification-info i {
    color: #2196F3;
}

/* Barre de progression */
.knowledge-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: #34495e;
    overflow: hidden;
}

.knowledge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f4cf8f, #e6bf7f);
    transition: width 0.3s ease;
}

.knowledge-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ecf0f1;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Surbrillance pour les fenêtres */
.window.knowledge-highlight {
    animation: knowledgePulse 1.5s infinite;
    box-shadow: 0 0 0 4px rgba(244, 207, 143, 0.8);
    z-index: 1000;
}

@keyframes knowledgePulse {
    0% {
        box-shadow: 0 0 0 4px rgba(244, 207, 143, 0.8);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(244, 207, 143, 0.4);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(244, 207, 143, 0.8);
    }
}

/* Style pour le drag */
.window.dragging-for-knowledge {
    opacity: 0.7;
    cursor: copy !important;
}

/* Ajustement du workspace */
.workspace-container {
    transition: margin-right 0.3s ease;
}

/* Menu contextuel */
.knowledge-context-menu {
    position: fixed;
    background: #2c3e50;
    border: 1px solid #f4cf8f;
    border-radius: 4px;
    padding: 5px 0;
    min-width: 180px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ecf0f1;
    font-size: 13px;
    transition: all 0.2s;
}

.context-menu-item:hover {
    background: #3d566e;
}

.context-menu-item i {
    color: #f4cf8f;
    width: 16px;
    font-size: 12px;
}

.context-menu-item.danger {
    color: #f44336;
}

.context-menu-item.danger i {
    color: #f44336;
}

.context-menu-divider {
    margin: 5px 0;
    border: none;
    border-top: 1px solid #3d566e;
}

/* Responsive */
@media (max-width: 768px) {
    .knowledge-panel-container {
        width: 280px;
    }
    
    .open-knowledge-panel-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
        right: 15px;
        top: 70px;
    }
    
    .knowledge-drop-zone {
        width: 220px;
        font-size: 12px;
        padding: 12px;
        right: 15px;
        bottom: 15px;
    }
}

/* ================= BOUTON CONNAISSANCE ================= */

/* Style pour le bouton connaissance */
.knowledge-btn {
    background-color: #f4cf8f;  /* Changé de #9C27B0 à #f4cf8f */
    color: #333;                 /* Ajouté pour contraster */
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
    margin-right: 0px;
    transition: all 0.2s ease;
}

.knowledge-btn:hover {
    background-color: #e6bf7f;  /* Même teinte plus foncée au survol */
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.knowledge-btn i {
    font-size: 10px;
}

/* Animation d'extraction */
.knowledge-btn.extracting {
    animation: extractPulse 1s infinite;
    background-color: #FF9800;
}

@keyframes extractPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: #FF5722; }
    100% { transform: scale(1); }
}

/* Ajustement de l'espacement des boutons */
.window-header-controls {
    gap: 3px;
}

/* À ajouter dans style.css */
.knowledge-extraction-progress {
    padding: 30px 20px;
    text-align: center;
    color: #f4cf8f;
}

.knowledge-extraction-progress i {
    font-size: 40px;
    color: #f4cf8f;
    margin-bottom: 15px;
}

.progress-message {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.progress-details {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: #f4cf8f;
    transition: width 0.3s ease;
}

/* Styles pour les post-its */
.sticky-note-group {
    pointer-events: bounding-box;
    cursor: pointer;
}

.sticky-note {
    transition: transform 0.2s ease;
}

.sticky-note:hover {
    transform: scale(1.05);
}

.sticky-note-tooltip {
    font-family: 'Segoe UI', system-ui, sans-serif;
    white-space: pre-wrap;
    max-width: 200px;
    word-wrap: break-word;
    pointer-events: none;
}

/* Menu contextuel des nœuds */
.node-context-menu {
    animation: menuFadeIn 0.15s ease;
}

.node-context-menu-item {
    font-size: 13px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.node-context-menu-item i {
    color: #8B4513;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal overlay */
.modal-overlay {
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animation pour les post-its */
.sticky-note {
    animation: stickyNotePop 0.3s ease;
}

@keyframes stickyNotePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    80% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Styles pour les nœuds avec image */
.node-group circle[fill^="url(#image-pattern"] {
    transition: filter 0.2s ease;
}

.node-group circle[fill^="url(#image-pattern"]:hover {
    filter: brightness(1.05) drop-shadow(0 0 6px rgba(244, 164, 96, 0.5));
}

/* Style pour l'éditeur de post-it */
.sticky-note-modal textarea {
    font-family: 'Segoe UI', system-ui, sans-serif;
    resize: vertical;
}

.icon-option {
    transition: all 0.2s ease;
}

.icon-option:hover {
    transform: scale(1.1);
    background: #f4cf8f !important;
}

/* Indicateur de post-it */
.node-group.has-sticky-notes circle {
    stroke-dasharray: 5,3;
}

/* Badge pour les nœuds avec post-its */
.node-group .sticky-badge {
    fill: #ffeb3b;
    stroke: #8B4513;
    stroke-width: 1;
}

/* Améliorations pour le drag & drop d'images */
.image-upload-modal input[type="file"] {
    cursor: pointer;
}

.image-upload-modal #imagePreview {
    animation: previewFadeIn 0.3s ease;
}

/* ===== SMOLM3 - INDICATEUR DE CHARGEMENT ===== */

/* Styles améliorés pour l'indicateur de chargement SmolLM3 */
#webllm-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    background: #f0f0f0;
    color: #666;
    margin-left: 10px;
    transition: all 0.3s ease;
    min-width: 200px;
}

#webllm-status i {
    font-size: 12px;
}

#webllm-status-text {
    font-weight: 500;
}

/* Animation de progression */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

#webllm-status.loading {
    animation: pulse 1.5s infinite;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffb74d;
}

#webllm-status.ready {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

#webllm-status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

/* Style pour le bouton paramètres - sans effets visuels indésirables */
.window-settings-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 4px 6px !important;
    margin: 0 2px !important;
    border-radius: 3px !important;
    color: #666 !important;
    font-size: 14px !important;
    transition: none !important;
    outline: none !important;
}

.window-settings-btn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #333 !important;
}

.window-settings-btn:active {
    background: rgba(0, 0, 0, 0.12) !important;
}

.window-settings-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Style du menu contextuel */
.window-context-menu {
    user-select: none;
}

.window-context-menu div:hover {
    background: #f0f0f0;
}

.window-context-menu div:active {
    background: #e0e0e0;
}

/* ================= MENU CONTEXTUEL CLASSIQUE ================= */

.window-context-menu {
    position: fixed;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 6px 0;
    min-width: 210px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    background-color: transparent;
    transition: background 0.12s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.context-menu-item:active {
    background-color: #e8e8e8;
}

/* Style pour l'option Supprimer (texte en rouge) */
.context-menu-item[data-danger="true"] {
    color: #d32f2f;
}

.context-menu-item[data-danger="true"]:hover {
    background-color: #fee;
}

.context-menu-separator {
    height: 1px;
    background-color: #e5e5e5;
    margin: 5px 0;
    padding: 0;
}

/* Animation d'apparition */
@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.window-context-menu {
    animation: contextMenuFadeIn 0.12s ease-out;
}

/* Pour le support tactile */
@media (max-width: 768px) {
    .context-menu-item {
        padding: 12px 16px;
        font-size: 14px;
    }
}


 /* ========== QUOTA DISPLAY - UNIQUEMENT SOLDE ========== */
#quota-container {
    display: inline-block;
    vertical-align: middle;
    margin-right: 15px;
}

.quota-display {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.quota-display i {
    font-size: 13px;
}

.quota-balance {
    font-weight: 600;
    font-size: 14px;
}

/* État normal - solde suffisant (jaune clair) */
.quota-normal {
    background: rgba(255, 193, 7, 0.12);
    color: #b8860b;
}
.quota-normal i {
    color: #ffc107;
}

/* État attention - solde bas (< 10000 tokens) (jaune orangé) */
.quota-warning {
    background: rgba(255, 152, 0, 0.15);
    color: #e67e22;
}
.quota-warning i {
    color: #ff9800;
}
.quota-warning .quota-balance {
    animation: pulse 1s infinite;
}

/* État critique - solde épuisé (0 token) (jaune rougeâtre) */
.quota-critical {
    background: rgba(255, 107, 53, 0.15);
    color: #d35400;
}
.quota-critical i {
    color: #ff6b35;
}
.quota-critical .quota-balance {
    font-weight: bold;
    animation: pulse 0.8s infinite;
}

/* Loading state */
.quota-loading {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #b8860b;
    background: rgba(255, 193, 7, 0.1);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

 /* ===== STYLES POUR LE RECHARGEMENT DE TOKENS ===== */

/* Affichage du solde */
.quota-container {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
}

.quota-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.05);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.quota-normal {
    color: #2e7d32;
}

.quota-warning {
    color: #ed6c02;
}

.quota-critical {
    color: #d32f2f;
}

.quota-loading {
    color: #666;
    font-size: 12px;
}

.quota-status-text {
    font-size: 12px;
}

/* Bouton Recharger solde */
.recharge-btn {
    background: #1976d2;
    border: none;
    color: white;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.recharge-btn:hover {
    background: #1565c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.recharge-btn i {
    font-size: 12px;
}

/* ===== MODAL STRIPE ===== */
.stripe-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.stripe-modal-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 480px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: slideUp 0.3s ease;
}

.stripe-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.stripe-modal-close:hover {
    color: #333;
}

.stripe-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.stripe-modal-header i {
    font-size: 48px;
    color: #1976d2;
}

.stripe-modal-header h2 {
    margin: 10px 0 5px 0;
    color: #333;
}

.stripe-modal-header p {
    color: #666;
    font-size: 13px;
    margin: 0;
}

/* Messages */
.payment-message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
}

.payment-message.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.payment-message.success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.payment-message.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #1565c0;
}

/* Packs */
.packages-container {
    margin-bottom: 25px;
}

.package-btn {
    width: 100%;
    padding: 18px;
    margin-bottom: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.package-btn:hover {
    border-color: #1976d2;
    background: #f0f7ff;
}

.package-btn.selected {
    border-color: #1976d2;
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}

.package-icon {
    font-size: 32px;
    color: #1976d2;
}

.package-info {
    flex: 1;
    text-align: left;
}

.package-info strong {
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.package-price {
    font-size: 28px;
    font-weight: bold;
    color: #1976d2;
    display: inline-block;
}

.package-tokens {
    color: #666;
    margin-left: 8px;
    display: inline-block;
}

.package-badge {
    font-size: 11px;
    color: #4caf50;
    margin-top: 4px;
}

.package-arrow {
    color: #1976d2;
}

/* Élément de paiement Stripe */
.payment-element {
    margin-bottom: 20px;
    min-height: 120px;
}

/* Bouton de paiement */
.submit-payment-btn {
    width: 100%;
    padding: 14px;
    background: #ccc;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: not-allowed;
    transition: all 0.2s;
}

.submit-payment-btn:enabled {
    background: #1976d2;
    cursor: pointer;
}

.submit-payment-btn:enabled:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

/* Notification */
.payment-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    z-index: 100001;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
}

.payment-notification.success {
    background: #1976d2;
    color: white;
}

.payment-notification.error {
    background: #c62828;
    color: white;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}