/* ============================================================================
   Chatbot support ProbWin — widget scripté (FAQ à boutons + fallback conseiller)
   Palette site : obsidienne / or / DM Sans. Prototype validé 16/07/2026
   (docs/pro_screenshots/prototype/chatbot-widget.html).
   Mobile : FAB à bottom:86px (au-dessus de la tab bar), panneau plein écran.
   ========================================================================== */

:root {
  --pwbot-bg: #0E141D;
  --pwbot-bg-soft: #131B26;
  --pwbot-border: rgba(255, 255, 255, 0.12);
  --pwbot-border-weak: rgba(255, 255, 255, 0.08);
  --pwbot-gold: #FBBF24;
  --pwbot-gold-deep: #F59E0B;
  --pwbot-text: #E6EAF2;
  --pwbot-muted: #94A3B8;
}

/* ── FAB : bulle de chat + renard ────────────────────────────────── */
@keyframes pwbot-pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pwbot-halo {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 0 rgba(251,191,36,.4); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 12px rgba(251,191,36,0); }
}
.pwbot-fab {
  position: fixed; right: 16px; bottom: 20px; z-index: 8900;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 12px; cursor: pointer;
  border-radius: 22px 22px 5px 22px; /* pointe bas-droite = bulle de chat */
  background: var(--pwbot-bg-soft);
  border: 1.5px solid var(--pwbot-gold);
  color: var(--pwbot-gold); font-family: 'DM Sans', 'Inter', sans-serif;
  font-size: .92rem; font-weight: 700;
  animation: pwbot-pop .5s cubic-bezier(.34,1.56,.64,1) 1.2s backwards,
             pwbot-halo 2.8s ease-in-out 2.4s infinite;
  transition: transform .18s ease;
}
.pwbot-fab:hover { transform: translateY(-2px) scale(1.03); }
/* Renard doré : même filtre que .nav-logo img (le SVG source est sombre) */
.pwbot-fab img, .pwbot-avatar img {
  filter: brightness(0) saturate(100%) invert(85%) sepia(50%) saturate(500%) hue-rotate(5deg);
}
.pwbot-fab img { width: 27px; height: 27px; display: block; }
@media (max-width: 768px) {
  /* Mobile : bulle compacte logo seul (le label prend trop de place à l'écran) */
  .pwbot-fab { bottom: 86px; right: 14px; padding: 11px; }
  .pwbot-fab .pwbot-fab-label { display: none; }
  .pwbot-fab img { width: 32px; height: 32px; }
}
body.pwbot-open .pwbot-fab { display: none; }
/* Ne pas gêner le chat live : sur /live/ le FAB chat-live occupe déjà ce coin */
body.pwchat-active .pwbot-fab { display: none; }

/* ── Panneau ─────────────────────────────────────────────────────── */
@keyframes pwbot-rise { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }
.pwbot-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 9100;
  width: 376px; height: min(600px, calc(100vh - 96px));
  display: none; flex-direction: column; overflow: hidden;
  background: radial-gradient(500px 180px at 50% -50px, rgba(251,191,36,.06), transparent 70%), var(--pwbot-bg);
  border: 1px solid var(--pwbot-border); border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  font-family: 'DM Sans', 'Inter', sans-serif;
}
body.pwbot-open .pwbot-panel { display: flex; animation: pwbot-rise .3s cubic-bezier(.21,1.02,.55,1); }
@media (max-width: 768px) {
  .pwbot-panel { right: 0; left: 0; bottom: 0; top: 0; width: auto; height: auto; border-radius: 0; border: none; }
}

.pwbot-head {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  border-bottom: 1px solid var(--pwbot-border-weak); background: rgba(251,191,36,.04);
}
.pwbot-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: #0B0F14; border: 1.5px solid var(--pwbot-gold);
}
.pwbot-avatar img { width: 26px; height: 26px; display: block; }
.pwbot-head-txt { flex: 1; min-width: 0; }
.pwbot-head-txt strong { display: block; font-size: .95rem; color: var(--pwbot-text); }
.pwbot-head-txt span { display: block; font-size: .74rem; color: var(--pwbot-muted); margin-top: 1px; }
.pwbot-close {
  border: none; background: none; color: var(--pwbot-muted);
  cursor: pointer; font-size: 1.25rem; line-height: 1; padding: 6px;
}
.pwbot-close:hover { color: var(--pwbot-text); }

/* ── Conversation ────────────────────────────────────────────────── */
.pwbot-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
@keyframes pwbot-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.pwbot-msg, .pwbot-choices, .pwbot-form { animation: pwbot-in .26s ease both; }
.pwbot-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .87rem; line-height: 1.55; color: var(--pwbot-text); }
.pwbot-msg.bot { align-self: flex-start; background: var(--pwbot-bg-soft); border: 1px solid var(--pwbot-border-weak); border-bottom-left-radius: 4px; }
.pwbot-msg.user { align-self: flex-end; background: rgba(251,191,36,.14); border: 1px solid rgba(251,191,36,.25); border-bottom-right-radius: 4px; }
.pwbot-msg p { margin: 0; }
.pwbot-msg p + p { margin-top: 8px; }
.pwbot-msg ol, .pwbot-msg ul { margin: 8px 0 0 18px; padding: 0; }
.pwbot-msg li + li { margin-top: 4px; }
.pwbot-msg strong { color: var(--pwbot-gold); font-weight: 700; }
.pwbot-msg .pwbot-note { display: block; margin-top: 8px; font-size: .76rem; color: var(--pwbot-muted); }

.pwbot-typing {
  align-self: flex-start; display: inline-flex; gap: 5px; padding: 13px 15px;
  background: var(--pwbot-bg-soft); border: 1px solid var(--pwbot-border-weak);
  border-radius: 14px; border-bottom-left-radius: 4px; animation: pwbot-in .2s ease both;
}
.pwbot-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--pwbot-gold); opacity: .3; animation: pwbot-blink 1s infinite; }
.pwbot-typing i:nth-child(2) { animation-delay: .15s; }
.pwbot-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pwbot-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ── Chips ───────────────────────────────────────────────────────── */
.pwbot-choices { display: flex; flex-direction: column; gap: 7px; align-self: stretch; padding: 2px 2px 0; }
.pwbot-chip {
  display: flex; align-items: center; gap: 9px; text-align: left;
  padding: 10px 13px; border-radius: 11px; cursor: pointer;
  background: transparent; border: 1px solid var(--pwbot-border);
  color: var(--pwbot-text); font-family: inherit; font-size: .86rem; font-weight: 500;
}
.pwbot-chip:hover { border-color: var(--pwbot-gold); background: rgba(251,191,36,.07); }
.pwbot-chip .pwbot-ico { flex: none; width: 20px; text-align: center; }
.pwbot-chip.back { border-style: dashed; color: var(--pwbot-muted); font-size: .8rem; justify-content: center; }
.pwbot-chip.back:hover { color: var(--pwbot-text); }
.pwbot-chip.warn { border-color: rgba(239,68,68,.4); }
.pwbot-chip.warn:hover { border-color: #EF4444; background: rgba(239,68,68,.07); }

.pwbot-cta {
  display: inline-block; margin-top: 10px; padding: 9px 16px; border-radius: 999px;
  background: linear-gradient(135deg, var(--pwbot-gold), var(--pwbot-gold-deep));
  color: #0B0F14 !important; font-weight: 700; font-size: .84rem; text-decoration: none;
}

/* ── Formulaire fallback ─────────────────────────────────────────── */
.pwbot-form {
  display: flex; flex-direction: column; gap: 9px; align-self: stretch;
  background: var(--pwbot-bg-soft); border: 1px solid var(--pwbot-border-weak);
  border-radius: 14px; padding: 13px;
}
.pwbot-form label { font-size: .76rem; color: var(--pwbot-muted); font-weight: 500; }
.pwbot-form label em { font-style: normal; color: #16A34A; }
.pwbot-form input, .pwbot-form textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--pwbot-border);
  background: #0B0F14; color: var(--pwbot-text); font-family: inherit; font-size: .86rem;
}
.pwbot-form input:focus, .pwbot-form textarea:focus { outline: none; border-color: var(--pwbot-gold); }
.pwbot-form textarea { min-height: 84px; resize: vertical; }
.pwbot-form button {
  padding: 11px; border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--pwbot-gold), var(--pwbot-gold-deep));
  color: #0B0F14; font-family: inherit; font-weight: 700; font-size: .88rem;
}
.pwbot-form button[disabled] { opacity: .6; cursor: wait; }
.pwbot-form .pwbot-rgpd { font-size: .7rem; color: var(--pwbot-muted); line-height: 1.4; }
/* Honeypot : hors écran, jamais display:none (les bots vérifient) */
.pwbot-form .pwbot-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.pwbot-foot {
  padding: 9px 14px; border-top: 1px solid var(--pwbot-border-weak);
  text-align: center; font-size: .7rem; color: var(--pwbot-muted);
}
.pwbot-foot .pwbot-dot { color: #16A34A; }
