/* =====================================================================
   assets/lynea-assistante.css — Widget Universel Assistante IA (Socle LYNÉA)
   Toutes les couleurs et polices sont héritées des variables CSS du thème de la boutique.
   Zéro couleur en dur, zéro nom de marque.
   Placé sous les fenêtres du panier (z-index 44 < 60) pour ne jamais gêner la commande.
   ===================================================================== */
.lynea-assistante { --lynea-ast-bas: 22px; position: fixed; right: 20px; bottom: calc(var(--lynea-ast-bas) + env(safe-area-inset-bottom, 0px)); z-index: 44; font-family: var(--f-texte, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif); }
body.fiche-produit .lynea-assistante { --lynea-ast-bas: 22px; }

.lynea-declencheur {
  display: flex; align-items: center; gap: 0; padding: 4px; margin-left: auto;
  border: 1px solid var(--c-or, #D4AF37); border-radius: var(--r-bouton, 50px); background: var(--c-surface, #FFFFFF);
  box-shadow: var(--ombre-flottante, 0 8px 24px rgba(0,0,0,0.12)); cursor: pointer; color: var(--c-texte, #1F2937);
  transition: gap var(--duree, 0.25s) var(--courbe, ease), padding var(--duree, 0.25s) var(--courbe, ease);
}
.lynea-portrait { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: block; border: 1.5px solid var(--c-or, #D4AF37); }
.lynea-monogramme {
  display: grid; place-items: center; background: var(--c-bloc, #1E1B26); color: var(--c-or, #D4AF37);
  font-family: var(--f-titre, "Sora", sans-serif); font-size: 1.5rem; font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 2px var(--c-or, #D4AF37);
}
.lynea-portrait-petit { width: 40px; height: 40px; font-size: 1.2rem; }
.lynea-etiquette {
  display: grid; text-align: left; line-height: 1.15; white-space: nowrap; overflow: hidden;
  max-width: 0; opacity: 0; transition: max-width var(--duree, 0.35s) var(--courbe, cubic-bezier(0.16, 1, 0.3, 1)), opacity var(--duree, 0.25s) var(--courbe, ease);
}
.lynea-etiquette strong { font-family: var(--f-titre, "Sora", sans-serif); font-size: 1.02rem; color: var(--c-encre, #111827); }
.lynea-etiquette small { font-size: .74rem; font-weight: 700; color: var(--c-or-texte, #92400E); letter-spacing: .02em; }
@media (hover: hover) and (min-width: 901px) {
  .lynea-declencheur:hover, .lynea-declencheur:focus-visible { gap: 10px; padding-right: 18px; }
  .lynea-declencheur:hover .lynea-etiquette, .lynea-declencheur:focus-visible .lynea-etiquette { max-width: 240px; opacity: 1; }
}
.lynea-ouverte .lynea-declencheur { display: none; }

/* Fenêtre de discussion */
.lynea-boite {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-fond, #FAF8F5); color: var(--c-texte, #1F2937); border: 1.5px solid var(--c-or, #D4AF37);
  border-radius: var(--r-carte, 20px); box-shadow: var(--ombre-flottante, 0 16px 40px rgba(0,0,0,0.15));
}
.lynea-boite[hidden] { display: none; }
.lynea-entete { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--c-bloc, #1E1B26); color: var(--c-bloc-texte, #FFFFFF); }
.lynea-titre { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.lynea-titre strong { font-family: var(--f-titre, "Sora", sans-serif); font-weight: 700; font-size: .95rem; }
.lynea-titre small { font-size: .74rem; opacity: .9; display: flex; align-items: center; gap: 6px; }
.lynea-titre i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-succes, #10B981); display: inline-block; }
.lynea-icone {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  background: transparent; color: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lynea-icone:hover { background: rgba(255,255,255,.15); }

.lynea-fil { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.lynea-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.lynea-msg p { margin: 0; }
.lynea-msg p + p { margin-top: 8px; }
.lynea-bot { align-self: flex-start; background: var(--c-surface, #FFFFFF); border: 1px solid var(--c-ligne, rgba(212,175,55,0.25)); border-bottom-left-radius: 4px; }
.lynea-client { align-self: flex-end; background: var(--c-action, #D4AF37); color: var(--c-action-texte, #0B0D12); font-weight: 500; border-bottom-right-radius: 4px; }
.lynea-bot a { color: var(--c-or-texte, #92400E); font-weight: 700; text-decoration: underline; }
.lynea-attente p { color: var(--c-texte-doux, #6B7280); font-style: italic; display: flex; align-items: center; gap: 4px; }
.lynea-attente span { width: 6px; height: 6px; border-radius: 50%; background: var(--c-or, #D4AF37); animation: lynea-point 1.2s infinite ease-in-out; }
.lynea-attente span:nth-child(2) { animation-delay: .15s; }
.lynea-attente span:nth-child(3) { animation-delay: .3s; margin-right: 4px; }
@keyframes lynea-point { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.lynea-puces { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.lynea-puces[hidden] { display: none; }
.lynea-puce {
  border: 1px solid var(--c-or, #D4AF37); background: var(--c-surface, #FFFFFF); color: var(--c-encre, #111827);
  border-radius: var(--r-puce, 20px); padding: 7px 12px; font: 600 .78rem/1.2 var(--f-texte, sans-serif); cursor: pointer;
}
.lynea-puce:hover { background: var(--c-fond-alt, rgba(212,175,55,0.1)); }

.lynea-saisie { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--c-ligne, rgba(212,175,55,0.25)); background: var(--c-surface, #FFFFFF); }
.lynea-champ {
  flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 12px;
  border: 1px solid var(--c-ligne, rgba(212,175,55,0.25)); border-radius: 14px; background: var(--c-fond, #FAF8F5);
  font: 15px/1.4 var(--f-texte, sans-serif); color: var(--c-texte, #1F2937);
}
.lynea-champ:focus { outline: 2px solid var(--c-or, #D4AF37); outline-offset: 0; }
.lynea-envoyer {
  width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 50%;
  background: var(--c-action, #D4AF37); color: var(--c-action-texte, #0B0D12); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lynea-envoyer:hover { opacity: .9; }
.lynea-envoyer:disabled { opacity: .45; cursor: wait; }
.lynea-mention { margin: 0; padding: 6px 14px 10px; font-size: .7rem; line-height: 1.35; color: var(--c-texte-doux, #6B7280); background: var(--c-surface, #FFFFFF); }

/* Téléphone mobile */
@media (max-width: 900px) {
  .lynea-assistante { right: 14px; --lynea-ast-bas: 16px; }
  body.fiche-produit .lynea-assistante { --lynea-ast-bas: 88px; }
  .lynea-portrait { width: 50px; height: 50px; }
  .lynea-boite {
    left: 0; right: 0; bottom: 0; width: 100%;
    height: min(88vh, calc(100dvh - 40px)); border-radius: 22px 22px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lynea-declencheur, .lynea-etiquette { transition: none; }
  .lynea-attente span { animation: none; opacity: .7; }
}
@media print { .lynea-assistante { display: none; } }
