/* Eakademy — Agent Odile (v8) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ea-chat-primary:      #e30613;
  --ea-chat-primary-dark: #c00010;
  --ea-chat-ai:           #6366f1;
  --ea-chat-ai-light:     #818cf8;
  --ea-chat-bg:           #ffffff;
  --ea-chat-surface:      #f6f7fb;
  --ea-chat-border:       rgba(15, 23, 42, 0.08);
  --ea-chat-text:         #1a2236;
  --ea-chat-text-light:   #4b5673;
  --ea-chat-muted:        #8593a9;
  --ea-chat-shadow:       0 24px 56px rgba(15, 23, 42, 0.16), 0 6px 16px rgba(15, 23, 42, 0.07);
  --ea-chat-radius:       22px;
  --ea-chat-z:            10050;
  --ea-font:              'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.ea-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--ea-chat-z);
  font-family: var(--ea-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   Bouton flottant (FAB)
   ========================================================================= */
.ea-chat-fab {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--ea-chat-primary) 0%, var(--ea-chat-primary-dark) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(227, 6, 19, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
}

.ea-chat-fab:hover {
  transform: scale(1.07);
  box-shadow: 0 12px 36px rgba(227, 6, 19, 0.5);
}

.ea-chat-fab:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.5);
  outline-offset: 3px;
}

.ea-chat-fab.is-open {
  transform: scale(0.94);
}

.ea-chat-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(227, 6, 19, 0.32);
  animation: ea-chat-pulse 2.6s ease-out infinite;
  pointer-events: none;
}

@keyframes ea-chat-pulse {
  0%   { transform: scale(1);    opacity: 0.8; }
  100% { transform: scale(1.38); opacity: 0;   }
}

.ea-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  background: #22c55e;
  border: 2px solid #fff;
  border-radius: 50%;
}

/* Mise en avant du FAB pendant l'info-bulle d'onboarding */
.ea-chat-fab.ea-chat-fab--hint-active {
  animation: ea-chat-fab-hint-bounce 2s ease-in-out infinite;
  box-shadow: 0 10px 36px rgba(227, 6, 19, 0.55), 0 0 0 4px rgba(99, 102, 241, 0.22);
}

@keyframes ea-chat-fab-hint-bounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* =========================================================================
   Info-bulle d'onboarding (pointe vers le FAB)
   ========================================================================= */
.ea-chat-fab-hint {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(292px, calc(100vw - 48px));
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1), visibility 0.35s;
}

.ea-chat-fab-hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ea-chat-fab-hint.is-leaving {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
}

.ea-chat-fab-hint-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px 14px 14px;
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.06);
  border-left: 3px solid var(--ea-chat-primary);
}

.ea-chat-fab-hint-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-right: 18px;
}

.ea-chat-fab-hint-avatar {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, #eef2ff 0%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ea-chat-fab-hint-online {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35);
  animation: ea-chat-hint-ping 2s ease-out infinite;
}

@keyframes ea-chat-hint-ping {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.ea-chat-fab-hint-text {
  flex: 1;
  min-width: 0;
}

.ea-chat-fab-hint-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ea-chat-text);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.ea-chat-fab-hint-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ea-chat-text-light);
}

.ea-chat-fab-hint-desc strong {
  color: var(--ea-chat-ai);
  font-weight: 600;
}

.ea-chat-fab-hint-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ea-chat-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.ea-chat-fab-hint-close:hover {
  background: var(--ea-chat-surface);
  color: var(--ea-chat-text);
}

.ea-chat-fab-hint-close:focus-visible {
  outline: 2px solid var(--ea-chat-ai);
  outline-offset: 2px;
}

/* Flèche pointant vers le bouton flottant */
.ea-chat-fab-hint-arrow {
  position: absolute;
  bottom: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 3px 3px 6px rgba(15, 23, 42, 0.08);
  border-right: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

@media (max-width: 480px) {
  .ea-chat-fab-hint {
    right: -4px;
    bottom: 72px;
    width: min(280px, calc(100vw - 32px));
  }

  .ea-chat-fab-hint-arrow {
    right: 18px;
  }
}

/* =========================================================================
   Panneau principal
   ========================================================================= */
.ea-chat-panel {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--ea-chat-bg);
  border-radius: var(--ea-chat-radius);
  box-shadow: var(--ea-chat-shadow);
  border: 1px solid var(--ea-chat-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.28s;
}

.ea-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* =========================================================================
   En-tête
   ========================================================================= */
.ea-chat-header {
  padding: 14px 18px;
  background: linear-gradient(140deg, #1a2236 0%, #2d3a54 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.ea-chat-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(99, 102, 241, 0.18) 0%, transparent 65%);
  pointer-events: none;
}

.ea-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--ea-chat-primary), var(--ea-chat-ai));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ea-chat-avatar--robot {
  background: #fff;
  padding: 3px;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.28);
}

.ea-chat-header-text {
  flex: 1;
  min-width: 0;
}

.ea-chat-header-text h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.ea-chat-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 4px 0 0;
  padding: 3px 9px 3px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  line-height: 1;
}

/* Point de statut "en ligne" */
.ea-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: ea-status-ping 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes ea-status-ping {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45); }
  50%       { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0);  }
}

.ea-chat-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ea-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Sprite SVG */
.ea-chat-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.ea-chat-robot-svg {
  display: block;
  flex-shrink: 0;
  animation: ea-robot-float 3.2s ease-in-out infinite;
  transform-origin: center center;
}

.ea-chat-robot-svg .ea-robot-eye-l,
.ea-chat-robot-svg .ea-robot-eye-r {
  animation: ea-robot-blink 4s ease-in-out infinite;
}

.ea-chat-robot-svg .ea-robot-eye-r {
  animation-delay: 0.12s;
}

@keyframes ea-robot-blink {
  0%, 42%, 44%, 100% { transform: scaleY(1);    }
  43%                 { transform: scaleY(0.12); }
}

.ea-chat-robot-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: ea-robot-float 3.2s ease-in-out infinite;
  transform-origin: center bottom;
}

.ea-chat-fab .ea-chat-fab-robot {
  animation: ea-robot-float 3.2s ease-in-out infinite, ea-robot-glow 2.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}

.ea-chat-robot-svg--msg {
  width: 100%;
  height: 100%;
}

.ea-chat-msg--bot .ea-chat-msg-avatar {
  background: #fff;
  padding: 2px;
  overflow: visible;
  border: 1px solid rgba(99, 102, 241, 0.18);
}

.ea-chat-robot-img--msg {
  border-radius: 6px;
}

@keyframes ea-robot-float {
  0%, 100% { transform: translateY(0)    rotate(0deg);  }
  30%       { transform: translateY(-4px) rotate(-3deg); }
  70%       { transform: translateY(-2px) rotate(3deg);  }
}

@keyframes ea-robot-glow {
  0%, 100% { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));           }
  50%       { filter: drop-shadow(0 4px 12px rgba(99,102,241,0.45));    }
}

/* =========================================================================
   Zone de messages
   ========================================================================= */
.ea-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--ea-chat-surface);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.2) transparent;
}

.ea-chat-messages::-webkit-scrollbar        { width: 4px; }
.ea-chat-messages::-webkit-scrollbar-track  { background: transparent; }
.ea-chat-messages::-webkit-scrollbar-thumb  { background: rgba(99,102,241,0.22); border-radius: 4px; }

.ea-chat-msg {
  display: flex;
  gap: 9px;
  max-width: 94%;
  animation: ea-chat-msg-in 0.32s ease;
}

@keyframes ea-chat-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.ea-chat-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ea-chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.ea-chat-msg--bot .ea-chat-msg-avatar {
  background: linear-gradient(135deg, var(--ea-chat-ai), var(--ea-chat-ai-light));
  color: #fff;
}

.ea-chat-msg--user .ea-chat-msg-avatar {
  background: var(--ea-chat-primary);
  color: #fff;
}

/* Bulle — base */
.ea-chat-bubble {
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: break-word;
  font-family: var(--ea-font);
}

/* Bulle bot */
.ea-chat-msg--bot .ea-chat-bubble {
  background: #fff;
  color: var(--ea-chat-text);
  border: 1px solid var(--ea-chat-border);
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

/* Bulle utilisateur */
.ea-chat-msg--user .ea-chat-bubble {
  background: linear-gradient(140deg, var(--ea-chat-primary) 0%, var(--ea-chat-primary-dark) 100%);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 8px rgba(227,6,19,0.22);
}

/* Typographie dans les bulles */
.ea-chat-bubble p          { margin: 0 0 0.55em; }
.ea-chat-bubble p:last-child { margin-bottom: 0; }

.ea-chat-bubble ul,
.ea-chat-bubble ol {
  margin: 0.45em 0;
  padding-left: 1.25em;
}

.ea-chat-bubble li {
  margin-bottom: 0.25em;
  line-height: 1.55;
}

.ea-chat-bubble li:last-child { margin-bottom: 0; }

.ea-chat-bubble strong {
  font-weight: 700;
  color: inherit;
}

.ea-chat-msg--bot .ea-chat-bubble strong {
  color: var(--ea-chat-text);
}

.ea-chat-bubble em {
  font-style: italic;
  opacity: 0.88;
}

.ea-chat-bubble a {
  color: var(--ea-chat-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: opacity 0.15s;
}

.ea-chat-bubble a:hover { opacity: 0.75; }

.ea-chat-msg--user .ea-chat-bubble a {
  color: rgba(255,255,255,0.9);
}

/* Tableaux markdown dans les bulles bot */
.ea-chat-bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 0.5em 0;
}

.ea-chat-bubble th,
.ea-chat-bubble td {
  padding: 6px 10px;
  border: 1px solid var(--ea-chat-border);
  text-align: left;
  line-height: 1.4;
}

.ea-chat-bubble th {
  background: var(--ea-chat-surface);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ea-chat-text-light);
}

.ea-chat-bubble tr:nth-child(even) td {
  background: rgba(99,102,241,0.03);
}

/* Séparateur horizontal dans les bulles */
.ea-chat-bubble hr {
  border: none;
  border-top: 1px solid var(--ea-chat-border);
  margin: 0.7em 0;
}

/* Slogan en italique (clôture Odile) */
.ea-chat-bubble em:last-child {
  display: block;
  margin-top: 0.55em;
  font-size: 0.8rem;
  color: var(--ea-chat-muted);
  font-style: italic;
}

.ea-chat-msg--user .ea-chat-bubble em:last-child {
  color: rgba(255,255,255,0.75);
}

/* Horodatage discret */
.ea-chat-msg-time {
  font-size: 0.65rem;
  color: var(--ea-chat-muted);
  margin-top: 3px;
  padding: 0 4px;
  opacity: 0.7;
  align-self: flex-end;
  white-space: nowrap;
}

/* =========================================================================
   Suggestions rapides
   ========================================================================= */
.ea-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 12px;
  background: var(--ea-chat-surface);
}

.ea-chat-chip {
  font-family: var(--ea-font);
  font-size: 0.77rem;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--ea-chat-border);
  background: #fff;
  color: var(--ea-chat-text-light);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.15s;
  line-height: 1.3;
}

.ea-chat-chip:hover {
  border-color: var(--ea-chat-primary);
  background: rgba(227, 6, 19, 0.04);
  color: var(--ea-chat-primary);
  transform: translateY(-1px);
}

/* =========================================================================
   Indicateur "Odile réfléchit…"
   ========================================================================= */
.ea-chat-thinking {
  margin-bottom: 10px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: max-height 0.35s ease, opacity 0.28s ease, transform 0.28s ease;
}

.ea-chat-thinking:not([hidden]) {
  max-height: 60px;
  opacity: 1;
  transform: translateY(0);
}

.ea-chat-thinking-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.09) 0%,
    rgba(227, 6, 19, 0.05) 50%,
    rgba(99, 102, 241, 0.07) 100%
  );
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.07);
}

.ea-chat-thinking-spinner {
  position: relative;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.ea-chat-thinking-orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--ea-chat-ai);
  border-right-color: var(--ea-chat-primary);
  animation: ea-thinking-spin 0.85s linear infinite;
}

.ea-chat-thinking-core {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #a5b4fc, var(--ea-chat-ai));
  animation: ea-thinking-pulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.ea-chat-thinking-label {
  font-family: var(--ea-font);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #6366f1 0%, #e30613 45%, #6366f1 90%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ea-thinking-shimmer 2.2s linear infinite;
  transition: opacity 0.25s ease;
}

.ea-chat-thinking-label.is-changing { opacity: 0.35; }

@keyframes ea-thinking-spin    { to { transform: rotate(360deg); } }
@keyframes ea-thinking-pulse   { 0%, 100% { transform: scale(0.88); opacity: 0.75; } 50% { transform: scale(1); opacity: 1; } }
@keyframes ea-thinking-shimmer { to { background-position: 220% center; } }

/* =========================================================================
   Zone de saisie
   ========================================================================= */
.ea-chat-input-wrap {
  padding: 11px 14px 13px;
  background: #fff;
  border-top: 1px solid var(--ea-chat-border);
  flex-shrink: 0;
  transition: box-shadow 0.3s ease;
}

.ea-chat-input-wrap.is-thinking {
  box-shadow: inset 0 8px 24px rgba(99, 102, 241, 0.05);
}

.ea-chat-input-wrap.is-thinking .ea-chat-input {
  border: 1px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(99,102,241,0.25), rgba(227,6,19,0.15)) border-box;
}

.ea-chat-input-wrap.is-thinking .ea-chat-send {
  background: linear-gradient(135deg, var(--ea-chat-ai), var(--ea-chat-ai-light));
  pointer-events: none;
}

.ea-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ea-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--ea-chat-border);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: var(--ea-font);
  line-height: 1.5;
  max-height: 120px;
  min-height: 44px;
  color: var(--ea-chat-text);
  background: var(--ea-chat-surface);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.ea-chat-input::placeholder {
  color: var(--ea-chat-muted);
  font-style: italic;
}

.ea-chat-input:focus {
  outline: none;
  border-color: var(--ea-chat-ai);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ea-chat-send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ea-chat-primary), var(--ea-chat-primary-dark));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  transition: background 0.2s, transform 0.18s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(227,6,19,0.3);
}

.ea-chat-send:hover:not(:disabled) {
  transform: scale(1.06) translateY(-1px);
  box-shadow: 0 5px 16px rgba(227,6,19,0.38);
}

.ea-chat-send:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  box-shadow: none;
}

.ea-chat-send-spinner {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ea-thinking-spin 0.7s linear infinite;
}

/* =========================================================================
   Bouton pièce jointe
   ========================================================================= */
.ea-chat-attach-btn {
  width: 36px;
  height: 44px;
  border: none;
  background: none;
  color: var(--ea-chat-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 10px;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
  padding: 0;
}

.ea-chat-attach-btn:hover {
  color: var(--ea-chat-ai);
  background: rgba(99, 102, 241, 0.07);
}

.ea-chat-attach-btn.has-attachment { color: var(--ea-chat-ai); }
.ea-chat-attach-btn:disabled       { opacity: 0.35; cursor: not-allowed; }

/* Prévisualisation pièce jointe */
.ea-chat-attach-preview  { margin-bottom: 8px; }

.ea-chat-attach-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f1f5f9;
  border: 1px solid var(--ea-chat-border);
  border-radius: 12px;
}

.ea-chat-attach-thumb {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--ea-chat-border);
}

.ea-chat-attach-icon {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #64748b;
  flex-shrink: 0;
}

.ea-chat-attach-info { flex: 1; min-width: 0; }

.ea-chat-attach-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ea-chat-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ea-chat-attach-size {
  font-size: 0.67rem;
  color: var(--ea-chat-muted);
  margin-top: 2px;
}

.ea-chat-attach-remove {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(100,116,139,0.12);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  padding: 0;
}

.ea-chat-attach-remove:hover {
  background: rgba(227,6,19,0.12);
  color: var(--ea-chat-primary);
}

/* Pièce jointe dans la bulle utilisateur */
.ea-chat-msg-attach      { margin-bottom: 6px; }

.ea-chat-msg-attach-img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 9px;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s;
  border: 1px solid rgba(255,255,255,0.28);
}

.ea-chat-msg-attach-img:hover { opacity: 0.88; }

.ea-chat-msg-attach-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 5px 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 8px;
}

.ea-chat-user-text { margin: 0; }

/* Drag & drop overlay */
.ea-chat-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.09);
  border: 2px dashed var(--ea-chat-ai);
  border-radius: var(--ea-chat-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
  color: var(--ea-chat-ai);
  font-size: 0.9rem;
  font-weight: 600;
  backdrop-filter: blur(3px);
}

.ea-chat-drop-overlay i { font-size: 2.2rem; }

.ea-chat-panel.is-dragging .ea-chat-drop-overlay { opacity: 1; }

/* =========================================================================
   Mobile plein écran
   ========================================================================= */
@media (max-width: 480px) {
  .ea-chat-root  { right: 12px; bottom: 12px; }

  .ea-chat-panel {
    position: fixed;
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%; max-width: none;
    height: 100%; max-height: none;
    border-radius: 0;
    transform: translateY(100%);
  }

  .ea-chat-panel.is-open        { transform: translateY(0); }
  .ea-chat-fab.is-open          { display: none; }
}

/* =========================================================================
   Fin de session / inactivité
   ========================================================================= */

/* Marqueur séparateur dans le fil de messages */
.ea-chat-session-end {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  padding: 10px 20px;
  margin: 8px 0 2px;
  position: relative;
}
.ea-chat-session-end::before,
.ea-chat-session-end::after {
  content: '';
  display: inline-block;
  width: 28%;
  height: 1px;
  background: #e2e8f0;
  vertical-align: middle;
  margin: 0 8px;
}

/* Bandeau bas de panneau */
.ea-chat-ended-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #fffbeb 0%, #fef9c3 100%);
  border-top: 1px solid #fde68a;
  font-size: 12.5px;
  color: #92400e;
  flex-wrap: wrap;
}
.ea-chat-ended-icon {
  font-size: 15px;
  flex-shrink: 0;
}
.ea-chat-ended-msg {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ea-chat-new-conv-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: #1a2236;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.ea-chat-new-conv-btn:hover  { background: #e30613; }
.ea-chat-new-conv-btn:active { transform: scale(0.97); }

/* Zone de saisie désactivée pendant la session expirée */
.ea-chat-input-row--disabled {
  opacity: 0.38;
  pointer-events: none;
  user-select: none;
}

/* =========================================================================
   Réduction de mouvement
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .ea-chat-fab-pulse,
  .ea-chat-panel,
  .ea-chat-msg,
  .ea-chat-thinking-orbit,
  .ea-chat-thinking-core,
  .ea-chat-thinking-label,
  .ea-chat-send-spinner,
  .ea-chat-robot-img,
  .ea-chat-robot-svg,
  .ea-chat-fab-robot,
  .ea-chat-status-dot,
  .ea-chat-fab.ea-chat-fab--hint-active,
  .ea-chat-fab-hint-online {
    animation: none;
    transition: none;
  }

  .ea-chat-thinking,
  .ea-chat-fab-hint {
    transition: none;
  }
}
