/* BotVetrina — assistente fisso di Lumia GB su ogni pagina del sito.
   Stessa famiglia del widget «Provalo» (moduli/bot-prova/), pelle duo:
   nero #0C0C0B, arancio #FF6B1A la voce di chi scrive, verde #AFF23E
   la macchina. Nessun backend, nessuna dipendenza, gira offline.

   Uso:
     <link rel="stylesheet" href="/moduli/bot-vetrina/bot-vetrina.css">
     …
     <script src="/moduli/bot-vetrina/bot-vetrina.js"></script>
     <script>BotVetrina.mount({ lang:'it', linkPrezzi:'prezzi.html' })</script>

   Risponde di prezzi, tempi e pagamenti; le richieste vere le gira
   a Lumia su WhatsApp. ?bv-auto=prezzi|tempi|parte apre ed esegue
   un flusso da solo (per screenshot e controlli). */

.bv {
  --bv-nero: #0c0c0b;
  --bv-sup: #141512;
  --bv-sup2: #1a1b17;
  --bv-bianco: #f5f3ec;
  --bv-bianco-60: rgba(245, 243, 236, .66);
  --bv-bordo: rgba(245, 243, 236, .16);
  --bv-arancio: #ff6b1a;
  --bv-arancio-scuro: #d64f0a;
  --bv-verde: #aff23e;
  --bv-verde-scuro: #3e7a52;
  --bv-raggio: 18px;
  --bv-mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: Karla, system-ui, sans-serif;
  color: var(--bv-bianco);
  position: relative;
  z-index: 90;
}
.bv [hidden] { display: none !important; }
.bv-mono { font-family: var(--bv-mono); font-size: .68rem; letter-spacing: .06em; text-transform: lowercase; }

/* ---------- pulsante flottante ---------- */
.bv-apri {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 92;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--bv-arancio);
  color: var(--bv-nero);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.bv-apri:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(0, 0, 0, .55); }
.bv-apri svg { width: 26px; height: 26px; }
.bv-punto-apri {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bv-verde);
  border: 2px solid var(--bv-arancio);
}
/* alone che pulsa finché non lo aprono la prima volta */
.bv-apri.bv-nuovo::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--bv-verde);
  animation: bv-battito-apri 2.2s ease-out infinite;
}
@keyframes bv-battito-apri {
  0%   { transform: scale(.8); opacity: .9; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- pannello chat ---------- */
.bv-finestra {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 93;
  width: min(384px, calc(100vw - 24px));
  max-height: min(600px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  background: var(--bv-sup);
  border: 1px solid var(--bv-bordo);
  border-radius: var(--bv-raggio);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .55);
  overflow: hidden;
  animation: bv-sale .3s ease-out 1;
}
@keyframes bv-sale {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.bv-testa {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--bv-nero);
  border-bottom: 1px solid var(--bv-bordo);
}
.bv-punto {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bv-verde);
  flex: none;
  animation: bv-battito 2.4s ease-out infinite;
}
@keyframes bv-battito {
  0%   { box-shadow: 0 0 0 0 rgba(175, 242, 62, .4); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.bv-testa .bv-mono {
  color: var(--bv-bianco-60);
  letter-spacing: .14em;
}
.bv-titolo { margin: 0; line-height: 1.15; flex: 1; min-width: 0; }
.bv-titolo strong { font-size: .98rem; font-weight: 700; display: block; color: var(--bv-bianco); }
.bv-titolo .bv-mono { display: block; margin-top: 3px; }
.bv-chiudi {
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bv-bianco-60);
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px 4px;
  flex: none;
}
.bv-chiudi:hover { color: var(--bv-bianco); }

.bv-msgs {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  scroll-behavior: smooth;
  min-height: 200px;
  flex: 1;
}
.bv-msg { margin: 0; padding: 9px 13px; border-radius: 14px; max-width: 88%; font-size: .92rem; line-height: 1.45; }
.bv-msg.bv-bot    { background: var(--bv-sup2); border: 1px solid var(--bv-bordo); border-top-left-radius: 4px; align-self: flex-start; }
.bv-msg.bv-utente { background: var(--bv-arancio); color: var(--bv-nero); font-weight: 600; border-top-right-radius: 4px; align-self: flex-end; }
.bv-msg.bv-utente a { color: var(--bv-nero); text-decoration: underline; }
.bv-msg.bv-bot a { color: var(--bv-verde); font-weight: 700; text-decoration: underline; }
.bv-msg.bv-bot b { color: var(--bv-bianco); }

.bv-staScrivendo { display: flex; gap: 5px; align-items: center; padding: 13px; }
.bv-puntoScrive {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--bv-bianco-60);
  animation: bv-salto 1s ease-in-out infinite;
}
.bv-puntoScrive:nth-child(2) { animation-delay: .15s; }
.bv-puntoScrive:nth-child(3) { animation-delay: .3s; }
@keyframes bv-salto {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* conferma «girato a Lumia» */
.bv-msg.bv-fatto {
  align-self: flex-start;
  background: var(--bv-verde);
  color: var(--bv-nero);
  border: none;
  border-top-left-radius: 4px;
  font-weight: 700;
}
.bv-entra { animation: bv-comparsa .45s ease-out 1; }
@keyframes bv-comparsa {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* chip + input */
.bv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 11px 14px 0;
}
.bv-chip {
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  color: var(--bv-verde);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--bv-verde) 55%, transparent);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.bv-chip:hover:not(:disabled) { background: var(--bv-verde); color: var(--bv-nero); }
.bv-chip:disabled { opacity: .45; cursor: default; }

.bv-inputriga {
  display: flex;
  gap: 8px;
  padding: 11px 14px 13px;
}
.bv-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: .92rem;
  color: var(--bv-bianco);
  background: var(--bv-sup2);
  border: 1px solid var(--bv-bordo);
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
}
.bv-input:focus { border-color: var(--bv-arancio); }
.bv-input::placeholder { color: var(--bv-bianco-60); opacity: .8; }
.bv-manda {
  font: inherit;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--bv-arancio);
  color: var(--bv-nero);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.bv-manda:hover:not(:disabled) { background: var(--bv-arancio-scuro); color: var(--bv-bianco); }
.bv-manda:disabled { opacity: .45; cursor: default; }
.bv-manda svg { width: 18px; height: 18px; }

.bv-nota { margin: 0; padding: 8px 14px 10px; color: var(--bv-bianco-60); text-align: center; }

@media (max-width: 480px) {
  .bv-apri { right: 14px; bottom: 14px; }
  .bv-finestra { right: 12px; left: 12px; width: auto; bottom: 12px; max-height: calc(100dvh - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .bv *, .bv *::before, .bv *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
