/* Nouvelle architecture colonne AI - Style Cursor */





/* Zone de redimensionnement manuel */
.resize-zone-ai {
  position: absolute;
  width: 10px;
  height: 100%;
  left: -5px;
  top: 0;
  cursor: ew-resize;
  margin-right: 10px;
  margin-left: 0px;
  z-index: 20;
  background: transparent;
  transition: background-color 0.2s ease;
}

.resize-zone-ai:hover {
  background: rgba(116, 170, 156, 0.1) !important;
}

.resize-zone-ai:active {
  background: rgba(116, 170, 156, 0.2) !important;
}

/* Indicateur visuel pour la zone de resize */
.resize-zone-ai::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 30px;
  background: #74AA9C;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.resize-zone-ai:hover::after {
  opacity: 0.3;
}

.resize-zone-ai:active::after {
  opacity: 0.6;
}

/* Container principal */
#colonne_ai {
  position: relative;
  display: flex !important;
  flex-direction: row;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Barre d'icônes dans la colonne AI */
.ai-sidebar-icons {
  width: 48px;
  height: 100%;
  min-height: 90vh;
  background: #000;
  border-left: 0px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  border-top-right-radius: 100px;
  border-top-left-radius: 100px;
  border-bottom-right-radius: 100px;
  border-bottom-left-radius: 100px;
  padding-top: 30px;
  border-top: 1px solid #000;
}

/* Règle de debug supprimée */

.ai-icon-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
  font-size: 16px;
  position: relative;
  opacity: 1 !important;
  visibility: visible !important;
}

.ai-icon-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.ai-icon-btn.active {
  background: #6767D9;
  color: white;
}

.ai-chat-btn {
  width: 36px;
  height: 36px;
  background: none !important;
  border: none !important;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 8px;
  color: #6b7280 !important;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
  position: relative;
  opacity: 1 !important;
  visibility: visible !important;
}

.ai-chat-btn:hover {
  background: #e5e7eb !important;
  color: #374151 !important;
}

.ai-chat-btn.active {
  background: #6767D9 !important;
  color: white !important;
}

/* Spécificité renforcée pour l'état actif */
.ai-sidebar-icons .ai-chat-btn.active {
  background: #fff !important;
  color: #7B7DFE !important;
}

/* Spécificité renforcée pour l'état normal */
.ai-sidebar-icons .ai-chat-btn {
  background: none !important;
  color: #fff !important;
}

.ai-sidebar-icons .ai-chat-btn:hover:not(.active) {
  background: #e5e7eb !important;
  color: #000 !important;
}

/* Panneau de chat */
.ai-chat-panel {
  flex: 1;
  display: none; /* Caché par défaut */
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  width: calc(100% - 36px); /* Réduire l'espace réservé à l'icône */
  margin-right: 0;
  position: relative;
}



/* Zone de conversation */
.ai-chat-conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  min-height: calc(100vh - 250px);
  max-height: calc(100vh - 250px); /* Ajuster selon la hauteur de l'input */
  padding-top: 30px;
}

/* Récap de sélection - Style mockup */
.ai-selection-recap {
  background: #DDD3FF;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0; /* Ne pas rétrécir */
}

.ai-selection-preview {
  font-size: 14px;
  color: #5b21b6;
  font-weight: 400;
  line-height: 1.4;
}

.ai-selection-count {
  font-size: 10px;
  color: #6767D9;
  font-weight: 400;
  text-align: right;
}

/* Dropdown de prompts au-dessus de l'input */
.ai-prompts-dropdown-container {
  position: relative;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.ai-prompts-dropdown-trigger {
  width: 100%;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #6b7280;
}

.ai-prompts-dropdown-trigger:hover {
  background: #f1f5f9;
  border-color: #d1d5db;
}

.ai-prompts-dropdown-trigger.active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1e40af;
}

.ai-prompts-dropdown-trigger i:first-child {
  color: #8b5cf6;
}

.ai-prompts-dropdown-trigger span {
  flex: 1;
  text-align: left;
}

.ai-dropdown-arrow {
  transition: transform 0.2s ease;
  font-size: 12px;
}

.ai-prompts-dropdown-trigger.active .ai-dropdown-arrow {
  transform: rotate(-180deg);
}

/* Le dropdown lui-même - S'ouvre vers le haut */
.ai-prompts-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
  z-index: 9998;
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 4px;
  display: none;
}

.ai-prompts-dropdown.visible {
  display: block;
}

/* Items dans le dropdown */
.ai-prompt-dropdown-item {
  position: relative;
}

.ai-prompt-dropdown-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}

.ai-prompt-dropdown-main:hover {
  background: #f8fafc;
}

/* Styles pour le drag and drop */
.ai-prompt-drag-handle {
  color: #d1d5db;
  cursor: grab;
  font-size: 12px;
  transition: color 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  margin-right: 8px;
}

.ai-prompt-drag-handle:hover {
  color: #6b7280;
}

.ai-prompt-drag-handle:active {
  cursor: grabbing;
}

.ai-prompt-dropdown-item.dragging {
  opacity: 0.7;
  transform: rotate(1deg) scale(1.02);
  z-index: 9997;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: grabbing !important;
}

.ai-prompt-dropdown-item.drag-over {
  border-top: 3px solid #74AA9C;
  background: rgba(116, 170, 156, 0.08);
  position: relative;
}

.ai-prompt-dropdown-item.drag-over::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: #74AA9C;
  border-radius: 2px;
  animation: dragOverPulse 0.6s ease-in-out;
}

@keyframes dragOverPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.ai-prompt-dropdown-item[draggable="true"] {
  cursor: grab;
  transition: all 0.2s ease;
}

.ai-prompt-dropdown-item[draggable="true"]:hover {
  background: rgba(116, 170, 156, 0.05);
  transform: translateY(-1px);
}

.ai-prompt-dropdown-item[draggable="true"]:active {
  cursor: grabbing;
}

.ai-prompt-dropdown-item[draggable="false"] {
  cursor: default;
}

.ai-prompt-dropdown-item[draggable="false"] .ai-prompt-drag-handle {
  cursor: default;
  opacity: 0.3;
}

.ai-prompt-dropdown-item:last-child .ai-prompt-dropdown-main {
  border-bottom: none;
}

.ai-prompt-type-icon {
  font-size: 12px;
  width: 16px;
  text-align: center;
}

.ai-prompt-type-icon.fa-globe {
  color: #10b981;
}

.ai-prompt-type-icon.fa-user {
  color: #6366f1;
}

.ai-prompt-dropdown-text {
  flex: 1;
  color: inherit;
  font-weight: 500;
}

.ai-prompt-dropdown-menu-btn {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  opacity: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-prompt-dropdown-main:hover .ai-prompt-dropdown-menu-btn {
  opacity: 1;
}

.ai-prompt-dropdown-menu-btn:hover {
  background: #e5e7eb;
  color: #6b7280;
}

/* Menu contextuel pour les prompts */
.ai-prompt-context-menu {
  position: fixed;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  min-width: 160px;
  overflow: hidden;
  display: none;
}

.ai-prompt-context-menu.visible {
  display: block;
}

.ai-prompt-context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: background-color 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.ai-prompt-context-item:hover {
  background: #f3f4f6;
}

.ai-prompt-context-item i {
  font-size: 12px;
  color: #6b7280;
}

/* Footer du dropdown avec les boutons library/manage */
.ai-prompts-dropdown-footer {
  border-top: 1px solid #e5e7eb;
  padding: 8px;
  display: flex;
  gap: 4px;
}

.ai-prompts-footer-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
}

.ai-prompts-footer-btn:hover {
  background: #f8fafc;
  color: #374151;
}

.ai-prompts-footer-btn i {
  font-size: 12px;
}

.ai-prompts-footer-btn span {
  font-weight: 500;
}

/* Séparateur entre la liste et le footer */
.ai-prompts-dropdown-list {
  max-height: 280px;
  overflow-y: auto;
}



/* Messages de conversation */
.ai-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 20px;
  min-height: 0; /* Important pour que le scroll fonctionne dans flexbox */
}

.ai-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-message.user {
  align-items: flex-end;
}

.ai-message.assistant {
  align-items: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-direction: row;
}

.ai-message.assistant .ai-message-avatar {
  align-self: flex-start;
  margin-top: 0px;
}

.ai-message.assistant .ai-message-content {
  flex: 1;
}

.old_ai-message-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7B7DFE 0%, #B16CFE 100%);
  background-size: 200% 200%;
  animation: gradientShift 3s ease-in-out infinite;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0;
}

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

.ai-message-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: linear-gradient(-135deg, #7B7DFE, #C488F8, #23a6d5, #B16CFE);
	background-size: 400% 400%;
	animation: gradientShift 15s ease infinite;
	flex-shrink: 0;
	align-self: flex-start;
	margin-top: 0;
}

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


.ai-message.assistant .ai-message-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ai-message.assistant .ai-message-content {
  padding-top: 0;
  margin-top: 0;
}

.ai-message.assistant .ai-message-content * {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.ai-message.assistant .ai-message-content h1, .ai-message.assistant .ai-message-content h2, .ai-message.assistant .ai-message-content h3, .ai-message.assistant .ai-message-content h4, .ai-message.assistant .ai-message-content h5, .ai-message.assistant .ai-message-content h6 {
    margin-top: -8px !important;
    padding-top: 0 !important;
}

.ai-message-content {
  max-width: 95%;
  padding: 4px 5px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ai-message-content ul {
  padding-bottom: 10px ;
}

.ai-message.user .ai-message-content {
  background: #f8fafc;
  color: #000;
  border-bottom-right-radius: 4px;
}

.ai-message.assistant .ai-message-content {
  background: #fff;
  color: #000;
  border-bottom-left-radius: 4px;
}

/* Styles pour les actions des messages - Apparition au survol */
.ai-message-actions {
  display: flex;
  gap: 8px;
  margin-top: 0px;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-bottom: 0px;
}

.ai-message:hover .ai-message-actions {
  opacity: 1;
}

/* Boutons d'action avec style épuré */
.ai-apply-btn,
.ai-copy-btn {
  padding: 2px 12px !important;
  background: transparent !important;
  color: #6b7280 !important;
  border: none !important;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-apply-btn:hover,
.ai-copy-btn:hover {
  color: #374151 !important;
  background: transparent !important;
}

/* Zone d'input - En bas de la colonne AI avec flux normal */
.ai-chat-input-zone {
  padding: 16px 20px 20px 20px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  box-sizing: border-box;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  margin-top: auto; /* Pour la pousser en bas si nécessaire */
}

.ai-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s ease;
  flex-shrink: 0;
}

.ai-input-wrapper:focus-within {
  border-color: #6767D9;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#ai-custom-input {
  flex: 1;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: #000
  ;
  line-height: 1.5;
}

#ai-custom-input:focus {
  outline: none;
}

#ai-custom-input::placeholder {
  color: #9ca3af;
}

.ai-send-btn {
  width: 32px;
  height: 32px;
  background: #d1d5db;
  color: #6b7280;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
  background: #9ca3af;
  color: #374151;
}

.ai-send-btn:disabled {
  background: #f3f4f6;
  color: #d1d5db;
  cursor: not-allowed;
}

/* Quand il y a du texte, le bouton devient actif */
.ai-input-wrapper.has-text .ai-send-btn {
  background: #000;
  color: white;
}

.ai-input-wrapper.has-text .ai-send-btn:hover {
  background: #000;
}

/* États spéciaux */
.ai-loading {
  opacity: 0.7;
  pointer-events: none;
}

.ai-loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

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

@keyframes loading-dots {
  0%, 20% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  80%, 100% {
    opacity: 0.3;
  }
}

/* État fermé - seulement la barre d'icônes visible */
#colonne_ai.collapsed {
  width: 48px !important; /* Garde la largeur de l'icône */
  overflow: visible !important;
  border-left: 0px solid #e5e7eb;
  border-top: 0px solid #e5e7eb;
  border-bottom: 0px solid #e5e7eb;
}

#colonne_ai.collapsed .ai-chat-panel {
  display: none;
}

/* L'icône est maintenant toujours en position fixed, plus besoin de règles spéciales */

/* Mise en évidence de la sélection quand IA ouverte */
.ai-selection-active ::selection {
  background: #DDD3FF !important;
  color: inherit !important;
}

.ai-selection-active ::-moz-selection {
  background: #DDD3FF !important;
  color: inherit !important;
}

/* Surlignage persistant pour la sélection confirmée */
.ai-persistent-highlight {
  background: #DDD3FF !important;
  border-radius: 2px;
  padding: 1px 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-color 0.2s ease;
}

/* Effet au survol du surlignage persistant */
.ai-persistent-highlight:hover {
  background: #C9B8FF !important;
}

/* Responsive */
@media (max-width: 768px) {
  .ai-sidebar-icons {
    width: 40px;
    padding: 8px 0;
  }
  
  .ai-icon-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .ai-chat-header {
    padding: 12px 16px;
  }
  
  .ai-chat-conversation {
    padding: 12px 16px;
  }
  
  .ai-chat-input-zone {
    padding: 12px 16px;
  }
  
  .ai-prompt-btn {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  #colonne_ai.collapsed {
    width: 40px !important;
  }
} 

/* Zone de sélection repositionnée au dessus de l'input */
.ai-selection-recap {
  background: #DDD3FF;
  border: 1px solid #C4B5FD;
  border-radius: 8px;
  padding: 12px;
  padding-right: 32px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 14px;
  color: #374151;
  position: relative;
}

.ai-selection-content {
  flex: 1;
  margin-right: 12px;
}

.ai-selection-preview {
  font-weight: 500;
  margin-bottom: 4px;
  color: #1f2937;
  word-break: break-word;
}

.ai-selection-count {
  font-size: 11px;
  color: #6767D9;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-weight: 400;
}

.ai-selection-close {
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: color 0.2s ease;
  position: absolute;
  top: 8px;
  right: 8px;
}

.ai-selection-close:hover {
  color: #374151;
}

/* Zone d'input - layout normal sans z-index */
.ai-input-wrapper {
  /* Suppression du z-index pour éviter les superpositions */
}

/* Styles pour les messages avec collapse */
.ai-message-collapsible {
  position: relative;
}

.ai-message-preview,
.ai-message-full {
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-message-toggle {
  background: none;
  border: none;
  color: #000;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.ai-message-toggle:hover {
  color: #6767D9;
  background: none;
}

.ai-message-toggle i {
  font-size: 10px;
} 

/* Layout spécial pour les prompts prédéfinis */
.ai-message-prompt {
  background: #f8fafc;
}

.ai-prompt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ai-prompt-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.ai-prompt-name {
  font-weight: 600;
  color: #000;
  font-size: 14px;
}

.ai-prompt-content {
  margin-top: 12px;
  padding: 12px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-prompt-toggle {
  margin-top: 8px;
  color: #6767D9;
  font-weight: 500;
}

.ai-prompt-toggle:hover {
  color: #5a5ac7;
  background: none;
} 

/* Input d'édition inline pour renommer les prompts */
.ai-prompt-rename-input {
  border: 1px solid #6767D9;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  background: white;
  outline: none;
  width: 200px;
  max-width: 100%;
} 

/* Animation de chargement pour les prompts */
.ai-prompt-loading {
  display: inline-block;
  margin-left: 4px;
  width: 20px; /* Largeur fixe pour éviter les variations */
  text-align: left;
}

.ai-loading-dots::after {
  content: '';
  animation: ai-loading-dots 1.5s infinite;
  display: inline-block;
  width: 20px; /* Même largeur que le conteneur */
}

@keyframes ai-loading-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* Styles pour la bulle de réponse en chargement */
.ai-loading-response .ai-message-content {
  min-height: 20px;
  display: flex;
  align-items: center;
}

.ai-loading-response .ai-loading-dots {
  font-size: 16px;
  color: #000;
}

/* Section de contrôles sous l'input */
.ai-controls-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 5px;
  margin-top: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 25;
}

/* Quand la colonne AI devient trop étroite, empiler les boutons */
@media (max-width: 400px) {
  .ai-controls-section {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }
  
  .ai-control-btn {
    width: 100%;
    justify-content: center;
    cursor: pointer !important;
    pointer-events: auto !important;
  }
}

/* Règle spécifique pour la colonne AI quand elle est très étroite (320px) */
#colonne_ai.narrow .ai-controls-section {
  flex-direction: column;
  gap: 8px;
  padding: 12px 5px;
}

#colonne_ai.narrow .ai-control-btn {
  width: 100%;
  justify-content: center;
  cursor: pointer !important;
  pointer-events: auto !important;
}

.ai-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 6px;
  background-color: #f8fafc;
  color: #000;
  position: relative;
  z-index: 10;
  font-size: 11px;
}

.ai-control-btn:hover {
  background: #000 !important;
  color: #fff !important;
}

.ai-control-btn img {
  width: 15px;
  height: 15px;
  transition: filter 0.2s ease;
  margin-right: 5px;
  
}

.ai-control-btn:hover img {
  filter: brightness(0) invert(1);
}

/* Styles pour le bouton de toggle contenu */
.ai-control-btn[data-include-content="true"] {
  background: #000 !important;
  color: #fff !important;
}

.ai-control-btn[data-include-content="true"] img {
  filter: brightness(0) invert(1);
}

.ai-control-btn[data-include-content="false"] {
    background-color: #f8fafc;
  color: #000;
}

.ai-control-btn[data-include-content="false"] img {
  filter: none;
}

/* Modal de sélection du modèle - Style épuré inspiré audit */
.ai-model-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ai-model-modal.show {
  opacity: 1;
}

.ai-model-modal.hide {
  opacity: 0;
}

.ai-model-modal-content {
  background: #fff;
  border: 2px solid #B7A7FE;
  border-radius: 5px;
  box-shadow: 0 4px 32px 0 rgba(123, 125, 254, 0.10);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  padding: 0;
  padding-top: 42px;
  animation: fadeIn 0.2s;
}

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

.ai-model-modal-close {
  position: absolute;
  right: 24px;
  top: 18px;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  z-index: 12;
  transition: color 0.18s;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-model-modal-close:hover {
  color: #d90000;
}

.ai-model-modal-body {
  padding: 38px 32px 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.ai-model-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
}

.ai-model-modal-title-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.ai-model-modal-title-text {
  font-family: 'Poppins', Arial, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111;
}

.ai-model-current {
  padding: 12px 16px;
  background: #f8f9ff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 14px;
  color: #374151;
  width: 100%;
  box-sizing: border-box;
}

.ai-model-options {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.ai-model-section-header a {
    cursor: pointer;
    font-size: 12px;
    color: red;
    margin-right: 20px;
}

.ai-model-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-model-section h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  padding-bottom: 8px;
  border-bottom: 2px solid #7B7DFE;
  font-family: 'Poppins', Arial, sans-serif;
}

.ai-model-section:last-child h4 {
  border-bottom-color: #8b5cf6;
}

.ai-model-option {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.ai-model-option:hover {
  border-color: #7B7DFE;
  background-color: #f8f9ff;
}

.ai-model-option.ai-model-anthropic:hover {
  border-color: #8b5cf6;
  background-color: #f8f5ff;
}

/* Styles pour les options désactivées */
.ai-model-option.ai-model-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f5f5f5;
  border-color: #d1d5db;
}

.ai-model-option.ai-model-disabled:hover {
  border-color: #d1d5db;
  background-color: #f5f5f5;
}

.ai-model-option.ai-model-disabled input[type="radio"] {
  cursor: not-allowed;
}

.ai-model-option.ai-model-disabled .ai-model-name,
.ai-model-option.ai-model-disabled .ai-model-info {
  color: #6b7280;
}

/* Styles pour l'icône de clé API */
.ai-model-api-key-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
  max-width: 25px;
}

/* Styles pour le texte "Clé API requise" */
.ai-model-api-required {
  color: #FF5C5C;
  text-decoration: none;
  font-size: 12px;
  margin-left: 8px;
}

.ai-model-option input[type="radio"] {
  margin-right: 12px;
  margin-top: 2px;
  accent-color: #7B7DFE;
  flex-shrink: 0;
}

.ai-model-option-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-model-name {
  font-weight: 500;
  color: #000;
  font-size: 14px;
  font-family: 'Poppins', Arial, sans-serif;
}

.ai-model-info {
  font-size: 11px;
  color: #000;
  font-weight: 300;
}

.ai-model-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 32px 32px 32px;
  border-top: 1px solid #e5e7eb;
  margin-top: 24px;
}

.ai-model-cancel,
.ai-model-save {
  padding: 12px 24px;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Poppins', Arial, sans-serif;
  font-size: 14px;
  border: none;
}

.ai-model-cancel {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
}

.ai-model-cancel:hover {
  background: #e5e7eb;
}

.ai-model-save {
  background: linear-gradient(90deg, #7B7DFE 0%, #B16CFE 100%);
  border: 1px solid #7B7DFE;
  color: white;
}

.ai-model-save:hover {
  background: linear-gradient(90deg, #6a6ce8 0%, #a05be8 100%);
  border-color: #6a6ce8;
}

/* Affichage HTML dans les messages AI */
.ai-message-content h2,
.ai-message-content h3,
.ai-message-content h4 {
  margin: 8px 0 4px 0;
  font-weight: 600;
  color: #374151;
}

.ai-message-content h2 {
  font-size: 18px;
}

.ai-message-content h3 {
  font-size: 16px;
}

.ai-message-content h4 {
  font-size: 14px;
}

.ai-message-content ul,
.ai-message-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.ai-message-content li {
  margin: 4px 0;
}

.ai-message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}

.ai-message-content th,
.ai-message-content td {
  border: 1px solid #e5e5e5;
  padding: 8px 12px;
  text-align: left;
}

.ai-message-content th {
  background: #f8f9fa;
  font-weight: 600;
}

.ai-message-content p {
  margin: 8px 0;
  line-height: 1.5;
}

.ai-message-content strong {
  font-weight: 600;
}

.ai-message-content em {
  font-style: italic;
}

.ai-message-content blockquote {
  border-left: 3px solid #6767D9;
  padding-left: 12px;
  margin: 12px 0;
  font-style: italic;
  color: #6b7280;
}

/* Zone de messages pour les notifications du chat */
.ai-chat-messages {
  display: none;
  margin-top: 10px;
  min-height: 20px;
}

.ai-chat-message {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ai-chat-message-success {
  color: #155724;
  border: 1px solid #24C789 !important;
  background-color: #F6FFFB;
}

.ai-chat-message-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.ai-chat-message-content i {
  font-size: 14px;
  flex-shrink: 0;
}

.ai-chat-message-content span {
  flex: 1;
  line-height: 1.4;
}

/* Zone de messages pour les notifications de prompts */
.ai-prompt-messages {
  display: none;
  margin-top: 10px;
  min-height: 20px;
}

.ai-prompt-message {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ai-prompt-message-success {
  color: #155724;
  border: 1px solid #24C789 !important;
  background-color: #F6FFFB;
}

.ai-prompt-message-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.ai-prompt-message-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.ai-prompt-message-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.ai-prompt-message-content i {
  font-size: 14px;
  flex-shrink: 0;
}

.ai-prompt-message-content span {
  flex: 1;
  line-height: 1.4;
}

/* Indicateur de chunking */
.ai-chunking-notice {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(116, 170, 156, 0.1);
  border: 1px solid rgba(116, 170, 156, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: #74AA9C;
  text-align: center;
  font-style: italic;
}

/* Panneaux IA génériques */
.ai-prompts-panel,
.ai-checks-panel {
  flex: 1;
  display: none; /* Caché par défaut */
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  width: calc(100% - 48px); /* Laisser 48px à droite pour l'icône fixe */
  margin-right: 0;
  position: relative;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* En-tête des panneaux */
.ai-panel-header {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  flex-shrink: 0;
}

.ai-panel-header h3 {
  margin-top: 5px !important;
  margin-bottom: 5px !important;
  font-size: 15px;
  font-weight: 600;
  color: #000;
}

.ai-panel-header p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

/* Contenu des panneaux */
.ai-panel-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  min-height: 0; /* Important pour le scroll dans flexbox */
  max-height: 82vh;
}

/* Placeholder pour les panneaux en développement */
.ai-panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #9ca3af;
}

.ai-panel-placeholder i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.ai-panel-placeholder p {
  font-size: 16px;
  margin: 0;
  opacity: 0.7;
}

/* Styles spécifiques au panneau prompts */
.ai-prompts-list {
  flex: 1;
  overflow-y: scroll;
  padding: 0;
  margin: 0;
}

/* Adapter les styles des items pour le panneau (au lieu du dropdown) */
.ai-prompts-panel .ai-prompt-dropdown-item {
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  transition: all 0.2s ease;
}

.ai-prompts-panel .ai-prompt-dropdown-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-prompts-panel .ai-prompt-dropdown-main {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ai-prompts-panel .ai-prompt-dropdown-main:hover {
  background-color: #f8fafc;
}

/* Styles de drag & drop spécifiques au panneau prompts */
.ai-prompts-panel .ai-prompt-dropdown-item[draggable="true"] {
  cursor: grab;
  transition: all 0.2s ease;
}

.ai-prompts-panel .ai-prompt-dropdown-item[draggable="true"]:hover {
  background: rgba(116, 170, 156, 0.05);
  transform: translateY(-1px);
}

.ai-prompts-panel .ai-prompt-dropdown-item[draggable="true"]:active {
  cursor: grabbing;
}

.ai-prompts-panel .ai-prompt-dropdown-item.dragging {
  opacity: 0.7;
  transform: rotate(1deg) scale(1.02);
  z-index: 9997;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: grabbing !important;
}

.ai-prompts-panel .ai-prompt-dropdown-item.drag-over {
  border-top: 3px solid #74AA9C;
  background: rgba(116, 170, 156, 0.08);
  position: relative;
}

.ai-prompts-panel .ai-prompt-dropdown-item.drag-over::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: #74AA9C;
  border-radius: 2px;
  animation: dragOverPulse 0.6s ease-in-out;
}

/* Footer du panneau prompts */
.ai-prompts-footer {
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.ai-prompts-footer .ai-prompts-footer-btn {
  flex: 1;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 30px;
}

.ai-prompts-footer .ai-prompts-footer-btn:hover {
  background: #f1f5f9;
  border-color: #d1d5db;
  color: #374151;
}

.ai-prompts-footer .ai-prompts-footer-btn i {
  font-size: 14px;
}

.ai-prompts-footer .ai-prompts-footer-btn span {
  font-weight: 500;
}

/* Bouton d'édition du contexte */
.ai-context-edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.ai-context-edit-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #475569;
}

.ai-context-edit-btn i {
  font-size: 11px;
}

.ai-context-edit-btn span {
  white-space: nowrap;
}