/* chiamaditta.it - stile mobile first, sfondo bianco, molto spazio.
   Palette: blu scuro #0B2E6B, arancio #F97316, giallo #FBBF24. */

:root {
  --blu: #0b2e6b;
  --blu-chiaro: #eef3fb;
  --arancio: #f97316;
  --arancio-scuro: #ea6a0a;
  --giallo: #fbbf24;
  --testo: #1b2434;
  --testo-tenue: #5a6577;
  --bordo: #e3e8f0;
  --bianco: #ffffff;
  --raggio: 18px;
  --raggio-grande: 26px;
  --ombra: 0 10px 30px rgba(11, 46, 107, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bianco);
  color: var(--testo);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Il prodotto e' mobile first: su desktop resta la stessa colonna stretta,
   semplicemente centrata. Nessun layout dedicato agli schermi grandi. */
main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 32px;
  flex: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ intestazione */

.intestazione {
  text-align: center;
  padding: 28px 16px 20px;
}

.logo {
  width: min(260px, 72vw);
  height: auto;
  display: block;
  margin: 0 auto;
}

.sottotitolo {
  margin: 14px auto 0;
  max-width: 30ch;
  color: var(--blu);
  font-size: 1.05rem;
  font-weight: 600;
}

/* -------------------------------------------------------------------- chat */

.chat {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--raggio-grande);
  box-shadow: var(--ombra);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-testata {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bordo);
  background: var(--blu-chiaro);
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bianco);
  border: 2px solid var(--giallo);
  padding: 2px;
  flex: none;
}

.chat-nome {
  margin: 0;
  font-weight: 700;
  color: var(--blu);
  font-size: 0.98rem;
}

.chat-stato {
  margin: 0;
  font-size: 0.82rem;
  color: var(--testo-tenue);
}

.messaggi {
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 46vh;
  max-height: 58vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.messaggio {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 100%;
}

.messaggio img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  background: var(--blu-chiaro);
}

.bolla {
  padding: 11px 15px;
  border-radius: var(--raggio);
  max-width: min(84%, 460px);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.da-assistente .bolla {
  background: var(--blu-chiaro);
  color: var(--testo);
  border-bottom-left-radius: 6px;
}

.da-utente {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.da-utente .bolla {
  background: var(--blu);
  color: var(--bianco);
  border-bottom-right-radius: 6px;
}

.scrivendo .bolla {
  display: flex;
  gap: 5px;
  padding: 15px;
}

.scrivendo span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blu);
  opacity: 0.45;
  animation: punti 1.2s infinite;
}

.scrivendo span:nth-child(2) {
  animation-delay: 0.18s;
}
.scrivendo span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes punti {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-4px);
    opacity: 0.9;
  }
}

.errore .bolla {
  background: #fff1e8;
  color: #92400e;
  border: 1px solid #fcd9b6;
}

/* -------------------------------------------------------------------- chip */

.chip-riga {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 0;
}

.chip-riga:empty {
  padding: 0;
}

.chip {
  appearance: none;
  border: 1.5px solid var(--blu);
  background: var(--bianco);
  color: var(--blu);
  border-radius: 999px;
  padding: 8px 15px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chip:hover:not(:disabled) {
  background: var(--blu);
  color: var(--bianco);
}

.chip:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ------------------------------------------------------------------ upload */

.upload {
  padding: 12px 16px 0;
}

.upload-pulsante {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px dashed var(--arancio);
  color: var(--arancio-scuro);
  background: #fff8f2;
  border-radius: var(--raggio);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.upload-pulsante input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-pulsante:focus-within {
  outline: 3px solid var(--giallo);
  outline-offset: 2px;
}

.upload-stato {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--testo-tenue);
}

/* ---------------------------------------------------------------- composer */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--bordo);
  margin-top: 12px;
}

.composer textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 13px 15px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  max-height: 140px;
  color: var(--testo);
  background: var(--bianco);
}

.composer textarea:focus {
  outline: none;
  border-color: var(--blu);
  box-shadow: 0 0 0 3px rgba(11, 46, 107, 0.12);
}

.invia {
  flex: none;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--arancio);
  color: var(--bianco);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
}

.invia:hover:not(:disabled) {
  background: var(--arancio-scuro);
}

.invia:disabled {
  background: #d7dde7;
  cursor: default;
}

/* --------------------------------------------------------------- riepilogo */

.riepilogo {
  background: var(--bianco);
  border: 1.5px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 16px;
  max-width: min(92%, 480px);
}

.riepilogo h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--blu);
}

.riepilogo label {
  display: block;
  margin-bottom: 11px;
}

.riepilogo label span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--testo-tenue);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.riepilogo input,
.riepilogo textarea,
.riepilogo select {
  width: 100%;
  border: 1.5px solid var(--bordo);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.95rem;
  background: var(--bianco);
  color: var(--testo);
}

.riepilogo input:focus,
.riepilogo textarea:focus,
.riepilogo select:focus {
  outline: none;
  border-color: var(--blu);
  box-shadow: 0 0 0 3px rgba(11, 46, 107, 0.12);
}

.consenso {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--blu-chiaro);
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0;
  font-size: 0.88rem;
}

.consenso input {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  accent-color: var(--blu);
}

.conferma {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: var(--arancio);
  color: var(--bianco);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
}

.conferma:hover:not(:disabled) {
  background: var(--arancio-scuro);
}

.conferma:disabled {
  background: #d7dde7;
  cursor: default;
}

.fatto {
  text-align: center;
  padding: 28px 16px;
}

.fatto-icona {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--giallo);
  color: var(--blu);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  font-size: 1.7rem;
  font-weight: 700;
}

.fatto h2 {
  margin: 0 0 6px;
  color: var(--blu);
  font-size: 1.25rem;
}

.fatto p {
  margin: 0;
  color: var(--testo-tenue);
}

/* ----------------------------------------------------------------- azioni */

.azioni {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.azione {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 999px;
  padding: 13px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
}

.azione-primaria {
  background: var(--bianco);
  color: var(--blu);
  border-color: var(--blu);
}

.azione-primaria:hover {
  background: var(--blu);
  color: var(--bianco);
}

.azione-whatsapp {
  background: #25d366;
  color: #06331a;
}

.azione-whatsapp:hover {
  background: #1fbb59;
}

.nota {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--testo-tenue);
}

.nota a,
.pie a {
  color: var(--blu);
}

.pie {
  text-align: center;
  padding: 18px 16px 26px;
  font-size: 0.82rem;
  color: var(--testo-tenue);
}

.pie p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--giallo);
  outline-offset: 2px;
}

/* Campo trappola per i bot: fuori schermo ma presente nel DOM. */
.trappola {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ------------------------------------------------------- pagina privacy --- */

.documento {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.documento h1 {
  color: var(--blu);
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.documento h2 {
  color: var(--blu);
  font-size: 1.05rem;
  margin-top: 28px;
}

.documento ul {
  padding-left: 20px;
}

.da-completare {
  background: #fff8e6;
  border: 1.5px solid var(--giallo);
  border-radius: var(--raggio);
  padding: 14px 16px;
  margin: 18px 0;
}

.da-completare p {
  margin: 0 0 8px;
}

.da-completare p:last-child {
  margin-bottom: 0;
}

.torna {
  display: inline-block;
  margin-top: 28px;
  font-weight: 700;
  color: var(--blu);
}

.aggiornamento {
  color: var(--testo-tenue);
  font-size: 0.88rem;
  margin-top: 0;
}

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