/* =========================
   CADRE & LAYOUT
   ========================= */
.faq-frame {
  width: 420px;
  max-width: 100%;
  height: 600px;
  margin: 40px auto;
  border-radius: 15px;
  background: #fff;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

.faq-widget {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
  font: 14px/1.4 system-ui, sans-serif;
}

/* zone messages */
#faq-log {
  flex: 1;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* formulaire */
#faq-form {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid #ddd;
  align-items: center;
}
#faq-form input {
  flex: 1 1 auto;
  padding: 8px;
}

/* bouton envoyer (version unique) */
#faq-send {
  appearance: none;
  flex: 0 0 auto;
  width: auto !important;
  min-width: 88px;
  max-width: 140px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #111;
  background: linear-gradient(180deg, #e5e7eb 0%, #d1d5db 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 8px 16px -6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
@media (hover: hover) {
  #faq-send:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #d8dbe0 0%, #c5c9cf 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 10px 18px -6px rgba(0, 0, 0, 0.18);
  }
}
#faq-send:focus {
  outline: none;
}
#faq-send:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 6px rgba(31, 41, 55, 0.35), 0 8px 16px -6px rgba(0, 0, 0, 0.15);
}
#faq-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* =========================
   BULLES & TYPO
   ========================= */
:root {
  --bot-gutter: 56px;
  --msg-user-size: 14px;
  --msg-bot-size: 14px;
  --msg-user-lh: 1.45;
  --msg-bot-lh: 1.45;
}

.msg {
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* user (gauche) */
.msg.user {
  align-self: flex-start;
  background: #f3f4f6;
  border-color: #e5e7eb;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  font-weight: 600 !important;
  border-top-left-radius: 1px;
  font-size: var(--msg-user-size);
  line-height: var(--msg-user-lh);
}

/* bot (droite) */
.msg.bot {
  align-self: flex-end;
  background: #eef2ff;
  border-color: #c7d2fe;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  font-weight: 600 !important;
  border-top-right-radius: 1px;
  margin-left: var(--bot-gutter);
  margin-right: 0;
  font-size: var(--msg-bot-size);
  line-height: var(--msg-bot-lh);
}

/* liens dans la bulle bot */
.msg.bot .links {
  list-style: none;
  margin: 0.35rem 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg.bot .links li {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #fff;
  border-radius: 10px;
  padding: 6px 8px; /* <- correction du "6px px" */
  margin-left: 20px;
}
.msg.bot .links a {
  color: #1f2937;
  text-decoration: none;
}
.msg.bot .links a:hover {
  text-decoration: underline;
}
.msg.bot .links i {
  width: 1.1em;
  text-align: center;
  opacity: 0.9;
}
@media (hover: hover) {
  .msg.bot .links li:hover {
    background: rgba(255, 255, 255, 0.35);
  }
}

/* accessibilité */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* --- Points (fixes par défaut) --- */
:root {
  --dot-size: 6px;
  --dot-gap: 6px;
  --dot-green: #f8a866d7; /* user */
  --dot-red: #659efa9d; /* bot  */
}

.msg::before {
  content: "";
  display: inline-block;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  margin-right: var(--dot-gap);
  vertical-align: middle;
  /* par défaut: pas d'animation => point fixe */
  animation: none;
  opacity: 1;
}
.msg.user::before {
  background: var(--dot-green);
}
.msg.bot::before {
  background: var(--dot-red);
}

/* Accessibilité: réduire l’animation si demandé */
@media (prefers-reduced-motion: reduce) {
  #faq-log .msg.user:not(:has(~ .msg.user))::before,
  #faq-log .msg.bot:not(:has(~ .msg.bot))::before {
    animation: none;
    opacity: 1;
  }
}

/* =========================
   HABILLAGE PAGE (optionnel)
   ========================= */
.page-section .faq-frame {
  display: flex;
  justify-content: center;
}

/* carte 2 colonnes (si utilisée) */
.chat-card {
  margin: 40px auto;
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.35) 0 5px 15px;
}
.about-frame {
  width: 90%;
  height: 600px;
  box-sizing: border-box;
}
.about-inner {
  height: 100%;
  width: 100%;
  padding: 16px;
  overflow: auto;
  border-left: 1px solid #eee;
  font: 14px/1.5 system-ui, sans-serif;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 991.98px) {
  .faq-frame,
  .about-frame {
    width: 100%;
    height: auto;
  }
  .about-inner {
    border-left: none;
    border-top: 1px solid #eee;
  }
}

@media (max-width: 480px) {
  :root {
    --mobile-bottom-gap: calc(30px + env(safe-area-inset-bottom, 0px));
    --msg-user-size: 14px;
    --msg-bot-size: 14px;
  }
  .faq-frame {
    width: 100%;
    height: calc(100svh - var(--mobile-bottom-gap));
    margin: 24px auto var(--mobile-bottom-gap);
    border-radius: 12px;
  }
}
