/* Bulle de chat Assysteo : assistant IA (agent n8n). Aucun service tiers. */
.ac-bouton {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px 12px 14px; border: 0; border-radius: 999px;
  background: var(--brand, #1d4f73); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
  box-shadow: 0 6px 20px rgba(21, 32, 43, .22);
  transition: background .15s ease, transform .15s ease;
}
.ac-bouton:hover { background: var(--brand-dark, #153b57); transform: translateY(-1px); }
.ac-bouton:focus-visible { outline: 3px solid #9cc3e0; outline-offset: 2px; }
.ac-bouton svg { width: 22px; height: 22px; flex: none; }
.ac-bouton[aria-expanded="true"] { display: none; }

.ac-panneau {
  position: fixed; right: 20px; bottom: 20px; z-index: 61;
  margin: 0; padding: 0;
  width: 380px; height: min(600px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: #fff; color: var(--text, #2a3542);
  border: 1px solid var(--line, #e2e6eb); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(21, 32, 43, .25); overflow: hidden;
}
.ac-panneau[hidden] { display: none; }

.ac-entete {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px;
  background: var(--brand, #1d4f73); color: #fff;
}
.ac-logo { flex: none; border-radius: 9px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35); }
.ac-entete-texte { flex: 1; min-width: 0; }
.ac-titre { margin: 0; font-size: 16px; font-weight: 700; color: #fff; }
.ac-sous-titre { margin: 2px 0 0; font-size: 12.5px; opacity: .85; }
.ac-fermer {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: #fff; cursor: pointer; font-size: 22px; line-height: 1;
}
.ac-fermer:hover, .ac-fermer:focus-visible { background: rgba(255, 255, 255, .15); outline: none; }

.ac-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--soft, #f4f6f8); overscroll-behavior: contain;
}
.ac-msg {
  max-width: 85%; padding: 10px 13px; border-radius: 14px;
  font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere;
}
.ac-msg p { margin: 0 0 6px; }
.ac-msg p:last-child, .ac-msg ul:last-child { margin-bottom: 0; }
.ac-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.ac-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.ac-bot { align-self: flex-start; background: #fff; border: 1px solid var(--line, #e2e6eb); border-bottom-left-radius: 4px; }
.ac-bot a { color: var(--brand, #1d4f73); }
.ac-moi { align-self: flex-end; background: var(--brand, #1d4f73); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ac-erreur { align-self: stretch; max-width: none; background: var(--amber-soft, #fcefd9); color: var(--amber, #8a5300); font-size: 13.5px; }

.ac-ecrit { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ac-ecrit span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #5a6675); opacity: .4; animation: ac-point 1.2s infinite; }
.ac-ecrit span:nth-child(2) { animation-delay: .2s; }
.ac-ecrit span:nth-child(3) { animation-delay: .4s; }
@keyframes ac-point { 0%, 60%, 100% { opacity: .25; } 30% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .ac-ecrit span { animation: none; } .ac-bouton { transition: none; } }

.ac-formulaire { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line, #e2e6eb); background: #fff; }
.ac-saisie {
  flex: 1; resize: none; max-height: 120px; min-height: 42px; padding: 10px 12px;
  border: 1px solid var(--line, #e2e6eb); border-radius: 12px;
  /* 16 px minimum : en dessous, Safari sur iPhone zoome la page quand on touche le champ */
  font-family: inherit; font-size: 16px; line-height: 1.4; color: var(--ink, #15202b);
}
.ac-saisie:focus { outline: none; border-color: var(--brand, #1d4f73); box-shadow: 0 0 0 3px var(--brand-soft, #e7eff6); }
.ac-envoyer {
  flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--brand, #1d4f73); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ac-envoyer:disabled { opacity: .45; cursor: default; }
.ac-envoyer svg { width: 20px; height: 20px; }
.ac-pied { margin: 0; padding: 0 12px 10px; background: #fff; font-size: 11.5px; line-height: 1.4; color: var(--muted, #5a6675); }
.ac-pied a { color: inherit; }

@media (max-width: 520px) {
  .ac-bouton { right: 16px; bottom: 16px; }
  .ac-panneau { right: 12px; left: 12px; bottom: 12px; width: auto; height: calc(100dvh - 24px); }
  /* Chat ouvert : la page derrière ne défile plus */
  html.ac-ouvert, html.ac-ouvert body { overflow: hidden; }
}
@media print { .ac-bouton, .ac-panneau { display: none !important; } }
