/* =====================================================================
   eSoucoulou — Assistant IA (v2.1)
   Bulle flottante en bas à gauche (le bouton WhatsApp occupe la droite).
   ===================================================================== */

.eso-assistant { position: fixed; left: 20px; bottom: 20px; z-index: 9997; }

/* ---- Lanceur ---- */
.eso-asst__launcher {
  display: inline-flex; align-items: center; gap: 10px;
  border: none; cursor: pointer;
  padding: 13px 20px 13px 16px; border-radius: 999px;
  background: linear-gradient(135deg, #1aaf1a, #0d6b0d); color: #fff;
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  box-shadow: 0 14px 32px -10px rgba(26,175,26,0.65), 0 4px 10px rgba(0,0,0,0.12);
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), box-shadow 0.25s, filter 0.2s;
}
.eso-asst__launcher svg { flex-shrink: 0; }
.eso-asst__launcher:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 18px 40px -12px rgba(26,175,26,0.7); }
.eso-asst__launcher:active { transform: scale(0.97); }
.eso-asst__launcher::after { /* pastille « en ligne » */
  content: ''; position: absolute; top: 8px; right: 12px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #7CFC7C; box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}
.eso-assistant[data-state="open"] .eso-asst__launcher { opacity: 0; pointer-events: none; transform: scale(0.9); }

/* ---- Panneau ---- */
.eso-asst__panel {
  position: absolute; left: 0; bottom: 0;
  width: min(390px, calc(100vw - 40px)); height: min(620px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 22px;
  border: 1px solid var(--eso-gray-100, #eef1ee);
  box-shadow: 0 40px 90px -30px rgba(13,107,13,0.4), 0 10px 30px rgba(0,0,0,0.12);
  opacity: 0; transform: translateY(16px) scale(0.98); pointer-events: none;
  transform-origin: bottom left;
  transition: opacity 0.28s cubic-bezier(.16,1,.3,1), transform 0.28s cubic-bezier(.16,1,.3,1);
}
.eso-assistant[data-state="open"] .eso-asst__panel { opacity: 1; transform: none; pointer-events: auto; }

/* En-tête */
.eso-asst__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #1aaf1a 0%, #0d6b0d 100%);
  position: relative;
}
.eso-asst__head::after { /* trame hexagonale discrète */
  content: ''; position: absolute; inset: 0; opacity: 0.5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='35' viewBox='0 0 40 35'%3E%3Cpath d='M20 0l17 10v15L20 35 3 25V10z' fill='none' stroke='%23ffffff' stroke-opacity='0.12' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 40px 35px;
}
.eso-asst__id { display: flex; align-items: center; gap: 11px; position: relative; z-index: 1; }
.eso-asst__avatar {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.3);
}
.eso-asst__name { display: flex; flex-direction: column; font-weight: 800; font-size: 1rem; line-height: 1.1; }
.eso-asst__name small { font-weight: 500; font-size: 0.72rem; opacity: 0.9; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.eso-asst__name small::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #7CFC7C; box-shadow: 0 0 6px #7CFC7C; }
.eso-asst__close {
  position: relative; z-index: 1; background: rgba(255,255,255,0.14); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 10px; font-size: 1.4rem; line-height: 1; cursor: pointer;
  transition: background 0.2s;
}
.eso-asst__close:hover { background: rgba(255,255,255,0.28); }

/* Corps / messages */
.eso-asst__body {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, #f7fbf7, #ffffff);
  scroll-behavior: smooth;
}
.eso-asst__msg { display: flex; max-width: 86%; }
.eso-asst__msg--user { align-self: flex-end; }
.eso-asst__msg--assistant { align-self: flex-start; }
.eso-asst__bubble {
  padding: 11px 15px; border-radius: 16px; font-size: 0.92rem; line-height: 1.55;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.eso-asst__msg--assistant .eso-asst__bubble {
  background: #fff; color: var(--eso-black, #0a0a0a);
  border: 1px solid var(--eso-gray-100, #eef1ee); border-bottom-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(13,107,13,0.05);
}
.eso-asst__msg--user .eso-asst__bubble {
  background: linear-gradient(135deg, #1aaf1a, #0d6b0d); color: #fff; border-bottom-right-radius: 5px;
}
.eso-asst__bubble a { color: var(--eso-green-dark, #0d6b0d); font-weight: 600; text-decoration: underline; }
.eso-asst__msg--user .eso-asst__bubble a { color: #fff; }
.eso-asst__bubble ul, .eso-asst__bubble ol { margin: 6px 0; padding-left: 20px; }
.eso-asst__bubble li { margin: 3px 0; }
.eso-asst__bubble strong { font-weight: 700; }

/* Indicateur de saisie */
.eso-asst__typing .eso-asst__bubble { display: flex; gap: 5px; padding: 14px 16px; }
.eso-asst__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--eso-green, #1aaf1a); opacity: 0.5; animation: esoAsstDot 1s infinite; }
.eso-asst__typing span:nth-child(2) { animation-delay: 0.15s; }
.eso-asst__typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes esoAsstDot { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Suggestions rapides */
.eso-asst__quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 6px; }
.eso-asst__quick:empty { display: none; }
.eso-asst__chip {
  border: 1px solid var(--eso-green-light, #6fcf6f); background: var(--eso-green-pale, #eafaea);
  color: var(--eso-green-dark, #0d6b0d); font-weight: 600; font-size: 0.82rem; font-family: inherit;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: all 0.2s;
}
.eso-asst__chip:hover { background: var(--eso-green, #1aaf1a); color: #fff; border-color: transparent; transform: translateY(-1px); }

/* Saisie */
.eso-asst__form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--eso-gray-100, #eef1ee); background: #fff; }
.eso-asst__input {
  flex: 1; border: 1px solid var(--eso-gray-200, #e2e6e2); border-radius: 999px;
  padding: 12px 16px; font-size: 0.92rem; font-family: inherit; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.eso-asst__input:focus { border-color: var(--eso-green, #1aaf1a); box-shadow: 0 0 0 3px rgba(26,175,26,0.15); }
.eso-asst__send {
  flex-shrink: 0; width: 46px; height: 46px; border: none; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #1aaf1a, #0d6b0d);
  box-shadow: 0 8px 18px -8px rgba(26,175,26,0.6); transition: transform 0.2s, filter 0.2s;
}
.eso-asst__send:hover { transform: scale(1.06); filter: brightness(1.05); }
.eso-asst__send:active { transform: scale(0.95); }

/* ---- Version intégrée (shortcode) ---- */
.eso-asst__panel.is-inline {
  position: relative; left: auto; bottom: auto;
  width: 100%; max-width: 720px; height: 600px; margin: 0 auto;
  opacity: 1; transform: none; pointer-events: auto;
}

/* ---- Mobile : panneau quasi plein écran ---- */
@media (max-width: 540px) {
  .eso-assistant { left: 14px; bottom: 14px; }
  .eso-asst__launcher-label { display: none; }
  .eso-asst__launcher { padding: 14px; }
  .eso-asst__panel {
    position: fixed; left: 0; bottom: 0; right: 0;
    width: 100vw; height: 88vh; height: 88dvh;
    border-radius: 22px 22px 0 0; transform-origin: bottom center;
  }
}

/* ---- Mouvement réduit ---- */
@media (prefers-reduced-motion: reduce) {
  .eso-asst__launcher, .eso-asst__panel, .eso-asst__send, .eso-asst__chip { transition: none !important; }
  .eso-asst__typing span { animation: none !important; opacity: 0.6; }
}
