/* ═══════════════════════════════════════════════════════════════
   ASSISTANT FACTOR X — widget de chat (vanilla JS, aucune API)
   Deux usages : quiz produit conversationnel, et réponses scriptées
   (livraison, paiement, entretien, bien-être). Voir chatbot.js.
   Reprend les variables du design system (assets/style.css).
   ═══════════════════════════════════════════════════════════════ */

.fx-chat-launcher {
  position: fixed; right: 1.6rem; bottom: 1.6rem; z-index: 450;
  width: 58px; height: 58px; border-radius: 50%; border: 3px solid #C9834C; box-sizing: border-box;
  background: var(--black); color: var(--black); font-size: 1.4rem; padding: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px rgba(201,131,76,.35); transition: transform .3s;
}
.fx-chat-launcher img { width: 100%; height: 100%; object-fit: cover; }
.fx-chat-launcher:hover { transform: scale(1.06); }
.fx-chat-launcher .fx-chat-dot {
  position: absolute; top: -2px; right: -2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--alert); border: 2px solid var(--black);
}

.fx-chat-panel {
  position: fixed; right: 1.6rem; bottom: 5.6rem; z-index: 450;
  width: min(380px, 92vw); height: min(560px, 74vh);
  background: var(--deep); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 26px 70px rgba(0,0,0,.6);
  display: none; flex-direction: column; overflow: hidden;
}
.fx-chat-panel.open { display: flex; }

.fx-chat-head {
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .7rem; background: var(--black);
}
.fx-chat-avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid #C9834C; box-sizing: border-box;
  background: var(--black);
  color: var(--black); display: flex; align-items: center; justify-content: center;
  font-family: var(--heading); font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.fx-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fx-chat-head-txt { flex: 1; min-width: 0; }
.fx-chat-head-txt strong { display: block; font-family: var(--heading); font-size: 1rem; color: var(--white); }
.fx-chat-head-txt span { font-size: .7rem; color: var(--gray); }
.fx-chat-close {
  background: none; border: none; color: var(--gray); font-size: 1.1rem; cursor: pointer;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}
.fx-chat-close:hover { color: var(--gold); }

.fx-chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.fx-msg { max-width: 86%; font-size: .84rem; line-height: 1.5; padding: .7rem .9rem; border-radius: 12px; }
.fx-msg.bot { align-self: flex-start; background: var(--card); color: var(--gray-light); border-bottom-left-radius: 3px; }
.fx-msg.user { align-self: flex-end; background: var(--gold); color: var(--black); font-weight: 500; border-bottom-right-radius: 3px; }
.fx-msg p { margin: 0 0 .5rem; }
.fx-msg p:last-child { margin-bottom: 0; }
.fx-msg a { color: var(--gold); }
.fx-msg.bot a { text-decoration: underline; }
.fx-msg.disclaimer { background: rgba(196,86,62,.12); border: 1px solid rgba(196,86,62,.35); color: var(--white); font-size: .76rem; }

.fx-typing { align-self: flex-start; display: flex; gap: 4px; padding: .8rem .9rem; background: var(--card); border-radius: 12px; border-bottom-left-radius: 3px; }
.fx-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--gray); animation: fxTypingBounce 1.1s infinite ease-in-out; }
.fx-typing span:nth-child(2) { animation-delay: .15s; }
.fx-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes fxTypingBounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-4px);opacity:1} }

.fx-chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1rem 1rem; }
.fx-chip {
  border: 1px solid var(--gold); background: transparent; color: var(--gold);
  font-size: .74rem; font-weight: 500; letter-spacing: .03em; padding: .55rem 1rem;
  border-radius: 20px; cursor: pointer; transition: all .25s; text-align: left;
}
.fx-chip:hover { background: var(--gold); color: var(--black); }
.fx-chip.fx-chip-ghost { border-color: var(--border); color: var(--gray-light); }
.fx-chip.fx-chip-ghost:hover { border-color: var(--gray-light); background: transparent; color: var(--white); }

.fx-reco-card {
  display: flex; gap: .7rem; align-items: center; background: var(--black);
  border: 1px solid var(--border); border-radius: 10px; padding: .6rem; margin-top: .5rem; cursor: pointer;
}
.fx-reco-card:hover { border-color: rgba(201,168,76,.5); }
.fx-reco-img {
  width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  background: radial-gradient(circle at 50% 38%, rgba(201,168,76,.18), transparent 62%), linear-gradient(160deg,#1a1a1a,#0c0c0c);
}
.fx-reco-img img { width: 100%; height: 100%; object-fit: cover; }
.fx-reco-info { flex: 1; min-width: 0; }
.fx-reco-info .nom { font-family: var(--heading); font-size: .92rem; color: var(--white); }
.fx-reco-info .prix { font-size: .78rem; color: var(--gold); }

.fx-chat-progress { height: 3px; background: var(--border); }
.fx-chat-progress-fill { height: 100%; background: var(--gold); transition: width .4s ease; }

@media (max-width: 480px) {
  .fx-chat-panel { right: .8rem; left: .8rem; width: auto; bottom: 5.2rem; height: min(70vh, 640px); }
  .fx-chat-launcher { right: 1.2rem; bottom: 1.2rem; }
}
