/* widget.css — Agent conseiller Firchim en bulle flottante.
   Tout est préfixé .fw- et isolé sous #fw-root pour ne jamais entrer en conflit
   avec le CSS de la page hôte. Palette alignée sur ../index.html. */

#fw-root{
  --fw-bleu:#1b3a5c; --fw-bleu2:#2c5f8a; --fw-vert:#3d8b6e;
  --fw-ocre:#e8a33d; --fw-fond:#f4f6f8; --fw-carte:#fff;
  --fw-texte:#22303c; --fw-gris:#7a8a99; --fw-bord:#dde4ea;
  font-family:'Segoe UI',system-ui,sans-serif;
}
#fw-root *{box-sizing:border-box}

/* --- Bulle flottante --- */
.fw-bulle{
  position:fixed; right:22px; bottom:22px; z-index:9998;
  display:flex; align-items:center; gap:10px;
  background:var(--fw-bleu); color:#fff; border:none; cursor:pointer;
  padding:12px 18px 12px 14px; border-radius:30px;
  box-shadow:0 6px 22px rgba(20,35,50,.28); font-size:.9rem; font-weight:600;
  transition:transform .15s ease, box-shadow .15s ease;
}
.fw-bulle:hover{transform:translateY(-2px); box-shadow:0 9px 28px rgba(20,35,50,.35)}
.fw-bulle .fw-ico{
  width:30px; height:30px; border-radius:50%; background:var(--fw-vert);
  display:flex; align-items:center; justify-content:center; font-size:1rem; flex:0 0 auto;
}
.fw-bulle .fw-badge{
  font-size:.62rem; font-weight:700; background:var(--fw-ocre); color:#3a2a05;
  padding:2px 7px; border-radius:10px; margin-left:2px; letter-spacing:.3px;
}
.fw-bulle.fw-cache{display:none}

/* --- Panneau de chat --- */
.fw-panneau{
  position:fixed; right:22px; bottom:22px; z-index:9999;
  width:390px; max-width:calc(100vw - 44px); height:600px; max-height:calc(100vh - 44px);
  background:var(--fw-fond); border-radius:16px; overflow:hidden;
  display:none; flex-direction:column;
  box-shadow:0 12px 44px rgba(20,35,50,.4); border:1px solid var(--fw-bord);
}
.fw-panneau.fw-ouvert{display:flex}

.fw-tete{
  background:var(--fw-bleu); color:#fff; padding:14px 16px;
  display:flex; align-items:center; gap:12px; flex:0 0 auto;
}
.fw-tete .fw-ico{
  width:38px; height:38px; border-radius:50%; background:var(--fw-vert);
  display:flex; align-items:center; justify-content:center; font-size:1.15rem; flex:0 0 auto;
}
.fw-tete .fw-titre{font-size:.95rem; font-weight:600; line-height:1.25}
.fw-tete .fw-soustitre{font-size:.7rem; opacity:.8}
.fw-tete .fw-fermer{
  margin-left:auto; background:transparent; border:none; color:#fff;
  font-size:1.4rem; cursor:pointer; opacity:.8; line-height:1; padding:4px;
}
.fw-tete .fw-fermer:hover{opacity:1}

.fw-fil{flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:12px}
.fw-msg{max-width:86%; padding:11px 14px; border-radius:14px; line-height:1.5;
  font-size:.88rem; white-space:pre-wrap; word-wrap:break-word}
.fw-msg a{color:var(--fw-bleu2)}
.fw-user{align-self:flex-end; background:var(--fw-bleu2); color:#fff; border-bottom-right-radius:4px}
.fw-bot{align-self:flex-start; background:var(--fw-carte); border:1px solid var(--fw-bord);
  color:var(--fw-texte); border-bottom-left-radius:4px}
.fw-bot.fw-pense{color:var(--fw-gris); font-style:italic}
.fw-msg.fw-devis{background:#f0f8f4; border:1px solid var(--fw-vert); max-width:94%}
.fw-msg.fw-devis .fw-entete{font-weight:700; color:var(--fw-vert); margin-bottom:6px;
  font-size:.72rem; text-transform:uppercase; letter-spacing:.5px}
.fw-copier{margin-top:9px; background:var(--fw-vert); color:#fff; border:none;
  border-radius:6px; padding:6px 13px; font-size:.75rem; cursor:pointer}

.fw-chips{padding:0 16px 8px; display:flex; gap:7px; flex-wrap:wrap; flex:0 0 auto}
.fw-chip{background:var(--fw-carte); border:1px solid var(--fw-bord); border-radius:15px;
  padding:5px 11px; font-size:.73rem; cursor:pointer; color:var(--fw-bleu2)}
.fw-chip:hover{background:#eef4f9}

.fw-barre{display:flex; gap:8px; padding:12px 14px; background:var(--fw-carte);
  border-top:1px solid var(--fw-bord); flex:0 0 auto}
.fw-barre input{flex:1; padding:10px 13px; border:1px solid var(--fw-bord);
  border-radius:9px; font-size:.9rem; outline:none; font-family:inherit}
.fw-barre input:focus{border-color:var(--fw-bleu2)}
.fw-astuce{background:#fff; border:1px solid var(--fw-bord); border-radius:9px;
  padding:0 11px; font-size:1.1rem; line-height:1; cursor:pointer; flex:0 0 auto}
.fw-astuce:hover{background:#eef4f9}
.fw-env{background:var(--fw-vert); color:#fff; border:none; border-radius:9px;
  padding:0 16px; font-size:.9rem; cursor:pointer; font-weight:600}
.fw-env:disabled{opacity:.5; cursor:default}
.fw-outils{display:flex; gap:8px; padding:0 14px 10px; background:var(--fw-carte); flex:0 0 auto}
.fw-outils button{flex:1; background:#fff; color:var(--fw-vert); border:1px solid var(--fw-vert);
  border-radius:8px; padding:8px; font-size:.76rem; cursor:pointer; font-weight:600}
.fw-outils button:disabled{opacity:.5; cursor:default}

.fw-note{font-size:.66rem; color:var(--fw-gris); text-align:center; padding:6px 14px 10px;
  background:var(--fw-carte); line-height:1.4; flex:0 0 auto}

/* --- Voile clé API (dans le panneau) --- */
.fw-voile{position:absolute; inset:0; background:rgba(20,35,50,.6); z-index:5;
  display:none; align-items:center; justify-content:center; padding:18px}
.fw-voile.fw-ouvert{display:flex}
.fw-voile .fw-boite{background:#fff; border-radius:12px; padding:22px; width:100%}
.fw-voile h3{font-size:1rem; color:var(--fw-bleu); margin:0 0 8px}
.fw-voile p{font-size:.78rem; color:var(--fw-gris); margin:0 0 12px; line-height:1.5}
.fw-voile input{width:100%; padding:10px; border:1px solid var(--fw-bord);
  border-radius:8px; margin-bottom:10px; font-size:.88rem; font-family:inherit}
.fw-voile button{width:100%; background:var(--fw-bleu); color:#fff; border:none;
  border-radius:8px; padding:10px; font-size:.9rem; cursor:pointer; font-weight:600}

/* --- Mobile : panneau plein écran --- */
@media(max-width:520px){
  .fw-panneau{right:0; bottom:0; width:100vw; height:100vh; max-width:100vw;
    max-height:100vh; border-radius:0; border:none}
  .fw-bulle{right:16px; bottom:16px}
}
