/* Assistant IA — widget public */

#fba-root{
  --fba-primary:#0A5C36;
  --fba-accent:#D9A41A;
  --fba-offset-x:24px;
  --fba-offset-y:24px;
  --fba-ink:#16201A;
  --fba-muted:#6C7A6E;
  --fba-line:#E3E1D8;
  --fba-bg:#FFFFFF;
  --fba-soft:#F5F4EF;
  --fba-radius:14px;
  --fba-shadow:0 24px 56px -22px rgba(10,30,20,.45);
  position:fixed; z-index:99990; bottom:var(--fba-offset-y);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:15px; line-height:1.55; color:var(--fba-ink);
}
#fba-root.fba-right{ right:var(--fba-offset-x); }
#fba-root.fba-left{ left:var(--fba-offset-x); }
#fba-root *,#fba-root *::before,#fba-root *::after{ box-sizing:border-box; }

/* ---------- bulle flottante ---------- */
.fba-bubble{
  width:60px; height:60px; border-radius:50%; border:0; cursor:pointer;
  background:var(--fba-primary); color:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow:0 14px 30px -10px rgba(10,30,20,.55); position:relative;
  transition:transform .22s cubic-bezier(.2,.7,.2,1), box-shadow .22s;
}
#fba-root.fba-left .fba-bubble{ margin-right:auto; }
.fba-bubble:hover{ transform:translateY(-3px) scale(1.04); box-shadow:0 20px 38px -12px rgba(10,30,20,.6); }
.fba-bubble:focus-visible{ outline:3px solid var(--fba-accent); outline-offset:3px; }
.fba-bubble svg{ width:27px; height:27px; }
.fba-bubble img{ width:100%; height:100%; border-radius:50%; object-fit:cover; }
.fba-bubble .fba-close-ic{ display:none; }
#fba-root.fba-open .fba-bubble .fba-open-ic{ display:none; }
#fba-root.fba-open .fba-bubble .fba-close-ic{ display:block; }
.fba-dot{
  position:absolute; top:2px; right:2px; width:14px; height:14px; border-radius:50%;
  background:var(--fba-accent); border:2px solid #fff;
}
#fba-root.fba-open .fba-dot,#fba-root.fba-seen .fba-dot{ display:none; }

/* ---------- panneau ---------- */
.fba-panel{
  position:absolute; bottom:74px; width:380px; max-width:calc(100vw - 32px);
  height:min(620px, calc(100vh - 140px));
  background:var(--fba-bg); border-radius:var(--fba-radius); box-shadow:var(--fba-shadow);
  display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--fba-line);
  opacity:0; visibility:hidden; transform:translateY(14px) scale(.98);
  transition:opacity .22s, transform .26s cubic-bezier(.2,.7,.2,1), visibility .22s;
}
#fba-root.fba-right .fba-panel{ right:0; }
#fba-root.fba-left  .fba-panel{ left:0; }
#fba-root.fba-open .fba-panel{ opacity:1; visibility:visible; transform:none; }

/* en-tête */
.fba-head{
  background:var(--fba-primary); color:#fff; padding:14px 16px; display:flex; align-items:center; gap:11px;
}
.fba-head .fba-av{
  width:38px; height:38px; border-radius:50%; background:rgba(255,255,255,.16);
  display:flex; align-items:center; justify-content:center; flex:none; overflow:hidden;
}
.fba-head .fba-av img{ width:100%; height:100%; object-fit:cover; }
.fba-head .fba-av svg{ width:20px; height:20px; }
.fba-head .fba-id{ flex:1; min-width:0; }
.fba-head .fba-nm{ font-weight:700; font-size:15px; line-height:1.2; }
.fba-head .fba-st{ font-size:11.5px; opacity:.85; display:flex; align-items:center; gap:5px; margin-top:2px; }
.fba-head .fba-st i{ width:7px; height:7px; border-radius:50%; background:#6EE7A8; display:block; }
.fba-head button{
  background:rgba(255,255,255,.12); border:0; color:#fff; width:30px; height:30px; border-radius:7px;
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex:none; padding:0;
  transition:background .18s;
}
.fba-head button:hover{ background:rgba(255,255,255,.26); }
.fba-head button svg{ width:16px; height:16px; }

/* fil de discussion */
.fba-log{ flex:1; overflow-y:auto; padding:16px; background:var(--fba-soft); scroll-behavior:smooth; }
.fba-msg{ display:flex; gap:9px; margin-bottom:12px; align-items:flex-end; }
.fba-msg .fba-mav{
  width:28px; height:28px; border-radius:50%; background:var(--fba-primary); color:#fff; flex:none;
  display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.fba-msg .fba-mav svg{ width:15px; height:15px; }
.fba-msg .fba-mav img{ width:100%; height:100%; object-fit:cover; }
.fba-bub{
  background:#fff; border:1px solid var(--fba-line); border-radius:4px 14px 14px 14px;
  padding:10px 13px; max-width:82%; font-size:14.5px; box-shadow:0 2px 6px -4px rgba(0,0,0,.18);
  overflow-wrap:anywhere;
}
.fba-msg.fba-me{ flex-direction:row-reverse; }
.fba-msg.fba-me .fba-bub{
  background:var(--fba-primary); color:#fff; border-color:var(--fba-primary);
  border-radius:14px 4px 14px 14px;
}
.fba-msg.fba-me .fba-mav{ background:var(--fba-accent); color:#2A1F00; }

/* liens proposés */
.fba-links{ margin-top:9px; padding-top:9px; border-top:1px dashed var(--fba-line); }
.fba-links .fba-lt{
  font-size:10.5px; letter-spacing:.09em; text-transform:uppercase; color:var(--fba-muted);
  font-weight:700; margin-bottom:5px;
}
.fba-links a{
  display:flex; align-items:center; gap:6px; color:var(--fba-primary); text-decoration:none;
  font-size:13.5px; font-weight:600; padding:4px 0; transition:gap .18s;
}
.fba-links a:hover{ gap:10px; text-decoration:underline; }
.fba-links a svg{ width:13px; height:13px; flex:none; }

/* saisie en cours */
.fba-typing{ display:flex; gap:4px; padding:4px 2px; }
.fba-typing i{
  width:7px; height:7px; border-radius:50%; background:var(--fba-muted); display:block;
  animation:fba-bounce 1.3s infinite;
}
.fba-typing i:nth-child(2){ animation-delay:.18s; }
.fba-typing i:nth-child(3){ animation-delay:.36s; }
@keyframes fba-bounce{ 0%,60%,100%{ transform:none; opacity:.45 } 30%{ transform:translateY(-5px); opacity:1 } }

/* suggestions */
.fba-sugs{ display:flex; flex-wrap:wrap; gap:7px; padding:0 16px 12px; background:var(--fba-soft); }
.fba-sugs button{
  background:#fff; border:1px solid var(--fba-line); color:var(--fba-primary); font-weight:600;
  border-radius:999px; padding:7px 13px; font-size:13px; cursor:pointer; font-family:inherit;
  transition:background .18s, border-color .18s, transform .18s;
}
.fba-sugs button:hover{ background:var(--fba-primary); border-color:var(--fba-primary); color:#fff; transform:translateY(-1px); }

/* escalade */
.fba-escalate{ padding:0 16px 12px; background:var(--fba-soft); }
.fba-escalate a{
  display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
  background:var(--fba-accent); color:#2A1F00; font-weight:700; font-size:14px;
  border-radius:9px; padding:11px 14px; text-decoration:none; transition:filter .18s, transform .18s;
}
.fba-escalate a:hover{ filter:brightness(1.07); transform:translateY(-1px); }
.fba-escalate a svg{ width:16px; height:16px; }

/* zone de saisie */
.fba-form{ border-top:1px solid var(--fba-line); background:#fff; padding:10px 12px; }
.fba-row{ display:flex; gap:8px; align-items:flex-end; }
.fba-row textarea{
  flex:1; resize:none; border:1px solid var(--fba-line); border-radius:10px; padding:10px 12px;
  font-family:inherit; font-size:14.5px; line-height:1.45; max-height:110px; min-height:42px;
  color:var(--fba-ink); background:var(--fba-soft); transition:border-color .18s, background .18s;
}
.fba-row textarea:focus{ outline:0; border-color:var(--fba-primary); background:#fff; }
.fba-row button{
  width:42px; height:42px; border-radius:10px; border:0; background:var(--fba-primary); color:#fff;
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex:none;
  transition:filter .18s, transform .18s;
}
.fba-row button:hover:not(:disabled){ filter:brightness(1.12); transform:translateY(-1px); }
.fba-row button:disabled{ opacity:.45; cursor:not-allowed; }
.fba-row button svg{ width:18px; height:18px; }
.fba-note{ font-size:10.5px; color:var(--fba-muted); margin-top:7px; text-align:center; line-height:1.4; }

/* consentement préalable */
.fba-consent{ padding:18px; text-align:center; background:var(--fba-soft); flex:1; display:flex;
  flex-direction:column; align-items:center; justify-content:center; gap:14px; }
.fba-consent p{ margin:0; font-size:14px; color:var(--fba-ink); }
.fba-consent small{ color:var(--fba-muted); font-size:12px; }
.fba-consent button{
  background:var(--fba-primary); color:#fff; border:0; border-radius:9px; padding:11px 18px;
  font-weight:700; font-size:14px; cursor:pointer; font-family:inherit;
}

/* téléphone */
@media (max-width:520px){
  #fba-root{ bottom:16px; }
  #fba-root.fba-right{ right:16px; }
  #fba-root.fba-left{ left:16px; }
  .fba-panel{
    position:fixed; inset:0; width:100vw; max-width:100vw; height:100dvh;
    border-radius:0; border:0; bottom:0; right:0; left:0; transform:translateY(100%);
  }
  #fba-root.fba-open .fba-panel{ transform:none; }
  #fba-root.fba-open .fba-bubble{ display:none; }
  .fba-head{ padding-top:max(14px, env(safe-area-inset-top)); }
  .fba-form{ padding-bottom:max(10px, env(safe-area-inset-bottom)); }
}

/* accessibilité : animations réduites */
@media (prefers-reduced-motion:reduce){
  #fba-root *{ transition:none !important; animation:none !important; }
}
