/* ==========================================================================
   LE41 PRO - SITE-WIDE ACTIVE AI WRITING ASSISTANT STYLES
   Styles pour le widget flottant, panneau escamotable et menu inline IA
   Support complet Thème Sombre & Thème Clair (CSS Variables)
   ========================================================================== */

/* 1. Bouton Flottant Déclencheur (Déplaçable Librement) */
.floating-ai-writer-trigger {
  position: fixed;
  bottom: 24px;
  right: 96px; /* Position initiale par défaut */
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem 0.6rem 0.65rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(168, 85, 247, 0.95));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2rem;
  font-family: var(--font-main, 'Inter', sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.floating-ai-writer-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 30px -4px rgba(99, 102, 241, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.floating-ai-writer-trigger:active,
.floating-ai-writer-trigger.is-dragging {
  cursor: grabbing !important;
  transform: scale(1.05);
  box-shadow: 0 16px 36px -4px rgba(99, 102, 241, 0.75), 0 8px 20px rgba(0, 0, 0, 0.45);
  transition: none !important;
  opacity: 0.96;
}

.floating-ai-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  cursor: grab;
  margin-right: -2px;
}

.floating-ai-drag-handle .drag-grip-icon {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.85);
}

.floating-ai-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.floating-ai-icon-wrap i {
  width: 15px;
  height: 15px;
  color: #fff;
  animation: ai-sparkle-glow 3s infinite ease-in-out;
}

.floating-ai-text {
  letter-spacing: 0.02em;
}

.floating-ai-badge-pulse {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #34d399; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

@keyframes ai-sparkle-glow {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.9; }
  50% { transform: scale(1.15) rotate(15deg); opacity: 1; filter: drop-shadow(0 0 4px #fff); }
}

/* 2. Backdrop Overlay */
.floating-ai-writer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1050;
  transition: opacity 0.25s ease;
}

.floating-ai-writer-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}

/* 3. Panneau Studio IA (Mode Volet Ancré vs Mode Fenêtre Flottante Déplaçable) */
.floating-ai-writer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 95vw;
  background: var(--bg-card, #111827);
  border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-ai-writer-panel.open {
  transform: translateX(0);
}

.floating-ai-writer-panel.hidden {
  display: flex; /* Préserve le flex pour la transition */
}

/* Mode Fenêtre Flottante Libre (Déplaçable n'importe où) */
.floating-ai-writer-panel.floating-mode {
  position: fixed;
  top: 70px;
  bottom: auto;
  right: auto;
  width: 540px;
  max-width: calc(100vw - 20px);
  height: 680px;
  max-height: calc(100vh - 40px);
  border-radius: 16px;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 24px rgba(99, 102, 241, 0.15);
  transform: scale(0.96) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  resize: both;
}

.floating-ai-writer-panel.floating-mode.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.floating-ai-writer-panel.is-dragging {
  user-select: none;
  -webkit-user-select: none;
  transition: none !important;
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.75), 0 0 0 2px rgba(99, 102, 241, 0.4) !important;
}

/* En-tête du Panneau Déplaçable */
.ai-writer-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.3rem;
  background: var(--bg-card-header, rgba(255, 255, 255, 0.03));
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ai-writer-panel-header:active,
.floating-ai-writer-panel.is-dragging .ai-writer-panel-header {
  cursor: grabbing !important;
}

.ai-writer-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  color: var(--text-muted, #94a3b8);
  cursor: grab;
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
  margin-right: 0.25rem;
}

.ai-writer-drag-handle:hover {
  opacity: 1;
  color: var(--primary, #6366f1);
}

.ai-writer-drag-handle i {
  width: 16px;
  height: 16px;
}

.ai-writer-panel-header .header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ai-writer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-writer-avatar i {
  width: 18px;
  height: 18px;
}

.ai-writer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
}

.ai-writer-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted, #94a3b8);
}

.ai-writer-panel-header .header-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-btn.mode-toggle-btn,
.icon-btn.reset-pos-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn.mode-toggle-btn:hover,
.icon-btn.reset-pos-btn:hover {
  color: var(--text-main, #fff);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.icon-btn.mode-toggle-btn i,
.icon-btn.reset-pos-btn i {
  width: 14px;
  height: 14px;
}

.shortcut-pill {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 0.4rem;
}

/* Navigation par Onglets */
.ai-writer-tabs-nav {
  display: flex;
  padding: 0.5rem 1.2rem;
  background: var(--bg-card-sub, rgba(0, 0, 0, 0.15));
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
  gap: 0.5rem;
}

.ai-writer-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-writer-tab-btn i {
  width: 14px;
  height: 14px;
}

.ai-writer-tab-btn:hover {
  color: var(--text-main, #fff);
  background: rgba(255, 255, 255, 0.05);
}

.ai-writer-tab-btn.active {
  color: #ffffff;
  background: var(--color-primary, #6366f1);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

/* Corps du Panneau */
.ai-writer-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
}

/* 4. Studio Express UI Elements */
.ai-writer-studio-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.modes-bar-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
}

.ai-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main, #e2e8f0);
  background: var(--bg-input, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.ai-mode-pill i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ai-mode-pill:hover {
  border-color: var(--color-primary, #6366f1);
  background: rgba(99, 102, 241, 0.08);
}

.ai-mode-pill.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border-color: #818cf8;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
  font-weight: 600;
}

.ai-writer-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ai-writer-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-writer-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #e2e8f0);
}

.btn-grab-focused {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-primary, #818cf8);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-grab-focused i {
  width: 12px;
  height: 12px;
}

.btn-grab-focused:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
}

.ai-writer-textarea,
.ai-writer-input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-family: var(--font-main, 'Inter', sans-serif);
  font-size: 0.85rem;
  color: var(--text-main, #f8fafc);
  background: var(--bg-input, rgba(15, 23, 42, 0.6));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 0.6rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ai-writer-textarea:focus,
.ai-writer-input:focus {
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-ai-transform {
  width: 100%;
  padding: 0.75rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 0.6rem;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-ai-transform:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

/* Result Card */
.ai-writer-result-card {
  margin-top: 0.5rem;
  background: var(--bg-card-sub, rgba(15, 23, 42, 0.5));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.3s ease;
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.result-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.result-badge-success {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 0.35rem;
}

.result-badge-success i {
  width: 12px;
  height: 12px;
}

.result-source-label {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
}

.result-card-body {
  padding: 0.75rem 0.9rem;
}

.output-textarea {
  background: transparent;
  border: none;
  box-shadow: none !important;
  resize: vertical;
  line-height: 1.55;
}

.result-card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.btn-inject-action {
  flex: 1.3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #10b981;
  color: #fff;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.8rem;
  border-radius: 0.45rem;
}

.btn-inject-action:hover {
  background: #059669;
}

/* 5. Context Tab UI */
.context-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 0.6rem;
  margin-bottom: 1rem;
}

.context-banner-icon {
  width: 22px;
  height: 22px;
  color: var(--color-primary, #818cf8);
  flex-shrink: 0;
  margin-top: 2px;
}

.context-banner strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-main, #fff);
}

.context-banner p {
  margin: 0.2rem 0 0 0;
  font-size: 0.76rem;
  color: var(--text-muted, #94a3b8);
}

.context-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.suggestion-card {
  padding: 0.9rem;
  background: var(--bg-card-sub, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 0.6rem;
  transition: all 0.2s ease;
}

.suggestion-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.04);
}

.suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.suggestion-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.suggestion-badge {
  font-size: 0.68rem;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.suggestion-title {
  font-size: 0.85rem;
  color: var(--text-main, #f8fafc);
}

.btn-use-template {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary, #6366f1);
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-use-template:hover {
  background: #4f46e5;
}

.suggestion-desc {
  margin: 0.2rem 0 0.5rem 0;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

.suggestion-preview {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0.6rem;
  border-radius: 0.35rem;
}

.suggestion-preview code {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
}

/* 6. Lexique Tab UI */
.lexique-search-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 1rem;
}

.lexique-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lexique-item-card {
  padding: 0.85rem;
  background: var(--bg-card-sub, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 0.6rem;
}

.lexique-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.badge-ortho {
  font-size: 0.68rem;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.lexique-item-def {
  margin: 0.25rem 0 0.4rem 0;
  font-size: 0.78rem;
  color: var(--text-main, #e2e8f0);
}

.lexique-item-rule {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  background: rgba(0, 0, 0, 0.15);
  padding: 0.35rem 0.55rem;
  border-radius: 0.35rem;
}

.lexique-item-rule i {
  width: 12px;
  height: 12px;
  color: var(--color-primary, #818cf8);
}

/* 7. Inline Sparkle Badge & Popover Menu */
.inline-ai-badge {
  position: absolute;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(168, 85, 247, 0.95));
  color: #fff;
  font-family: var(--font-main, sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s ease;
  animation: fadeIn 0.2s ease;
}

.inline-ai-badge i {
  width: 12px;
  height: 12px;
}

.inline-ai-badge:hover {
  transform: scale(1.06);
}

.inline-ai-popover-menu {
  position: absolute;
  z-index: 1010;
  display: none;
  flex-direction: column;
  width: 270px;
  background: var(--bg-card, #1e293b);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 0.6rem;
  gap: 0.4rem;
  animation: scaleIn 0.2s ease;
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.popover-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main, #fff);
}

.popover-title i {
  width: 13px;
  height: 13px;
  color: #818cf8;
}

.btn-open-full-studio {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 0.3rem;
}

.btn-open-full-studio:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.popover-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.popover-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main, #e2e8f0);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
  border-radius: 0.45rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.popover-btn i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.popover-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  transform: translateX(2px);
}

.popover-footer {
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.popover-footer-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  background: transparent;
  border: none;
  cursor: pointer;
}

.popover-footer-btn:hover {
  color: #fff;
}

/* 8. Topbar AI Button */
.topbar-ai-writer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 0.6rem;
  color: #c7d2fe;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-ai-writer-btn i {
  width: 15px;
  height: 15px;
  color: #818cf8;
}

.topbar-ai-writer-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

/* 9. Animations & Responsive */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.spin {
  animation: spin 1s linear infinite;
}

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

@media (max-width: 768px) {
  .floating-ai-writer-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .floating-ai-writer-trigger {
    bottom: 74px; /* Au-dessus de la barre de navigation mobile */
    right: 16px;
    padding: 0.5rem 0.85rem;
  }
  .floating-ai-text {
    display: none; /* Icone seule sur smartphone pour ne pas encombrer */
  }
  .ai-modes-grid {
    grid-template-columns: 1fr 1fr;
  }
}
