/* Poids Plume, page de vente : retour en haut de page et assistant.
   Feuille séparée de style.css (4 septembre 2026). */

/* ---------- retour en haut de page ---------- */
/* Une plume qui s'élève : un disque d'encre, un anneau vert qui se remplit à
   mesure que l'on descend dans la page, et un envol au clic. */
.haut-de-page {
  position: fixed; left: 22px; bottom: 22px; z-index: 40;
  width: 54px; height: 54px; border-radius: 50%; border: 0; padding: 0;
  background: var(--encre); color: var(--vert); cursor: pointer;
  box-shadow: var(--ombre-forte);
  display: grid; place-items: center;
  opacity: 0; transform: translateY(18px) scale(.9); pointer-events: none;
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.9,.3,1.3);
}
.haut-de-page.visible { opacity: 1; transform: none; pointer-events: auto; }
.haut-de-page svg.cadran { position: absolute; inset: 0; width: 54px; height: 54px; }
.haut-de-page .anneau { fill: none; stroke: var(--vert); stroke-width: 2.5; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .15s linear; }
.haut-de-page .fond { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 2.5; }
.haut-de-page .plume-haut {
  position: relative; width: 22px; height: 32px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px;
  transition: transform .25s ease;
}
.haut-de-page .plume-haut svg { width: 22px; height: 22px; display: block; }
/* La pointe de fleche au-dessus de la plume : le sens du bouton se lit d'un coup d'oeil. */
.haut-de-page .plume-haut .fleche-haut { width: 16px; height: 8px; }
.haut-de-page:hover .plume-haut, .haut-de-page:focus-visible .plume-haut { transform: translateY(-3px) rotate(-8deg); }
.haut-de-page:focus-visible { outline: 3px solid var(--vert); outline-offset: 3px; }
.haut-de-page.envol .plume-haut { animation: envol .9s ease forwards; }
@keyframes envol {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  55%  { transform: translateY(-34px) rotate(-18deg); opacity: 0; }
  56%  { transform: translateY(22px) rotate(10deg); opacity: 0; }
  100% { transform: translateY(0) rotate(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .haut-de-page, .haut-de-page .plume-haut { transition: none; animation: none !important; }
}

/* ---------- assistant ---------- */
.assistant-bulle {
  position: fixed; right: 22px; bottom: 22px; z-index: 41;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px; border-radius: 999px; border: 0;
  background: var(--vert); color: var(--encre); font: inherit; font-weight: 700; font-size: 15px;
  cursor: pointer; box-shadow: 0 10px 30px rgba(45, 212, 167, .35), var(--ombre);
  transition: transform .2s ease, box-shadow .2s ease;
}
.assistant-bulle:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(45, 212, 167, .45), var(--ombre); }
.assistant-bulle:focus-visible { outline: 3px solid var(--encre); outline-offset: 3px; }
.assistant-bulle svg { width: 22px; height: 22px; flex: none; }
.assistant-bulle .pastille { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--encre); border: 2px solid var(--papier); animation: respire 2.2s ease-in-out infinite; }
.assistant-bulle.ouverte .pastille { display: none; }
@keyframes respire { 50% { transform: scale(1.35); } }

/* La règle display:flex ci-dessous l'emporterait sur l'attribut hidden du
   navigateur : sans cette ligne, le panneau reste ouvert et la croix ne
   fait rien (constaté en ligne le 5 septembre 2026). */
.assistant-panneau[hidden] { display: none; }
.assistant-panneau {
  position: fixed; right: 22px; bottom: 86px; z-index: 42;
  width: min(380px, calc(100vw - 44px)); max-height: min(70vh, 640px);
  display: flex; flex-direction: column;
  background: var(--papier); color: var(--texte);
  border: 1px solid var(--trait); border-radius: 16px; box-shadow: var(--ombre-forte);
  overflow: hidden;
}
.assistant-tete { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px;
  background: var(--encre); color: #e6eaef; }
.assistant-tete .titres { flex: 1 1 auto; min-width: 0; }
.assistant-tete h3 { margin: 0; font-size: 15px; font-weight: 700; color: #fff; }
.assistant-tete p { margin: 2px 0 0; font-size: 12px; color: #8f9aa6; }
.assistant-tete .icone { width: 26px; height: 26px; flex: none; }
.assistant-outil {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18);
  background: transparent; color: #cfd6dd; cursor: pointer; display: grid; place-items: center; padding: 0; flex: none;
}
.assistant-outil svg { width: 18px; height: 18px; }
.assistant-outil:hover { border-color: var(--vert); color: var(--vert); }
.assistant-outil.actif { background: var(--vert); color: var(--encre); border-color: var(--vert); }
.assistant-outil.ecoute { background: var(--alerte); color: #fff; border-color: var(--alerte); animation: respire 1s ease-in-out infinite; }
.assistant-outil:focus-visible { outline: 2px solid var(--vert); outline-offset: 2px; }

.assistant-fil { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px;
  background: var(--papier-2); min-height: 160px; }
.assistant-message { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-line; }
.assistant-message.assistant { align-self: flex-start; background: var(--papier); border: 1px solid var(--trait); border-bottom-left-radius: 4px; }
.assistant-message.visiteur { align-self: flex-end; background: var(--encre); color: #fff; border-bottom-right-radius: 4px; }
.assistant-message.attente { display: flex; gap: 5px; padding: 12px 14px; }
.assistant-message.attente span { width: 7px; height: 7px; border-radius: 50%; background: var(--vert); animation: saut 1s ease-in-out infinite; }
.assistant-message.attente span:nth-child(2) { animation-delay: .15s; }
.assistant-message.attente span:nth-child(3) { animation-delay: .3s; }
@keyframes saut { 50% { transform: translateY(-5px); opacity: .5; } }

.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px; background: var(--papier-2); }
.assistant-suggestions button {
  border: 1px solid var(--trait); background: var(--papier); color: var(--texte-2);
  border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.assistant-suggestions button:hover { border-color: var(--vert-fonce); color: var(--vert-fonce); }

.assistant-formulaire { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--trait); background: var(--papier); }
.assistant-formulaire input {
  flex: 1 1 auto; min-width: 0; border: 1px solid var(--trait); border-radius: 999px; padding: 10px 14px;
  font: inherit; font-size: 14.5px; color: var(--texte); background: var(--papier);
}
.assistant-formulaire input:focus-visible { outline: 2px solid var(--vert); outline-offset: 1px; }
.assistant-formulaire .assistant-outil { border-color: var(--trait); color: var(--texte-2); width: 40px; height: 40px; }
.assistant-formulaire .assistant-outil:hover { border-color: var(--vert-fonce); color: var(--vert-fonce); }
.assistant-envoyer { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--encre); color: var(--vert);
  cursor: pointer; display: grid; place-items: center; padding: 0; flex: none; }
.assistant-envoyer svg { width: 18px; height: 18px; }
.assistant-envoyer:hover { background: #000; }
.assistant-note { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--texte-3); background: var(--papier); }
.assistant-note a { color: inherit; }

@media (max-width: 640px) {
  .assistant-bulle { right: 14px; bottom: 14px; padding: 12px 14px; }
  .assistant-bulle .libelle { display: none; }
  .assistant-panneau { right: 10px; left: 10px; width: auto; bottom: 76px; max-height: 76vh; }
  .haut-de-page { left: 14px; bottom: 14px; width: 48px; height: 48px; }
  .haut-de-page svg.cadran { width: 48px; height: 48px; }
}
