/* ==========================================================================
   SuperEasyWeb — assistente.css: l'agentino del configuratore (assets/js/assistente.js)
   Sopra la barra dei comandi, sotto carrello (z 60) e anteprima (z 70).
   ========================================================================== */
.aiuto {
  position: fixed; z-index: 50; right: max(16px, calc((100vw - 1240px) / 2 + 28px)); bottom: calc(96px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; font-family: var(--f-corpo);
}
.aiuto[hidden] { display: none; }
.aiuto__nascosto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* agentino */
.agentino { display: block; overflow: visible; }
.agentino__occhi { fill: var(--occhi, var(--ink)); transform-box: fill-box; transform-origin: center; animation: agentino-occhi 4.2s infinite; }
.agentino__bocca { stroke: var(--occhi, var(--ink)); }
.agentino__luce { fill: var(--lime); animation: agentino-luce 2.4s ease-in-out infinite; }
@keyframes agentino-occhi { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes agentino-luce { 50% { opacity: .35; } }

.aiuto__tasto {
  position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 22px; flex: none;
  background: var(--blu); color: var(--carta); box-shadow: 0 16px 34px -12px rgba(11, 110, 122, .7), inset 0 -3px 0 rgba(13, 43, 48, .18);
  transition: transform var(--speed-fast) var(--ease-hover), border-radius var(--speed-normal) var(--ease-hover);
}
.aiuto__tasto:hover { transform: translateY(-2px) rotate(-4deg); }
.aiuto__tasto:active { transform: scale(.95); }
.aiuto.is-aperto .aiuto__tasto { border-radius: 50%; }
.aiuto:not(.is-aperto) .aiuto__tasto::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  animation: aiuto-onda 2.6s ease-out infinite;
}
@keyframes aiuto-onda { 0% { box-shadow: 0 0 0 0 rgba(11, 110, 122, .45); } 100% { box-shadow: 0 0 0 18px rgba(11, 110, 122, 0); } }

/* fumetto «Hai bisogno di aiuto?» */
.aiuto__fumetto {
  position: relative; display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 4px; border-radius: 999px;
  background: var(--carta); box-shadow: 0 14px 34px -10px rgba(13, 43, 48, .3), 0 0 0 1px var(--linea);
}
.aiuto__fumetto[hidden] { display: none; }
.aiuto__fumetto::after { content: ''; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; background: var(--carta); transform: rotate(45deg); border-radius: 2px; }
.aiuto__fumetto-testo { padding: 10px 6px 10px 16px; font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; }
.aiuto__fumetto-x { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--testo-2); }
.aiuto__fumetto-x:hover { background: var(--sfondo); color: var(--ink); }

/* pannello */
.aiuto__pannello {
  position: absolute; right: 0; bottom: 78px; display: flex; flex-direction: column;
  width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 200px)); overflow: hidden;
  border-radius: 24px; background: var(--carta); box-shadow: 0 40px 80px -24px rgba(13, 43, 48, .45), 0 0 0 1px var(--linea);
  transform-origin: bottom right;
}
.aiuto__pannello[hidden] { display: none; }
.aiuto__testa { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 16px; background: var(--ink); color: var(--carta); }
.aiuto__testa b { display: block; font-family: var(--f-display); font-size: 18px; line-height: 1.15; }
.aiuto__testa small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.3; color: rgba(255, 255, 255, .72); }
.aiuto__avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex: none; background: var(--blu); color: var(--carta); }
.aiuto__chiudi { margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--carta); flex: none; }
.aiuto__chiudi:hover { background: rgba(255, 255, 255, .12); }

.aiuto__chat { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; overflow-y: auto; overscroll-behavior: contain; background: var(--sfondo); }
.aiuto__msg { max-width: 88%; font-size: 15px; line-height: 1.45; }
.aiuto__msg--suo { align-self: flex-start; }
.aiuto__msg--mio { align-self: flex-end; }
.aiuto__testo { padding: 11px 14px; border-radius: 18px 18px 18px 6px; background: var(--carta); color: var(--ink); box-shadow: 0 1px 0 var(--linea); }
.aiuto__msg--mio .aiuto__testo { border-radius: 18px 18px 6px 18px; background: var(--blu); color: var(--carta); box-shadow: none; }
.aiuto__msg--errore .aiuto__testo { background: #fff4d6; }
.aiuto__testo p + p, .aiuto__testo p + ul, .aiuto__testo ul + p { margin-top: 8px; }
.aiuto__testo ul { display: grid; gap: 4px; padding-left: 18px; list-style: disc; }
.aiuto__servizi { display: grid; gap: 6px; margin-top: 8px; }
.aiuto__servizio {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 14px;
  border-radius: 14px; background: var(--carta); box-shadow: inset 0 0 0 1.5px var(--cielo);
}
.aiuto__servizio b { display: block; font-size: 14px; line-height: 1.25; }
.aiuto__servizio span { font-size: 13px; font-weight: 700; color: var(--blu-testo); }
.aiuto__servizio button {
  display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 12px 0 10px; border-radius: 999px; flex: none;
  background: var(--ink); color: var(--carta); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.aiuto__servizio button span { color: inherit; font-size: inherit; }
.aiuto__servizio button[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.aiuto__scrive { display: inline-flex; gap: 5px; padding: 14px 16px; border-radius: 18px 18px 18px 6px; background: var(--carta); }
.aiuto__scrive i { width: 7px; height: 7px; border-radius: 50%; background: var(--blu); animation: aiuto-punti 1s infinite; }
.aiuto__scrive i:nth-child(2) { animation-delay: .15s; }
.aiuto__scrive i:nth-child(3) { animation-delay: .3s; }
@keyframes aiuto-punti { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.aiuto__spunti { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; background: var(--sfondo); }
.aiuto__spunti:empty { display: none; }
.aiuto__spunti button { padding: 8px 13px; border-radius: 999px; background: var(--carta); box-shadow: inset 0 0 0 1.5px var(--cielo); color: var(--blu-testo); font-size: 14px; font-weight: 700; }
.aiuto__spunti button:hover { background: var(--cielo); }

.aiuto__scrivi { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 6px; border-top: 1px solid var(--linea); }
.aiuto__scrivi textarea {
  flex: 1; min-width: 0; min-height: 46px; max-height: 120px; padding: 12px 16px; resize: none; border: 0; outline: 0;
  border-radius: 23px; background: var(--sfondo); font: inherit; font-size: 15px; line-height: 1.45; color: var(--ink);
}
.aiuto__scrivi textarea:focus { box-shadow: inset 0 0 0 2px var(--blu); }
.aiuto__invia { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; flex: none; background: var(--blu); color: var(--carta); }
.aiuto__scrivi.is-attesa .aiuto__invia { opacity: .4; pointer-events: none; }
.aiuto__nota { padding: 0 16px 12px; font-size: 12px; line-height: 1.35; color: var(--testo-2); }

/* telefono e tablet: sopra il tasto «Guarda il tuo sito»; il pannello diventa un foglio dal basso */
@media (max-width: 1023px) {
  .aiuto { right: 12px; bottom: calc(146px + env(safe-area-inset-bottom)); }
  .aiuto__tasto { width: 58px; height: 58px; border-radius: 20px; }
  .aiuto__pannello {
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto;
    height: min(640px, calc(100svh - 80px)); transform-origin: bottom center;
  }
  .aiuto.is-aperto .aiuto__tasto { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .aiuto *, .aiuto *::after { animation: none !important; transition: none !important; }
}
