/* ════════════════════════════════════════════════════════════
   Assistant Boturea (bot de conversation) — bulle en bas à gauche
   ════════════════════════════════════════════════════════════ */

.bbot-launcher {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold, #01dbff), var(--gold-dark, #00b8d9));
  color: #04222a;
  box-shadow: 0 8px 24px rgba(0, 150, 180, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.bbot-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(0, 150, 180, 0.45); }
.bbot-launcher:focus-visible { outline: 3px solid var(--black, #111); outline-offset: 3px; }

.bbot-ico {
  position: absolute;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.bbot-ico--close { opacity: 0; transform: rotate(-60deg) scale(0.6); }
.bbot-launcher.is-open .bbot-ico--chat { opacity: 0; transform: rotate(60deg) scale(0.6); }
.bbot-launcher.is-open .bbot-ico--close { opacity: 1; transform: none; }

/* ─── Fenêtre ────────────────────────────────────────────────── */
.bbot-panel {
  position: fixed;
  left: 20px;
  bottom: 88px;
  z-index: 9991;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--white, #fff);
  border: 1px solid var(--border, #e5e5e7);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  font-family: var(--font-body, system-ui, sans-serif);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom left;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bbot-panel[hidden] { display: none; }
.bbot-panel.is-open { opacity: 1; transform: none; }

.bbot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #111112;
  color: #fff;
}
.bbot-head__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bbot-head__title { font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.bbot-head__sub { font-size: 0.74rem; color: #a1a1a6; line-height: 1.3; }
.bbot-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bbot-close:hover { background: rgba(255, 255, 255, 0.16); }
.bbot-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ─── Messages ───────────────────────────────────────────────── */
.bbot-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--gray, #f5f5f7);
  overscroll-behavior: contain;
}
.bbot-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.bbot-msg--bot {
  align-self: flex-start;
  background: var(--white, #fff);
  color: var(--black, #1d1d1f);
  border: 1px solid var(--border, #e5e5e7);
  border-bottom-left-radius: 4px;
}
.bbot-msg--user {
  align-self: flex-end;
  background: var(--gold-dark, #00b8d9);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bbot-msg.is-typing { color: var(--muted, #6e6e73); letter-spacing: 0.2em; }

/* ─── Choix ──────────────────────────────────────────────────── */
.bbot-options {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 14px;
  max-height: 46%;
  overflow-y: auto;
  border-top: 1px solid var(--border, #e5e5e7);
  background: var(--white, #fff);
}
.bbot-options:empty { display: none; }
.bbot-opt {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1.5px solid var(--gold-dark, #00b8d9);
  border-radius: 999px;
  background: var(--white, #fff);
  color: var(--gold-dark, #007f96);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.bbot-opt:hover { background: var(--gold-dark, #00b8d9); color: #fff; }
.bbot-opt:focus-visible { outline: 2px solid var(--black, #111); outline-offset: 2px; }
.bbot-opt.is-wa { border-color: #1faa59; color: #157a41; }
.bbot-opt.is-wa:hover { background: #1faa59; color: #fff; }

/* ─── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .bbot-launcher { left: 14px; bottom: 14px; width: 52px; height: 52px; }
  .bbot-panel { left: 12px; right: 12px; width: auto; max-width: none; bottom: 78px; height: min(560px, calc(100vh - 100px)); }
  /* Le bandeau de devise occupe le bas de l'écran : on remonte la bulle. */
  body:has(.bcur-banner) .bbot-launcher { bottom: 112px; }
  body:has(.bcur-banner) .bbot-panel { bottom: 176px; height: min(500px, calc(100vh - 200px)); }
}

@media (prefers-reduced-motion: reduce) {
  .bbot-panel, .bbot-launcher, .bbot-ico { transition: none; }
}
