/* ════════════════════════════════════════════════════════════════════
   AUBE HELLO — Assistant conversationnel de L'Aube Étoilée
   Feuille de style du widget (v1)

   ► MODIFIER ICI : LES COULEURS
   Toutes les couleurs du widget sont définies dans le bloc
   #aube-hello-root ci-dessous. Changer une variable suffit pour
   rethémer tout le widget.

   Note : chaque règle est préfixée par #aube-hello-root pour que le
   widget garde son apparence quel que soit le CSS du site hôte
   (Squarespace inclus).
   ════════════════════════════════════════════════════════════════════ */

#aube-hello-root {
  /* ── Palette ─────────────────────────────────────────────────── */
  --ah-nuit:        #070b1c;                 /* bleu nuit profond      */
  --ah-panneau:     rgba(13, 19, 43, 0.94);  /* fond verre du panneau  */
  --ah-panneau-2:   rgba(21, 29, 62, 0.85);  /* verre secondaire       */
  --ah-electrique:  #4f7cff;                 /* bleu électrique        */
  --ah-violet:      #8b5cf6;                 /* violet                 */
  --ah-lueur:       #9db4ff;                 /* touche lumineuse       */
  --ah-texte:       #eef2ff;                 /* texte principal        */
  --ah-texte-2:     #a3b0d4;                 /* texte secondaire       */
  --ah-degrade:     linear-gradient(135deg, var(--ah-electrique) 0%, var(--ah-violet) 100%);
  --ah-bord:        rgba(157, 180, 255, 0.16);
  --ah-bulle-bot:   rgba(255, 255, 255, 0.06);
  --ah-ombre:       0 24px 80px rgba(3, 7, 26, 0.55), 0 4px 18px rgba(3, 7, 26, 0.35);

  /* ── Typographie et métriques ────────────────────────────────── */
  --ah-police: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ah-rayon: 20px;

  position: relative;
  z-index: 2147483000; /* au-dessus du site hôte (Squarespace) */
  font-family: var(--ah-police);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ah-texte);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#aube-hello-root *,
#aube-hello-root *::before,
#aube-hello-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#aube-hello-root button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Focus clavier visible partout dans le widget (accessibilité) */
#aube-hello-root :focus-visible {
  outline: 2px solid var(--ah-lueur);
  outline-offset: 2px;
  border-radius: 8px;
}

/* L'attribut hidden gagne toujours, même sur les éléments en flex */
#aube-hello-root [hidden] {
  display: none !important;
}

/* Sélecteur de langue (FR / EN / ES) dans l'en-tête */
#aube-hello-root .ah-langue {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--ah-bord);
  border-radius: 10px;
  color: var(--ah-texte);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 8px;
  height: 32px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

#aube-hello-root .ah-langue:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(157, 180, 255, 0.4);
}

#aube-hello-root .ah-langue option {
  background: #131b3a;
  color: var(--ah-texte);
}

/* ════════════════════════════════════════════════════════════════════
   BOUTON FLOTTANT ✦
   ════════════════════════════════════════════════════════════════════ */

#aube-hello-root .ah-lanceur {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ah-degrade);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(79, 124, 255, 0.45), 0 2px 8px rgba(3, 7, 26, 0.4);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  z-index: 2147483001;
}

#aube-hello-root .ah-lanceur:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 36px rgba(139, 92, 246, 0.55), 0 2px 8px rgba(3, 7, 26, 0.4);
}

#aube-hello-root .ah-lanceur:active {
  transform: scale(0.95);
}

/* Halo animé très subtil autour du bouton */
#aube-hello-root .ah-lanceur::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: var(--ah-degrade);
  opacity: 0.35;
  filter: blur(10px);
  z-index: -1;
  animation: ah-halo 3.2s ease-in-out infinite;
}

@keyframes ah-halo {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50%      { opacity: 0.5;  transform: scale(1.12); }
}

/* L'étoile pivote doucement à l'ouverture */
#aube-hello-root .ah-lanceur .ah-lanceur-icone {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#aube-hello-root .ah-lanceur[aria-expanded="true"] .ah-lanceur-icone {
  transform: rotate(135deg) scale(0.9);
}

/* ── Message d'invitation « Hello ✦ Une question ? » ─────────────── */

#aube-hello-root .ah-invite {
  position: fixed;
  right: 94px;
  bottom: 34px;
  background: var(--ah-panneau);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ah-bord);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--ah-texte);
  box-shadow: var(--ah-ombre);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2147483001;
}

#aube-hello-root .ah-invite.ah-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

#aube-hello-root .ah-invite .ah-etoile {
  background: var(--ah-degrade);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ════════════════════════════════════════════════════════════════════
   FENÊTRE DE DISCUSSION
   ════════════════════════════════════════════════════════════════════ */

#aube-hello-root .ah-fenetre {
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: 384px;
  max-width: calc(100vw - 44px);
  height: min(620px, calc(100dvh - 130px));
  display: flex;
  flex-direction: column;
  background: var(--ah-panneau);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--ah-bord);
  border-radius: var(--ah-rayon);
  box-shadow: var(--ah-ombre);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1.2, 0.36, 1);
  z-index: 2147483002;
}

#aube-hello-root .ah-fenetre.ah-ouverte {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── En-tête ─────────────────────────────────────────────────────── */

#aube-hello-root .ah-entete {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  background:
    radial-gradient(circle at 18% 25%, rgba(255, 255, 255, 0.55) 0.6px, transparent 1.4px),
    radial-gradient(circle at 62% 70%, rgba(255, 255, 255, 0.4) 0.5px, transparent 1.2px),
    radial-gradient(circle at 84% 20%, rgba(255, 255, 255, 0.5) 0.6px, transparent 1.4px),
    radial-gradient(circle at 40% 85%, rgba(255, 255, 255, 0.3) 0.5px, transparent 1.1px),
    linear-gradient(135deg, rgba(79, 124, 255, 0.32), rgba(139, 92, 246, 0.28));
  border-bottom: 1px solid var(--ah-bord);
}

#aube-hello-root .ah-entete-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--ah-degrade);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 124, 255, 0.4);
  flex-shrink: 0;
}

#aube-hello-root .ah-entete-titres {
  flex: 1;
  min-width: 0;
}

#aube-hello-root .ah-entete-nom {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#aube-hello-root .ah-entete-role {
  font-size: 12px;
  color: var(--ah-texte-2);
  margin-top: 1px;
}

#aube-hello-root .ah-entete-statut {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
  margin-right: 6px;
  vertical-align: 1px;
}

#aube-hello-root .ah-entete-actions {
  display: flex;
  gap: 6px;
}

#aube-hello-root .ah-bouton-icone {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ah-texte-2);
  font-size: 15px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

#aube-hello-root .ah-bouton-icone:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ah-texte);
}

#aube-hello-root .ah-bouton-icone:active {
  transform: scale(0.92);
}

#aube-hello-root .ah-bouton-icone svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Bandeau d'annonce permanent (sous l'en-tête) ────────────────── */

#aube-hello-root .ah-bandeau-global {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--ah-lueur);
  text-align: center;
  background: linear-gradient(90deg, rgba(79, 124, 255, 0.16), rgba(139, 92, 246, 0.16));
  border-bottom: 1px solid var(--ah-bord);
}

#aube-hello-root .ah-bandeau-global .ah-etoile {
  background: var(--ah-degrade);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#aube-hello-root .ah-bandeau-global a {
  color: var(--ah-texte);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(238, 242, 255, 0.4);
}

#aube-hello-root .ah-bandeau-global a:hover {
  border-bottom-color: var(--ah-texte);
}

/* ── Bandeau riche dans la conversation (propriété bandeau) ──────── */

#aube-hello-root .ah-bandeau {
  display: block;
  margin-left: 34px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(157, 180, 255, 0.3);
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.18), rgba(139, 92, 246, 0.18));
  color: var(--ah-texte);
  text-decoration: none;
  animation: ah-apparition 0.35s ease both;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

#aube-hello-root a.ah-bandeau:hover {
  border-color: rgba(157, 180, 255, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 124, 255, 0.25);
}

#aube-hello-root .ah-bandeau-image {
  display: block;
  width: 100%;
  max-height: 120px;
  object-fit: cover;
}

#aube-hello-root .ah-bandeau-corps {
  padding: 11px 14px 12px;
}

#aube-hello-root .ah-bandeau-titre {
  font-size: 13.5px;
  font-weight: 700;
}

#aube-hello-root .ah-bandeau-texte {
  font-size: 12.5px;
  color: var(--ah-texte-2);
  margin-top: 2px;
}

#aube-hello-root .ah-bandeau-libelle {
  display: inline-block;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ah-lueur);
}

/* ── Zone des messages ───────────────────────────────────────────── */

#aube-hello-root .ah-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(79, 124, 255, 0.10), transparent 60%);
}

/* Les éléments de la conversation ne se compriment jamais (flex) */
#aube-hello-root .ah-messages > * {
  flex-shrink: 0;
}

#aube-hello-root .ah-messages::-webkit-scrollbar {
  width: 5px;
}

#aube-hello-root .ah-messages::-webkit-scrollbar-thumb {
  background: rgba(157, 180, 255, 0.22);
  border-radius: 4px;
}

#aube-hello-root .ah-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Bulles ──────────────────────────────────────────────────────── */

#aube-hello-root .ah-rangee {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: ah-apparition 0.35s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

#aube-hello-root .ah-rangee.ah-de-visiteur {
  justify-content: flex-end;
}

@keyframes ah-apparition {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#aube-hello-root .ah-avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--ah-degrade);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79, 124, 255, 0.35);
}

#aube-hello-root .ah-bulle {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.8px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#aube-hello-root .ah-rangee.ah-de-bot .ah-bulle {
  background: var(--ah-bulle-bot);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 5px;
}

#aube-hello-root .ah-rangee.ah-de-visiteur .ah-bulle {
  background: var(--ah-degrade);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(79, 124, 255, 0.3);
}

/* ── Indicateur « en train d'écrire » ● ● ● ──────────────────────── */

#aube-hello-root .ah-saisie-en-cours {
  display: inline-flex;
  gap: 5px;
  padding: 13px 16px;
}

#aube-hello-root .ah-saisie-en-cours span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ah-lueur);
  animation: ah-points 1.2s ease-in-out infinite;
}

#aube-hello-root .ah-saisie-en-cours span:nth-child(2) { animation-delay: 0.18s; }
#aube-hello-root .ah-saisie-en-cours span:nth-child(3) { animation-delay: 0.36s; }

@keyframes ah-points {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-4px); }
}

/* ── Boutons de choix (puces) ────────────────────────────────────── */

#aube-hello-root .ah-choix {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 4px 34px;
}

#aube-hello-root .ah-puce {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(157, 180, 255, 0.28);
  background: rgba(157, 180, 255, 0.08);
  color: var(--ah-texte);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.2s ease, border-color 0.2s ease,
              transform 0.15s ease, box-shadow 0.2s ease;
  animation: ah-apparition 0.3s ease both;
}

#aube-hello-root .ah-puce:hover {
  background: rgba(157, 180, 255, 0.16);
  border-color: rgba(157, 180, 255, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 124, 255, 0.22);
}

#aube-hello-root .ah-puce:active {
  transform: scale(0.96);
}

#aube-hello-root .ah-puce.ah-puce-retour {
  color: var(--ah-texte-2);
  background: transparent;
  border-color: rgba(157, 180, 255, 0.16);
}

/* ── Cartes (applications, contact) ──────────────────────────────── */

#aube-hello-root .ah-cartes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 34px;
  animation: ah-apparition 0.35s ease both;
}

#aube-hello-root .ah-carte {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--ah-panneau-2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-decoration: none;
  color: var(--ah-texte);
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

#aube-hello-root .ah-carte:hover {
  border-color: rgba(157, 180, 255, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 124, 255, 0.18);
}

#aube-hello-root .ah-carte-icone {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.25), rgba(139, 92, 246, 0.25));
  border: 1px solid rgba(157, 180, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ah-lueur);
  flex-shrink: 0;
}

#aube-hello-root .ah-carte-corps {
  flex: 1;
  min-width: 0;
}

#aube-hello-root .ah-carte-nom {
  font-size: 13.5px;
  font-weight: 600;
}

#aube-hello-root .ah-carte-description {
  font-size: 12px;
  color: var(--ah-texte-2);
  margin-top: 1px;
}

#aube-hello-root .ah-carte-fleche {
  color: var(--ah-texte-2);
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Zone de saisie ──────────────────────────────────────────────── */

#aube-hello-root .ah-pied {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ah-bord);
  background: rgba(7, 11, 28, 0.35);
}

#aube-hello-root .ah-formulaire-saisie {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ah-bord);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#aube-hello-root .ah-formulaire-saisie:focus-within {
  border-color: rgba(157, 180, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}

#aube-hello-root .ah-champ {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ah-texte);
  font-family: inherit;
  font-size: 13.8px;
  padding: 8px 0;
  min-width: 0;
}

#aube-hello-root .ah-champ::placeholder {
  color: var(--ah-texte-2);
  opacity: 0.85;
}

#aube-hello-root .ah-envoyer {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ah-degrade);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 3px 10px rgba(79, 124, 255, 0.35);
}

#aube-hello-root .ah-envoyer:hover {
  transform: scale(1.06);
}

#aube-hello-root .ah-envoyer:active {
  transform: scale(0.93);
}

#aube-hello-root .ah-envoyer svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#aube-hello-root .ah-signature {
  text-align: center;
  font-size: 10.5px;
  color: var(--ah-texte-2);
  opacity: 0.7;
  margin-top: 8px;
  letter-spacing: 0.03em;
}

/* ── Petit texte d'erreur de validation (devis) ──────────────────── */

#aube-hello-root .ah-bulle .ah-erreur {
  display: block;
  color: #fca5a5;
  font-size: 12.5px;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════════════
   POSITION À GAUCHE (option du Studio)
   ════════════════════════════════════════════════════════════════════ */

#aube-hello-root.ah-a-gauche .ah-lanceur { right: auto; left: 22px; }
#aube-hello-root.ah-a-gauche .ah-invite  { right: auto; left: 94px; }
#aube-hello-root.ah-a-gauche .ah-fenetre {
  right: auto;
  left: 22px;
  transform-origin: bottom left;
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE — téléphones
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  #aube-hello-root .ah-fenetre {
    right: 10px;
    left: 10px;
    bottom: 86px;
    width: auto;
    max-width: none;
    height: min(76dvh, calc(100dvh - 108px));
    border-radius: 18px;
  }

  #aube-hello-root .ah-lanceur {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  #aube-hello-root .ah-invite {
    right: 86px;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
  }

  #aube-hello-root .ah-bulle {
    max-width: 88%;
  }
}

/* ════════════════════════════════════════════════════════════════════
   ACCESSIBILITÉ — mouvement réduit
   ════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  #aube-hello-root *,
  #aube-hello-root *::before,
  #aube-hello-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
