/* ==========================================================================
   SABDA INTERNATIONAL — assistant de conversation.
   Charte : bordeaux #401215, creme #EFE3D6, papier #F7F3ED, encre #1E0C0D,
   rouge signal #7A2A2F, or vegetal #B08A5A, brun doux #7A5A52, texte #3A2321,
   filet clair #E2D7C8. Jamais de blanc pur, jamais de noir pur.
   Titres en Cormorant Garamond Light. Tout le reste en Jost 200/300/400.
   Aucune graisse grasse. Surtitres en capitales, interlettrage 0,42 em.
   Angles droits partout : la charte interdit l'arrondi sur les boutons.
   Les polices sont deja chargees par le site : aucune requete en plus.
   ========================================================================== */

.sbb, .sbb * { box-sizing: border-box; }

/* ---------- Declencheur ---------- */
.sbb-ouvrir {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + 48px + 0.625rem);
  right: calc(1rem + env(safe-area-inset-right, 0px));
  bottom: calc(1rem + 48px + 0.625rem + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 1rem;
  border: 0;
  border-top: 1px solid #B08A5A;
  background: #401215;
  color: #EFE3D6;
  font-family: "Jost", "Futura", "Segoe UI", Arial, sans-serif;
  font-weight: 200;
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  text-indent: 0.42em;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
  transition: background 180ms ease-out;
}
.sbb-ouvrir:hover { background: #7A2A2F; }
.sbb-ouvrir:focus-visible { outline: 2px solid #B08A5A; outline-offset: 2px; }
.sbb-ouvrir[hidden] { display: none; }
.sbb-ouvrir__trait { width: 14px; height: 1px; background: #B08A5A; flex: none; }

/* ---------- Panneau ---------- */
.sbb {
  position: fixed;
  right: calc(1rem + env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 260;
  width: 382px;
  max-width: calc(100vw - 2rem);
  height: min(640px, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  background: #F7F3ED;
  border: 1px solid #E2D7C8;
  box-shadow: 0 12px 32px rgba(30, 12, 13, 0.12);
  font-family: "Jost", "Futura", "Segoe UI", Arial, sans-serif;
  font-weight: 300;
  color: #3A2321;
}
.sbb[hidden] { display: none; }

/* ---------- En-tete : le seul aplat bordeaux du panneau ---------- */
.sbb__tete {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem 0.75rem;
  background: #401215;
  color: #EFE3D6;
  border-bottom: 1px solid #B08A5A;
}
.sbb__surtitre {
  display: block;
  margin: 0 0 0.25rem;
  font-size: 8.5px;
  font-weight: 200;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #B08A5A;
}
.sbb__titre {
  margin: 0;
  font-family: "Cormorant Garamond", Garamond, Georgia, serif;
  font-weight: 300;
  font-size: 1.375rem;
  line-height: 1.08;
  color: #EFE3D6;
}
.sbb__fermer {
  flex: none;
  width: 32px; height: 32px;
  margin: -0.25rem -0.25rem 0 0;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #EFE3D6;
  cursor: pointer;
  border-radius: 0;
  line-height: 1;
  font-size: 18px;
  font-weight: 300;
}
.sbb__fermer:hover { border-color: #B08A5A; }
.sbb__fermer:focus-visible { outline: 2px solid #B08A5A; outline-offset: 1px; }

/* ---------- Fil ---------- */
.sbb__fil {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  background: #F7F3ED;
}
.sbb__msg { margin: 0 0 1.125rem; }
.sbb__msg:last-child { margin-bottom: 0.25rem; }
.sbb__qui {
  display: block;
  margin: 0 0 0.375rem;
  font-size: 8.5px;
  font-weight: 200;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}
.sbb__msg--bot .sbb__qui { color: #7A2A2F; }
.sbb__msg--moi .sbb__qui { color: #7A5A52; text-align: right; }
.sbb__texte {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 300;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sbb__msg--bot .sbb__texte {
  border-left: 1px solid #B08A5A;
  padding-left: 0.875rem;
  color: #3A2321;
}
.sbb__msg--moi .sbb__texte {
  background: #EFE3D6;
  padding: 0.625rem 0.875rem;
  color: #3A2321;
  margin-left: 2.5rem;
}
.sbb__texte a { color: #7A2A2F; text-decoration: underline; text-underline-offset: 2px; }

/* Ouverture : phrase d'accueil en Cormorant, comme un chapo de catalogue. */
.sbb__accueil {
  margin: 0 0 1.25rem;
  font-family: "Cormorant Garamond", Garamond, Georgia, serif;
  font-weight: 300;
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.45;
  color: #7A5A52;
}
.sbb__filet { height: 1px; background: #E2D7C8; margin: 0 0 1.25rem; }

/* ---------- Questions d'amorce ---------- */
.sbb__amorces { margin: 0 0 0.5rem; padding: 0; list-style: none; }
.sbb__amorces li { margin: 0 0 0.5rem; }
.sbb__amorce {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid #E2D7C8;
  background: #F7F3ED;
  color: #3A2321;
  font-family: inherit;
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.45;
  cursor: pointer;
  border-radius: 0;
  transition: border-color 180ms ease-out, color 180ms ease-out;
}
.sbb__amorce:hover { border-color: #401215; color: #7A2A2F; }
.sbb__amorce:focus-visible { outline: 2px solid #B08A5A; outline-offset: 1px; }

/* ---------- Attente ---------- */
.sbb__attente { display: flex; align-items: center; gap: 0.5rem; padding-left: 0.875rem; }
.sbb__attente i {
  display: block; width: 5px; height: 5px; background: #B08A5A;
  animation: sbb-respire 1.4s ease-in-out infinite;
}
.sbb__attente i:nth-child(2) { animation-delay: 0.18s; }
.sbb__attente i:nth-child(3) { animation-delay: 0.36s; }
@keyframes sbb-respire { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ---------- Formulaire de mise en relation ---------- */
.sbb__form { margin: 0 0 1rem; padding: 0.875rem; border: 1px solid #E2D7C8; background: #EFE3D6; }
.sbb__form legend, .sbb__form .sbb__formtitre {
  display: block; margin: 0 0 0.625rem; padding: 0;
  font-size: 8.5px; font-weight: 200; letter-spacing: 0.42em;
  text-transform: uppercase; color: #7A2A2F;
}
.sbb__champ { margin: 0 0 0.5rem; }
.sbb__champ label {
  display: block; margin: 0 0 0.1875rem;
  font-size: 0.75rem; font-weight: 300; color: #7A5A52;
}
.sbb__champ input, .sbb__champ textarea {
  width: 100%; padding: 0.5rem 0.625rem;
  border: 1px solid #E2D7C8; background: #F7F3ED; color: #3A2321;
  font-family: inherit; font-weight: 300; font-size: 0.875rem; border-radius: 0;
}
.sbb__champ input:focus, .sbb__champ textarea:focus { outline: 2px solid #B08A5A; outline-offset: -1px; border-color: #B08A5A; }
.sbb__form .sbb__note { margin: 0.5rem 0 0.75rem; }

/* ---------- Pied : saisie ---------- */
.sbb__pied { flex: none; border-top: 1px solid #E2D7C8; background: #F7F3ED; padding: 0.75rem; }
.sbb__saisie { display: flex; align-items: flex-end; gap: 0.5rem; }
.sbb__saisie textarea {
  flex: 1 1 auto;
  min-height: 42px; max-height: 120px;
  padding: 0.625rem 0.75rem;
  border: 1px solid #E2D7C8; background: #F7F3ED; color: #3A2321;
  font-family: inherit; font-weight: 300; font-size: 0.9375rem; line-height: 1.45;
  resize: none; border-radius: 0;
}
.sbb__saisie textarea:focus { outline: 2px solid #B08A5A; outline-offset: -1px; border-color: #B08A5A; }
.sbb__envoi {
  flex: none; height: 42px; padding: 0 1rem;
  border: 0; border-radius: 0;
  background: #401215; color: #EFE3D6;
  font-family: inherit; font-weight: 200; font-size: 9.5px;
  letter-spacing: 0.42em; text-transform: uppercase; text-indent: 0.42em;
  cursor: pointer; box-shadow: none;
  transition: background 180ms ease-out;
}
.sbb__envoi:hover:not(:disabled) { background: #7A2A2F; }
.sbb__envoi:disabled { background: #7A5A52; cursor: default; }
.sbb__envoi:focus-visible { outline: 2px solid #B08A5A; outline-offset: 2px; }

.sbb__note {
  margin: 0.5rem 0 0;
  font-size: 0.6875rem; font-weight: 300; line-height: 1.5; color: #7A5A52;
}
.sbb__compteur { float: right; font-size: 0.6875rem; color: #7A5A52; }

/* ---------- Telephone : panneau plein ecran ---------- */
@media (max-width: 34.9375em) {
  .sbb {
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%; max-width: none; height: 100%;
    border: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    box-shadow: none;
  }
  .sbb__tete { padding: 1rem 1rem 0.875rem; }
  .sbb__titre { font-size: 1.5rem; }
  .sbb__fil { padding: 1rem 1rem 1.25rem; }
  .sbb__pied { padding: 0.75rem 1rem 1rem; }
  .sbb__saisie textarea { font-size: 16px; } /* 16 px : iOS ne zoome pas */
  .sbb-ouvrir { bottom: calc(1rem + 48px + 0.625rem + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Mouvement reduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .sbb-ouvrir, .sbb__amorce, .sbb__envoi { transition: none; }
  .sbb__attente i { animation: none; opacity: 0.6; }
}

/* ---------- Impression : l'assistant ne s'imprime pas ---------- */
@media print { .sbb, .sbb-ouvrir { display: none !important; } }
