/* =========================================
   1. IMPORT FONT & VARIABILI GLOBALI
   ========================================= */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Montserrat:wght@600;700&display=swap");

:root {
  /* Colori Brand */
  --brand-blue: #028bd1;
  --brand-orange: #f77b3c;

  /* Colori UI */
  --bg-color: #f4f7f9;
  --card-bg: #ffffff;
  --text-main: #2c3e50;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --error-bg: #fee2e2;
  --error-text: #dc2626;

  /* Tipografia */
  --font-heading: "Montserrat", sans-serif;
  --font-body: "Inter", sans-serif;
}

/* =========================================
   2. RESET E IMPOSTAZIONI BASE
   ========================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;

  /* IL TRUCCO PER IL CENTRAMENTO ASSOLUTO DELLA CARD */
  display: grid;
  place-items: center; /* Centra la card perfettamente in verticale e orizzontale */
  min-height: 100vh; /* Prende tutta l'altezza dello schermo */
  margin: 0; /* Elimina i margini di default dei browser */
  padding: 20px;
}

/* =========================================
   3. ANIMAZIONE "FAKE SPA"
   ========================================= */
@keyframes fadeInSlideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Il contenitore principale che avrà l'effetto scivolamento */
.card-container {
  background: var(--card-bg);
  width: 100%;
  max-width: 700px; /* Dimensione perfetta per un form centrato */
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  /* Applica l'animazione al caricamento della pagina */
  animation: fadeInSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.card-container h3 {
  margin-top: 40px; /* <-- Distanza dal paragrafo precedente */
  margin-bottom: 24px; /* <-- Distanza dal bottone sottostante */
  color: #666666;
}

/* =========================================
   4. HEADER E LOGHI
   ========================================= */
.header-loghi {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 700px;
  margin-bottom: 48px;
}

.header-loghi img {
  max-height: 40px;
  width: auto;
}

/* =========================================
   ADATTAMENTO SMARTPHONE (Loghi)
   ========================================= */
@media (max-width: 480px) {
  .header-loghi img {
    max-height: 24px; /* Riduce entrambi i loghi in modo proporzionale */
  }
}

/* =========================================
   5. TIPOGRAFIA
   ========================================= */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--brand-blue);
  margin-bottom: 16px;
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
}
h2 {
  font-size: 1.5rem;
}
h3 {
  font-size: 1.25rem;
}
h4 {
  font-size: 1.1rem;
}

p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* =========================================
   6. FORM E INPUT
   ========================================= */

/* Struttura a colonne per il form */
.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1; /* Fa dividere lo spazio esattamente a metà */
}

/* Su schermi piccoli (smartphone), li rimettiamo uno sotto l'altro */
@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all 0.3s ease;
}

input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(2, 139, 209, 0.15);
}

/* =========================================
   7. BOTTONI E MESSAGGI D'ERRORE
   ========================================= */
.btn-primary {
  display: inline-block;
  width: 100%;
  background-color: var(--brand-blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    transform 0.1s ease;
  text-align: center;
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--brand-orange);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background-color: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* Box per gli errori di compilazione/server */
#errore {
  display: none;
  background-color: var(--error-bg);
  color: var(--error-text);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
  font-size: 0.9rem;
  text-align: center;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* =========================================
   8. STEPPER DI NAVIGAZIONE
   ========================================= */
.stepper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 32px; /* Diamo un po' di respiro sotto il bottone */
}

.step {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(
    --border-color
  ); /* Grigio neutro per i passaggi futuri */
  transition: all 0.3s ease;
}

/* Il pallino della pagina in cui ci troviamo */
.step.active {
  background-color: var(--brand-blue);
  transform: scale(1.3); /* Lo facciamo leggermente più grande */
}

/* Opzionale: Il pallino dei passaggi già completati */
.step.completed {
  background-color: var(--brand-orange);
}

/* Bottoni disabilitati: la blindatura totale */
.btn-primary:disabled,
.btn-primary.disabled {
  background-color: var(--border-color) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed !important;
  transform: none !important;
  pointer-events: none !important; /* Impedisce qualsiasi interazione o click */
}

.link-salvataggio {
  display: block;
  text-align: center;
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.link-salvataggio a {
  color: var(--brand-blue);
  font-weight: 700;
  text-decoration: none;
}
.link-salvataggio a:hover {
  text-decoration: underline;
}