/* ──────────────────────────────────────────────────────────────────────────
   Assistant conversationnel Wanda Studio
   Tout est scopé sous #wanda-chat (spécificité 1,0,0) : les 118 articles de
   blog portent chacun leur feuille inline avec des sélecteurs du type
   « .article-content p », qui écrasent une classe simple.

   Ancré en bas à GAUCHE : le coin droit appartient à la pastille WhatsApp.
   ────────────────────────────────────────────────────────────────────────── */

#wanda-chat {
  --wc-noir:    #0c0a08;
  --wc-surface: rgba(255, 255, 255, 0.05);
  --wc-trait:   rgba(255, 255, 255, 0.1);
  --wc-or:      #c9a84c;
  --wc-texte:   #f2efe9;
  --wc-doux:    #99938a;
  --wc-courbe:  cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  left: 24px;
  /* Relevé par le script quand une barre d'action mobile occupe le bas. */
  bottom: var(--wc-bas, 24px);
  z-index: 1000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--wc-texte);
  transition: bottom 240ms var(--wc-courbe);
}

/* ── Pilule d'ouverture ──────────────────────────────────────────────────── */
#wanda-chat .wc-bouton {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 16px 0 18px;
  border: 1px solid rgba(201, 168, 76, 0.42);
  border-radius: 100px;
  background: rgba(10, 10, 10, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color: var(--wc-texte);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 220ms var(--wc-courbe),
              transform 220ms var(--wc-courbe),
              box-shadow 220ms var(--wc-courbe);
}
#wanda-chat .wc-bouton:hover {
  border-color: var(--wc-or);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -14px rgba(201, 168, 76, 0.55);
}
#wanda-chat .wc-bouton:focus-visible {
  outline: 2px solid var(--wc-or);
  outline-offset: 3px;
}
#wanda-chat .wc-bulle { width: 19px; height: 19px; flex: 0 0 auto; fill: var(--wc-or); }

/* Le chevron dit que ça ouvre quelque chose, et se retourne une fois ouvert. */
#wanda-chat .wc-chevron {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  fill: var(--wc-doux);
  transition: transform 240ms var(--wc-courbe);
}
#wanda-chat.wc-ouvert .wc-chevron { transform: rotate(180deg); }

/* Le point d'activité, discret : il signale sans clignoter. */
#wanda-chat .wc-point {
  position: absolute;
  top: -2px;
  left: 12px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--wc-noir);
  border-radius: 50%;
  background: var(--wc-or);
}

/* ── Panneau, au-dessus de la pilule ─────────────────────────────────────── */
#wanda-chat .wc-panneau {
  position: absolute;
  left: 0;
  bottom: 62px;                 /* 48 px de pilule + 14 px de respiration */
  display: flex;
  flex-direction: column;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 110px);
  overflow: hidden;
  border: 1px solid var(--wc-trait);
  border-radius: 20px;
  background: var(--wc-noir);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom left;
  pointer-events: none;
  transition: opacity 260ms var(--wc-courbe), transform 260ms var(--wc-courbe);
}
#wanda-chat.wc-ouvert .wc-panneau {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ── En-tête ─────────────────────────────────────────────────────────────── */
#wanda-chat .wc-tete {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  padding: 16px 14px 16px 18px;
  border-bottom: 1px solid var(--wc-trait);
  background: rgba(255, 255, 255, 0.02);
}
#wanda-chat .wc-sceau {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 50%;
  color: var(--wc-or);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
#wanda-chat .wc-titre { flex: 1 1 auto; min-width: 0; }
#wanda-chat .wc-titre b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--wc-texte);
}
#wanda-chat .wc-titre span {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--wc-doux);
}
#wanda-chat .wc-fermer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wc-doux);
  cursor: pointer;
  transition: background 180ms var(--wc-courbe), color 180ms var(--wc-courbe);
}
#wanda-chat .wc-fermer:hover { background: var(--wc-surface); color: var(--wc-texte); }
#wanda-chat .wc-fermer:focus-visible { outline: 2px solid var(--wc-or); outline-offset: -2px; }
#wanda-chat .wc-fermer svg { width: 15px; height: 15px; fill: currentColor; }

/* ── Fil de discussion ───────────────────────────────────────────────────── */
#wanda-chat .wc-fil {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
#wanda-chat .wc-fil::-webkit-scrollbar { width: 6px; }
#wanda-chat .wc-fil::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
}

/* Pousse la conversation vers le bas sans casser le défilement : posé sur
   justify-content, le haut du fil devient inatteignable une fois plein. */
#wanda-chat .wc-fil > :first-child { margin-top: auto; }
#wanda-chat .wc-fil > * { flex: 0 0 auto; }

#wanda-chat .wc-msg { margin: 0 0 16px; max-width: 100%; }
#wanda-chat .wc-msg:last-child { margin-bottom: 0; }

/* L'assistant parle à plat, sans bulle : plus proche d'une lettre que d'un SMS. */
#wanda-chat .wc-bot {
  padding-left: 13px;
  border-left: 2px solid rgba(201, 168, 76, 0.35);
  color: var(--wc-texte);
}
#wanda-chat .wc-vous {
  margin-left: auto;
  width: fit-content;
  max-width: 85%;
  padding: 9px 14px;
  border: 1px solid var(--wc-trait);
  border-radius: 16px 16px 4px 16px;
  background: var(--wc-surface);
}

#wanda-chat .wc-msg p { margin: 0 0 9px; font-size: 14px; line-height: 1.55; }
#wanda-chat .wc-msg p:last-child { margin-bottom: 0; }
#wanda-chat .wc-msg ul { margin: 0 0 9px; padding-left: 18px; }
#wanda-chat .wc-msg li { margin: 0 0 4px; font-size: 14px; line-height: 1.5; }
#wanda-chat .wc-msg strong { font-weight: 600; color: #fff; }
#wanda-chat .wc-msg em { font-style: italic; }
#wanda-chat .wc-msg a {
  color: var(--wc-or);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Indicateur de frappe ────────────────────────────────────────────────── */
#wanda-chat .wc-frappe {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0 4px 13px;
  border-left: 2px solid rgba(201, 168, 76, 0.35);
}
#wanda-chat .wc-frappe i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wc-doux);
  animation: wc-respire 1.3s ease-in-out infinite;
}
#wanda-chat .wc-frappe i:nth-child(2) { animation-delay: 0.18s; }
#wanda-chat .wc-frappe i:nth-child(3) { animation-delay: 0.36s; }
@keyframes wc-respire {
  0%, 60%, 100% { opacity: 0.28; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

/* ── Suggestions et boutons d'action ─────────────────────────────────────── */
#wanda-chat .wc-puces {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
#wanda-chat .wc-puce {
  padding: 7px 13px;
  border: 1px solid rgba(201, 168, 76, 0.38);
  border-radius: 100px;
  background: transparent;
  color: var(--wc-or);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms var(--wc-courbe), border-color 180ms var(--wc-courbe);
}
#wanda-chat .wc-puce:hover {
  border-color: var(--wc-or);
  background: rgba(201, 168, 76, 0.1);
}
#wanda-chat .wc-puce:focus-visible { outline: 2px solid var(--wc-or); outline-offset: 2px; }

/* L'action principale est pleine : on la distingue d'une simple suggestion. */
#wanda-chat .wc-puce.wc-agir {
  border-color: var(--wc-or);
  background: var(--wc-or);
  color: #0c0a08;
  font-weight: 600;
}
#wanda-chat .wc-puce.wc-agir:hover { background: #d8b95e; border-color: #d8b95e; }

/* ── Saisie ──────────────────────────────────────────────────────────────── */
#wanda-chat .wc-pied {
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--wc-trait);
  background: rgba(255, 255, 255, 0.02);
}
#wanda-chat .wc-forme {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}
#wanda-chat .wc-champ {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 108px;
  padding: 11px 14px;
  border: 1px solid var(--wc-trait);
  border-radius: 14px;
  background: var(--wc-surface);
  color: var(--wc-texte);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
}
#wanda-chat .wc-champ::placeholder { color: var(--wc-doux); }
#wanda-chat .wc-champ:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.55);
}
#wanda-chat .wc-envoyer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: var(--wc-or);
  color: #0c0a08;
  cursor: pointer;
  transition: background 180ms var(--wc-courbe), opacity 180ms var(--wc-courbe);
}
#wanda-chat .wc-envoyer:hover:not(:disabled) { background: #d8b95e; }
#wanda-chat .wc-envoyer:disabled { opacity: 0.35; cursor: default; }
#wanda-chat .wc-envoyer:focus-visible { outline: 2px solid var(--wc-or); outline-offset: 2px; }
#wanda-chat .wc-envoyer svg { width: 17px; height: 17px; fill: currentColor; }

#wanda-chat .wc-mention {
  margin: 9px 0 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--wc-doux);
  text-align: center;
}
#wanda-chat .wc-mention a { color: var(--wc-doux); text-decoration: underline; }

/* ── Mobile : feuille pleine page, pas une fenêtre miniature ─────────────── */
@media (max-width: 560px) {
  #wanda-chat { left: 16px; bottom: var(--wc-bas, 16px); }

  /* Le libellé disparaît : la pilule redevient une pastille ronde. */
  #wanda-chat .wc-bouton { width: 48px; padding: 0; justify-content: center; }
  #wanda-chat .wc-libelle,
  #wanda-chat .wc-chevron { display: none; }
  #wanda-chat .wc-point { left: auto; right: -2px; top: -2px; }

  #wanda-chat.wc-ouvert {
    inset: 0;
    left: 0;
    bottom: 0;
  }
  #wanda-chat.wc-ouvert .wc-bouton { display: none; }
  #wanda-chat .wc-panneau {
    inset: 0;
    width: auto;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  #wanda-chat .wc-tete { padding-top: max(16px, env(safe-area-inset-top)); }
  #wanda-chat .wc-pied { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  /* 16px minimum : en dessous, iOS zoome sur le champ à la mise au point. */
  #wanda-chat .wc-champ { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  #wanda-chat,
  #wanda-chat .wc-bouton,
  #wanda-chat .wc-panneau,
  #wanda-chat .wc-chevron,
  #wanda-chat .wc-puce,
  #wanda-chat .wc-envoyer { transition: none; }
  #wanda-chat .wc-frappe i { animation: none; opacity: 0.6; }
}
