/* === DM Sans (self-hosted) === */
@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/DMSans-Regular.woff2') format('woff2'),
       url('../fonts/DMSans-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/DMSans-Medium.woff2') format('woff2'),
       url('../fonts/DMSans-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/DMSans-Bold.woff2') format('woff2'),
       url('../fonts/DMSans-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* === Rendering più nitido === */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Base globale === */
body {
  margin: 0;
  padding: 0;
  font-family: 'DM Sans', Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.2px;
  background: #cb0000;     /* Rosso Vodafone */
  color: #000;
}

/* ===== Header ===== */
#logo-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #fff;
  padding: 5px 30px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
}

#logo-container img {
  max-height: 40px;
  max-width: 45%;
  object-fit: contain;
  height: auto;
  width: auto;
}

/* ===== Chatbox ===== */
#chat-container {
  display: flex;
  justify-content: center;
  padding: 5px;
   background: linear-gradient(180deg, #FF1A1A 0%, #CC0000 100%);
}

#chat-box {
  width: 100%;
  max-width: 480px;
  height: 60vh;
  margin: 0 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5px;
  scrollbar-width: none;
}

#chat-box::-webkit-scrollbar {
  display: none;
}

/* ===== Messaggi ===== */
.message-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  margin: 5px 0;
  animation: fadeIn 0.35s ease-in-out;
}

.bot-avatar {
  width: 40px;
  height: 40px;
  margin-right: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: contain;
  align-self: flex-end;
  transform: translateY(2px); /* più dolce */
  transition: transform 0.3s ease; /* effetto morbido se la bolla si muove */
}




.user-message {
  align-self: flex-end;
  background-color: #29b3a3;
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 15px;
  max-width: 80%;
   margin: 6px 0 12px 0; /* un po’ più spazio sotto l’input */
  animation: fadeIn 0.25s ease-in-out;
}

/* ===== Strong e Emoji ===== */
.bot-message strong {
  font-weight: 600;
}

.bot-message emoji,
.bot-message span,
.bot-message img.emoji {
  vertical-align: middle;
  transform: scale(0.95);
}




/* ===== Input (CAP o Numero) ===== */
.input-container {
  background: #fff;
  color: #000;
  padding: 15px 20px;
  border-radius: 25px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  max-width: 85%;
  margin-left: 50px;     /* nuovo: allinea alla colonna bot */
  text-align: left;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease forwards;
}


.input-container input {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 10px;
  font-size: 15px;
  margin-bottom: 8px;
  box-sizing: border-box;
  outline: none;
}

.input-container input:focus {
  border-color: #d20707;
  box-shadow: 0 0 4px rgba(210, 7, 7, 0.3);
}

.input-container button {
  width: 100%;
  background: linear-gradient(90deg, #FF2B2B 0%, #D90000 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.input-container button:hover {
  background-color: #001a33;
}

/* Privacy */
.privacy-container {
  margin-top: 8px;
  font-size: 12px;
  color: #666;
  text-align: left;
}

.privacy-container a {
  color: #006273;
  text-decoration: underline;
  font-weight: 500;
}

/* ===== Pulsanti (Sì / No) ===== */
.button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
}

.button-container button {
  background: #0a1f44;
  color: #fff;
  border: 2px solid #0a1f44;
  border-radius: 25px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 150px;
  text-align: center;
  line-height: 1.2;
  transition: all 0.3s ease;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.button-container button:hover {
  background: #122b57;
  border-color: #122b57;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.button-container button small {
  display: block;
  font-size: 13px;
  margin-top: 3px;
  font-weight: 400;
  color: #bcd4ff;
}



/* ===== Footer ===== */
#footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 5px;
  text-align: center;
  font-size: 10px;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* ===== Animazioni ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #chat-box { max-width: 100%; padding:5px; }
  .card { font-size: 14.5px; }
  .card h4 { font-size: 15px; }
  .card .price { font-size: 16px; }
}

@media (min-width: 768px) {
  .bot-message {
    font-size: 17px;
    line-height: 1.5;
    padding: 15px 20px;
  }
}

@media (max-width: 480px) {
  .button-container button {
    width: 45%;  /* entrambi entrano su una riga */
    font-size: 14px;
  }
}


.input-container input {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 10px;
  font-size: 15px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.input-container button {
  width: 100%;
  background-color: #193755;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.input-container button:hover {
  background-color: #001a33;
}

/* Allinea l'input (numero o CAP) con le bolle del bot */
#numero-input-container {
  margin-left: 50px;   /* distanza identica allo spazio dell’avatar */
  max-width: 85%;      /* stessa larghezza delle bot-message */
  text-align: left;    /* allinea il testo internamente a sinistra */
  width: 100%;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease forwards;
}

/* Allinea i pulsanti (Sì/No) come le bot-message */
.button-container {
  justify-content: flex-start;  /* allinea a sinistra come le bolle */
  margin-left: 50px;            /* stesso spazio dell'avatar */
  max-width: 85%;               /* stessa larghezza visiva */
  text-align: left;
}
@media (max-width: 480px) {
  .button-container {
    flex-direction: column;
    align-items: flex-start; /* mantiene l’allineamento a sinistra */
    gap: 10px;
  }

  .button-container button {
    width: 100%;
  }
}

/* Pulsanti allineati alla colonna del bot */
.button-container {
  display: flex;
  flex-direction: row;      /* orizzontali */
  justify-content: flex-start; /* allineati come le bot-message */
  align-items: flex-start;
  gap: 10px;                /* spazio tra i due */
  margin: 6px 0 6px 50px;   /* offset avatar */
  max-width: 85%;           /* stessa larghezza delle bolle bot */
}

/* Stile pulsanti */
.button-container button {
  flex: 1;                  /* stessa larghezza per entrambi */
  text-align: center;
  background: #0a1f44;
  color: #fff;
  border: 2px solid #0a1f44;
  border-radius: 25px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  min-width: 120px;         /* evita che si comprimano troppo su schermi piccoli */
}

/* Hover */
.button-container button:hover {
  background: #122b57;
  border-color: #122b57;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Testo secondario */
.button-container button small {
  display: block;
  font-size: 13px;
  margin-top: 3px;
  font-weight: 400;
  color: #bcd4ff;
}

.bot-message.followed-by-input {
  margin-left: 50px;   /* allinea come la bolla input */
  max-width: 85%;      /* stessa larghezza visiva */
}
.error-message {
  display: block;
  
  font-weight: 500;
  margin-top: 6px;
  margin-bottom: 8px;
  text-align: left;
  padding-left: 4px;
  transition: all 0.2s ease-in-out;
  color: red;
  font-size: 12px;
}

input.error {
  border: 1.5px solid #e60000 !important; /* rosso brand solo sul bordo */
  box-shadow: 0 0 6px rgba(230, 0, 0, 0.25);
}



/* piccolo tocco di animazione */
.error-message.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}





/* ======================================================
   🫧 Effetti dolci per bolla e pallini (by Horizon)
   ====================================================== */

/* 🌱 Fase iniziale: la bolla si gonfia piano da piccola */
.bot-message {
  background: #fff;
  color: #000;
  padding: 10px 15px;
  border-radius: 25px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  max-width: 90%;
  font-size: 16px;
  animation: bubbleAppear 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform-origin: bottom left;
  backface-visibility: hidden;
}

/* 🌬️ Fase “gonfiaggio dolce” */
@keyframes bubbleAppear {
  0%   { transform: scale(0.3) translateY(15px); opacity: 0; }
  50%  { transform: scale(0.8) translateY(5px); opacity: 0.7; }
  80%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 💭 Bolla typing (3 pallini) */
.bot-message.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 28px;

  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  animation: bubbleAppear 0.4s ease-out;
  transition: all 0.6s ease;
   border-radius: 25px 25px 25px 0px;
}

/* 🌈 Transizione quando da typing diventa messaggio */
.bot-message.expanded {
  width: auto;
  height: auto;
  padding: 12px 18px;
  border-radius: 26px;
  transition: all 0.6s ease-in-out;
}

/* ⚪ I tre pallini del loader */
.typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 14px;
}

.typing-indicator span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #000;
  opacity: 0.25;
  transform: scale(0.7);
  animation: typingSoft 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

.typing-indicator span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #000;
  opacity: 0.25;
  transform: scale(0.7);
  animation: waveTyping 1.8s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes waveTyping {
  0%, 80%, 100% {
    transform: translateY(0px) scale(0.7);
    opacity: 0.25;
  }
  40% {
    transform: translateY(-6px) scale(1);
    opacity: 0.9;
  }
}


/* 🧡 Testo: entra senza “flash”, ma dolcemente */
.bot-message.expanded p,
.bot-message.expanded span,
.bot-message.expanded strong {
  animation: fadeInTextSoft 0.5s ease forwards;
}

@keyframes fadeInTextSoft {
  0%   { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Evita scatti di repaint durante le animazioni */
.animated {
  -webkit-transform: translateZ(0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


.tease {
  text-align: center;
  color: #d60000; /* rosso Vodafone */
  font-weight: 600;
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.4;
}
/* === OFFERTA CHAT NATURALE === */
.offer-message {
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 12px 0 !important;
  color: #000;
  font-size: 15px;
  line-height: 1.45;
}

.offer-message strong {
  color: #000;
  font-weight: 600;
}

.offer-message s {
  color: #999;
}
@media (max-width: 768px) {
  #footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    text-align: center;
    background: #fff;
    padding: 11px;
    font-size: 11px;
    color: #193755;
    box-sizing: border-box;
  }
}