/* ============================================================
   HWN Security Audit — Frontend CSS
   Design system coerente con le pagine Helpwebnet:
   · Font: DM Serif Display + DM Sans (Google Fonts)
   · Palette: --hwn-navy / --hwn-accent / --hwn-cream
   · Scoped su .hwn-audit-wrap
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variabili ── */
.hwn-audit-wrap {
  --hwn-navy:      #0d1b2a;
  --hwn-navy-mid:  #1a2e42;
  --hwn-accent:    #e8572a;
  --hwn-accent-lt: #ff7a50;
  --hwn-cream:     #f8f5f0;
  --hwn-muted:     #5a6474;
  --hwn-border:    #e2ddd8;
  --hwn-white:     #ffffff;
  --hwn-green:     #1a6b4a;
  --hwn-red:       #dc2626;
  --hwn-yellow:    #ca8a04;

  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--hwn-navy);

  max-width: 760px;
  margin: 3rem auto;
  background: var(--hwn-white);
  border-radius: 20px;
  box-shadow: 0 8px 48px rgba(13,27,42,.12);
  overflow: hidden;
  position: relative;
}
.hwn-audit-wrap *, .hwn-audit-wrap *::before, .hwn-audit-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Progress bar ── */
.hwn-audit-progress-wrap {
  height: 4px;
  background: var(--hwn-cream);
}
.hwn-audit-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--hwn-accent), var(--hwn-accent-lt));
  width: 0%;
  transition: width .4s ease;
}

/* ── Steps ── */
.hwn-step { display: none; }
.hwn-step.active {
  display: block;
  animation: hwn-fadein .3s ease;
}
@keyframes hwn-fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hwn-step-inner { padding: 3rem; }
@media (max-width: 600px) {
  .hwn-step-inner { padding: 2rem 1.5rem; }
}

/* ============================================================
   STEP 0 — BENVENUTO
   ============================================================ */
.hwn-step-welcome { text-align: center; background: var(--hwn-navy); }

.hwn-audit-shield {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1.5rem;
}

/* H1 stile DM Serif come le pagine del sito */
.hwn-audit-wrap h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  color: var(--hwn-white);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: .75rem;
}
.hwn-audit-wrap h1 em {
  color: var(--hwn-accent-lt);
  font-style: italic;
}

.hwn-audit-subtitle {
  color: rgba(255,255,255,.7);
  font-size: 17px;
  line-height: 1.8;
  max-width: 520px;
  margin: 0 auto 2.5rem;
}

/* Feature pills — stile coerente con le hero card */
.hwn-audit-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}
.hwn-feat {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: 14px;
  color: rgba(255,255,255,.8);
  font-weight: 500;
  text-align: left;
}
.hwn-feat span:first-child { font-size: 18px; flex-shrink: 0; }

/* Campo azienda */
.hwn-audit-field-group {
  text-align: left;
  max-width: 480px;
  margin: 0 auto 1.75rem;
}
.hwn-audit-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  margin-bottom: .6rem;
}
/* Su sfondi chiari (step verify/submit) */
.hwn-step-verify .hwn-audit-label,
.hwn-step-submit .hwn-audit-label {
  color: var(--hwn-muted);
}
.hwn-req { color: var(--hwn-accent-lt); }

.hwn-audit-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 10px;
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  color: var(--hwn-white);
  background: rgba(255,255,255,.08);
  transition: border-color .2s, box-shadow .2s, background .2s;
  margin-bottom: 1rem;
}
.hwn-audit-input::placeholder { color: rgba(255,255,255,.3); }
.hwn-audit-input:focus {
  outline: none;
  border-color: var(--hwn-accent-lt);
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 3px rgba(232,87,42,.2);
}
/* Input su sfondo chiaro */
.hwn-step-verify .hwn-audit-input,
.hwn-step-submit .hwn-audit-input {
  color: var(--hwn-navy);
  background: var(--hwn-white);
  border-color: var(--hwn-border);
}
.hwn-step-verify .hwn-audit-input::placeholder,
.hwn-step-submit .hwn-audit-input::placeholder { color: var(--hwn-muted); }
.hwn-step-verify .hwn-audit-input:focus,
.hwn-step-submit .hwn-audit-input:focus {
  border-color: var(--hwn-accent);
  box-shadow: 0 0 0 3px rgba(232,87,42,.1);
  background: var(--hwn-white);
}

.hwn-audit-input.hwn-otp-input {
  font-size: 30px;
  letter-spacing: 14px;
  text-align: center;
  font-weight: 700;
  font-family: monospace;
}
.hwn-audit-hint {
  font-size: 13px;
  color: rgba(255,255,255,.4);
  margin-top: -6px;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* ── Bottoni — identici alle pagine del sito ── */
.hwn-audit-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--hwn-accent);
  color: var(--hwn-white);
  border: none;
  border-radius: 8px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background .2s, transform .15s;
  text-decoration: none;
  width: 100%;
  margin-bottom: .5rem;
}
.hwn-audit-btn-primary:hover {
  background: var(--hwn-accent-lt);
  transform: translateY(-1px);
  color: var(--hwn-white);
}
.hwn-audit-btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.hwn-audit-btn-primary.hwn-btn-large {
  padding: 18px 40px;
  font-size: 17px;
}
.hwn-arrow { transition: transform .2s; }
.hwn-audit-btn-primary:hover .hwn-arrow { transform: translateX(4px); }

.hwn-audit-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  text-decoration: none;
}
.hwn-audit-btn-secondary:hover {
  border-color: rgba(255,255,255,.7);
  color: var(--hwn-white);
}
/* Btn secondario su sfondo chiaro */
.hwn-step-verify .hwn-audit-btn-secondary {
  color: var(--hwn-navy);
  border-color: var(--hwn-border);
}
.hwn-step-verify .hwn-audit-btn-secondary:hover {
  border-color: var(--hwn-accent);
  color: var(--hwn-accent);
}

.hwn-audit-btn-link {
  background: none;
  border: none;
  color: var(--hwn-muted);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  padding: .4rem;
  text-decoration: underline;
  display: block;
  margin: .25rem auto 0;
}
.hwn-audit-btn-link:hover { color: var(--hwn-accent); }

.hwn-audit-legal {
  font-size: 12px;
  color: rgba(255,255,255,.35);
  margin-top: 1.25rem;
  line-height: 1.6;
}
.hwn-audit-legal a { color: rgba(255,255,255,.6); text-decoration: underline; }

/* ============================================================
   STEP 1–6 — QUESTIONARIO
   ============================================================ */

/* Header area — sfondo navy come le sezioni del sito */
.hwn-audit-area-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--hwn-navy);
  margin: -3rem -3rem 2.5rem;
  padding: 1.75rem 3rem;
}
@media (max-width: 600px) {
  .hwn-audit-area-header { margin: -2rem -1.5rem 2rem; padding: 1.25rem 1.5rem; }
}
.hwn-area-icon { font-size: 2.2rem; }
.hwn-area-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 3px;
}
.hwn-area-label {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem;
  color: var(--hwn-white);
  line-height: 1.2;
}

/* Blocco domanda */
.hwn-question-block { margin-bottom: 2.5rem; }
.hwn-question-block + .hwn-question-block {
  padding-top: 2.5rem;
  border-top: 1px solid var(--hwn-border);
}

.hwn-question-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--hwn-navy);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.hwn-q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  background: var(--hwn-accent);
  color: var(--hwn-white);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Opzioni — stile coerente con le card del sito */
.hwn-options { display: flex; flex-direction: column; gap: .6rem; }

.hwn-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--hwn-cream);
  border: 1.5px solid var(--hwn-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s, color .2s;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  color: var(--hwn-navy);
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  width: 100%;
  position: relative;
  box-shadow: none;
  text-transform: none;
}
.hwn-audit-wrap button.hwn-option:hover,
.hwn-audit-wrap button.hwn-option:focus,
.hwn-audit-wrap button.hwn-option:focus-visible {
  border-color: var(--hwn-accent);
  background: var(--hwn-white);
  color: var(--hwn-navy);
  transform: translateX(3px);
}
.hwn-audit-wrap button.hwn-option.selected,
.hwn-audit-wrap button.hwn-option.selected:hover,
.hwn-audit-wrap button.hwn-option.selected:focus {
  border-color: var(--hwn-accent);
  background: var(--hwn-white);
  color: var(--hwn-navy);
  box-shadow: 0 2px 12px rgba(232,87,42,.1);
}
.hwn-option.selected::after {
  content: '✓';
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hwn-accent);
  font-weight: 700;
  font-size: 16px;
}
.hwn-opt-bullet {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--hwn-border);
  flex-shrink: 0;
  margin-top: 2px;
  transition: border-color .2s, background .2s;
}
.hwn-option.selected .hwn-opt-bullet {
  border-color: var(--hwn-accent);
  background: var(--hwn-accent);
}

/* Navigazione aree */
.hwn-audit-nav {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hwn-border);
}
.hwn-audit-nav .hwn-audit-btn-primary  { flex: 2; }
.hwn-audit-nav .hwn-audit-btn-secondary { flex: 1; }

/* ============================================================
   STEP VERIFICA (telefono + email) — sfondo crema
   ============================================================ */
.hwn-step-verify {
  background: var(--hwn-cream);
  text-align: center;
}

.hwn-verify-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1.5rem;
}

.hwn-audit-wrap h2 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--hwn-navy);
  line-height: 1.2;
  letter-spacing: -.01em;
  margin-bottom: .75rem;
}
.hwn-audit-wrap h2 em { color: var(--hwn-accent); font-style: italic; }

.hwn-verify-desc {
  font-size: 16px;
  color: var(--hwn-muted);
  line-height: 1.75;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.hwn-otp-wrap {
  max-width: 380px;
  margin: 0 auto;
}
.hwn-step-verify .hwn-audit-hint {
  color: var(--hwn-muted);
  margin-top: .5rem;
}

.hwn-email-display {
  background: var(--hwn-white);
  border: 1.5px solid var(--hwn-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.hwn-email-display-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--hwn-muted);
  margin-bottom: .35rem;
}
.hwn-email-display strong {
  display: block;
  font-size: 16px;
  color: var(--hwn-navy);
  word-break: break-all;
}

.hwn-otp-wrap.hidden { display: none !important; }

/* ============================================================
   STEP SUBMIT — sfondo bianco
   ============================================================ */
.hwn-step-submit { text-align: center; }

.hwn-audit-summary {
  background: var(--hwn-cream);
  border: 1px solid var(--hwn-border);
  border-radius: 16px;
  padding: 1.75rem;
  max-width: 440px;
  margin: 0 auto 2rem;
  text-align: left;
}
.hwn-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--hwn-border);
  font-size: 14px;
  font-weight: 500;
}
.hwn-summary-row:last-child { border-bottom: none; }
.hwn-summary-row span { color: var(--hwn-muted); }
.hwn-summary-row strong { color: var(--hwn-navy); font-weight: 700; }

/* ============================================================
   STEP DONE — sfondo navy come la final CTA del sito
   ============================================================ */
.hwn-audit-wrap .hwn-step-done {
  background: var(--hwn-navy);
  text-align: center;
  color: rgba(255, 255, 255, .85);
}
.hwn-audit-wrap .hwn-step-done h2 {
  color: var(--hwn-white);
}
.hwn-audit-wrap .hwn-step-done .hwn-verify-desc,
.hwn-audit-wrap .hwn-step-done #hwn-done-message {
  color: rgba(255, 255, 255, .78);
}

.hwn-done-checkmark {
  width: 80px;
  height: 80px;
  color: #4ade80;
  margin: 0 auto 1.5rem;
}
.hwn-done-checkmark svg { width: 100%; height: 100%; }

.hwn-done-ctas {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-width: 460px;
  margin: 2rem auto 1.5rem;
}

.hwn-audit-wrap .hwn-step-done .hwn-done-ctas a.hwn-audit-btn-primary {
  background: var(--hwn-accent);
  color: #fff;
  border: none;
  text-decoration: none;
}
.hwn-audit-wrap .hwn-step-done .hwn-done-ctas a.hwn-audit-btn-primary:hover,
.hwn-audit-wrap .hwn-step-done .hwn-done-ctas a.hwn-audit-btn-primary:focus {
  background: var(--hwn-accent-lt);
  color: #fff;
  text-decoration: none;
}

.hwn-audit-wrap .hwn-step-done .hwn-done-ctas a.hwn-audit-btn-secondary {
  color: rgba(255, 255, 255, .88);
  border-color: rgba(255, 255, 255, .35);
  background: transparent;
  text-decoration: none;
}
.hwn-audit-wrap .hwn-step-done .hwn-done-ctas a.hwn-audit-btn-secondary:hover,
.hwn-audit-wrap .hwn-step-done .hwn-done-ctas a.hwn-audit-btn-secondary:focus {
  color: #fff;
  border-color: rgba(255, 255, 255, .65);
  background: rgba(255, 255, 255, .06);
  text-decoration: none;
}

.hwn-audit-wrap .hwn-step-done .hwn-done-footer {
  margin-top: 1.5rem;
  font-size: 14px;
  color: rgba(255, 255, 255, .65);
  line-height: 1.6;
}
.hwn-audit-wrap .hwn-step-done .hwn-done-footer a {
  color: var(--hwn-accent-lt);
  font-weight: 600;
  text-decoration: none;
}
.hwn-audit-wrap .hwn-step-done .hwn-done-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ============================================================
   TOAST + LOADER
   ============================================================ */
#hwn-audit-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hwn-navy);
  color: var(--hwn-white);
  padding: 1rem 1.75rem;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  z-index: 99999;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  text-align: center;
  max-width: min(90vw, 480px);
}
#hwn-audit-toast.error   { background: var(--hwn-red); }
#hwn-audit-toast.success { background: var(--hwn-green); }
#hwn-audit-toast.visible { opacity: 1; }

.hwn-audit-loader {
  position: absolute;
  inset: 0;
  background: rgba(248,245,240,.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 100;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.hwn-audit-loader.active { display: flex; }
.hwn-audit-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--hwn-border);
  border-top-color: var(--hwn-accent);
  border-radius: 50%;
  animation: hwn-spin .8s linear infinite;
}
@keyframes hwn-spin { to { transform: rotate(360deg); } }
.hwn-audit-loader p {
  font-family: 'DM Serif Display', serif;
  font-size: 16px;
  font-style: italic;
  color: var(--hwn-navy);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .hwn-audit-features { grid-template-columns: 1fr; }
  .hwn-audit-wrap h1  { font-size: 1.75rem; }
  .hwn-audit-area-header { gap: 10px; }
  .hwn-area-label { font-size: 1.1rem; }
  .hwn-audit-nav { flex-direction: column-reverse; }
  .hwn-audit-nav .hwn-audit-btn-primary,
  .hwn-audit-nav .hwn-audit-btn-secondary { flex: none; width: 100%; }
}
