/* ══════════════════════════════════════════════════════
   Mad MKTG Profile  v4.0.0 — Frontend
   Studio Alterego — M. D'Andrea
   ══════════════════════════════════════════════════════ */

/* ── Design tokens (overridden inline by PHP settings) ── */
.madmp-wrapper {
  --mp-primary:    #1a1d2e;
  --mp-accent:     #1d4ed8;
  --mp-bg:         #f5f6fa;
  --mp-surface:    #ffffff;
  --mp-border:     #e2e5ec;
  --mp-text:       #1a1d2e;
  --mp-muted:      #6b7280;
  --mp-radius:     12px;
  --mp-radius-box: 20px;
  --mp-bar-high:   #1d4ed8;
  --mp-bar-low:    #38bdf8;
  --mp-bar-h:      280px;
  --mp-bar-r:      4px;
  --mp-font:       inherit;
  --mp-fsize:      15px;
  --mp-fsize-q:    15px;
  --mp-fw:         600;
  --mp-max-w:      780px;

  /* transizione stage */
  --mp-slide-dur:  480ms;
  --mp-ease:       cubic-bezier(.4,0,.2,1);
}

/* ── Box sizing ── */
.madmp-wrapper *,
.madmp-wrapper *::before,
.madmp-wrapper *::after { box-sizing: border-box; }

.madmp-wrapper {
  font-family: var(--mp-font);
  font-size:   var(--mp-fsize);
  color:       var(--mp-text);
  line-height: 1.65;
  /* occupa tutto il viewport */
  position:    relative;
  overflow:    hidden;
}

/* ══════════════════════════════════════════════════════
   STAGE — contenitore che si muove tra le schermate
══════════════════════════════════════════════════════ */
.madmp-stage {
  display: flex;
  width:   300%;          /* 3 schermate side-by-side */
  transition: transform var(--mp-slide-dur) var(--mp-ease);
  will-change: transform;
}

/* stato JS: .madmp-stage[data-current="1"] → translate 0
            .madmp-stage[data-current="2"] → translate -33.333%
            .madmp-stage[data-current="3"] → translate -66.666% */
.madmp-stage[data-current="1"] { transform: translateX(0%); }
.madmp-stage[data-current="2"] { transform: translateX(-33.3333%); }
.madmp-stage[data-current="3"] { transform: translateX(-66.6666%); }

/* ── Ogni schermata occupa esattamente 1/3 dello stage ── */
.madmp-slide {
  width:      33.3333%;
  min-height: 100vh;
  flex-shrink: 0;
  display:    flex;
  flex-direction: column;
  background: var(--mp-bg);
}

/* ── Inner scroll per slide 1 e 3 ── */
.madmp-slide-inner {
  flex: 1;
  overflow-y: auto;
  max-width:  var(--mp-max-w);
  margin:     0 auto;
  width:      100%;
  padding:    48px 28px 64px;
}
.madmp-slide-inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 28px;
}

/* ══════════════════════════════════════════════════════
   HEADER BRAND + STEP INDICATOR
══════════════════════════════════════════════════════ */
.madmp-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.madmp-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.madmp-logo-icon { font-size: 22px; line-height: 1; }
.madmp-logo-text {
  font-size:   18px;
  font-weight: var(--mp-fw);
  color:       var(--mp-text);
  letter-spacing: -.3px;
}
.madmp-logo--sm .madmp-logo-text { font-size: 15px; }
.madmp-logo--sm .madmp-logo-icon { font-size: 17px; }

/* Step dots */
.madmp-steps {
  display: flex;
  align-items: center;
  gap: 0;
}
.madmp-step {
  width:  32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--mp-border);
  background: var(--mp-surface);
  color: var(--mp-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  transition: background .3s, border-color .3s, color .3s, transform .3s;
  position: relative;
}
/* tooltip label */
.madmp-step::after {
  content: attr(data-label);
  position: absolute;
  bottom: -18px;
  left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--mp-muted);
  white-space: nowrap; font-weight: 500;
}
.madmp-step--active {
  background: var(--mp-accent);
  border-color: var(--mp-accent);
  color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--mp-accent) 18%, transparent);
}
.madmp-step--done {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}
.madmp-step-line {
  width: 40px; height: 2px;
  background: var(--mp-border);
  flex-shrink: 0;
  transition: background .3s;
}
.madmp-step-line--done { background: #22c55e; }

/* Step indicator compatto (topbar slide 2) */
.madmp-steps--sm .madmp-step { width: 24px; height: 24px; font-size: 10px; }
.madmp-steps--sm .madmp-step::after { display: none; }
.madmp-steps--sm .madmp-step-line { width: 28px; }

/* ══════════════════════════════════════════════════════
   SCHERMATA 1 — INTRO / DATI
══════════════════════════════════════════════════════ */
#madmp-slide-1 {
  background: #1a1d2e;
}
#madmp-slide-1 .madmp-slide-inner {
  background: #1a1d2e;
  border-radius: var(--mp-radius-box);
  margin: 32px auto;
  padding: 48px 52px 56px;
  box-shadow: 0 16px 64px rgba(0,0,0,.2);
  max-height: calc(130vh - 64px);
  overflow-y: auto;
}
#madmp-slide-1 .madmp-logo-text { color: var(--mp-text); }

.madmp-hero { margin-bottom: 32px; }
.madmp-hero-title {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--mp-text);
  margin: 0 0 12px;
}
.madmp-hero-sub {
  font-size: var(--mp-fsize);
  color: var(--mp-muted);
  margin: 0;
  line-height: 1.7;
}
.madmp-hero-sub strong { color: var(--mp-text); }

/* Guide */
.madmp-guide {
  display: flex;
  gap: 16px;
  background: color-mix(in srgb, var(--mp-bg) 60%, var(--mp-surface));
  border: 1px solid var(--mp-border);
  border-left: 4px solid var(--mp-primary);
  border-radius: var(--mp-radius);
  padding: 20px 22px;
  margin-bottom: 32px;
}
.madmp-guide-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.madmp-guide-title {
  display: block;
  font-size: 14px; font-weight: var(--mp-fw);
  color: var(--mp-text); margin-bottom: 10px;
}
.madmp-guide-list {
  margin: 0; padding-left: 18px;
  color: var(--mp-muted); font-size: 14px;
}
.madmp-guide-list li { margin-bottom: 6px; }
.madmp-guide-list li strong { color: var(--mp-text); }
.madmp-guide-note {
  margin: 10px 0 0; font-size: 12px;
  color: var(--mp-muted); font-style: italic;
}

/* Form */
.madmp-form-box { margin-bottom: 32px; }
.madmp-form-intro {
  font-size: 15px; font-weight: var(--mp-fw);
  color: var(--mp-text); margin: 0 0 18px;
}
.madmp-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.madmp-field { display: flex; flex-direction: column; gap: 5px; }
.madmp-field label {
  font-size: 11px; font-weight: var(--mp-fw);
  color: var(--mp-muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.madmp-req { color: var(--mp-accent); }
.madmp-field input {
  padding: 10px 14px;
  border: 1.5px solid var(--mp-border);
  border-radius: calc(var(--mp-radius) * .6);
  font-size: 14px;
  font-family: var(--mp-font);
  color: var(--mp-text);
  background: var(--mp-surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.madmp-field input:focus {
  border-color: var(--mp-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-accent) 14%, transparent);
}

.madmp-error {
  color: #dc2626; font-size: 13px; font-weight: 500;
  padding: 10px 14px; margin-top: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}
.madmp-error--lg { font-size: 14px; padding: 14px 18px; margin: 20px 0; }

/* CTA */
.madmp-cta-row { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.madmp-cta-note { font-size: 12px; color: var(--mp-muted); margin: 0; }

/* Buttons */
.madmp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 28px;
  border: none; border-radius: calc(var(--mp-radius) * .75);
  font-size: var(--mp-fsize); font-weight: var(--mp-fw);
  font-family: var(--mp-font);
  cursor: pointer; text-decoration: none;
  transition: filter .2s, transform .15s, box-shadow .2s;
}
.madmp-btn--primary { background: var(--mp-accent); color: #fff; }
.madmp-btn--primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--mp-accent) 38%, transparent);
}
.madmp-btn--xl { padding: 15px 36px; font-size: 16px; }
.madmp-btn-arrow { font-size: 17px; }

/* ══════════════════════════════════════════════════════
   SCHERMATA 2 — DOMANDE
══════════════════════════════════════════════════════ */
#madmp-slide-2 {
  background: #1a1d2e;
  position: relative;
}

/* Topbar sticky */
.madmp-topbar {
  position: sticky;
  top: 0; z-index: 50;
  background: var(--mp-primary);
  box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
.madmp-topbar-inner {
  max-width: var(--mp-max-w);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.madmp-topbar .madmp-logo-text { color: #fff; }
.madmp-topbar .madmp-logo-icon { }

/* Progress */
.madmp-progress { flex: 1; display: flex; align-items: center; gap: 10px; }
.madmp-progress-track {
  flex: 1; height: 5px;
  background: rgba(255,255,255,.18);
  border-radius: 999px; overflow: hidden;
}
.madmp-progress-fill {
  height: 100%;
  background: var(--mp-accent);
  border-radius: 999px;
  transition: width .4s var(--mp-ease);
}
.madmp-progress-label {
  font-size: 11px; color: rgba(255,255,255,.65);
  white-space: nowrap; min-width: 48px; text-align: right;
}

/* Questions list */
.madmp-questions-wrap {
  flex: 1; overflow-y: auto;
}
.madmp-questions-list {
  max-width: var(--mp-max-w);
  margin: 0 auto;
  padding: 32px 20px 8px;
}

/* Single question card */
.madmp-question {
  background: var(--mp-surface);
  border: 1.5px solid var(--mp-border);
  border-radius: var(--mp-radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: border-color .2s, background .2s;
}
.madmp-question.is-answered {
  border-color: #86efac;
  background: #f0fdf4;
}
.madmp-question.is-missing {
  border-color: #fb923c;
  background: #fff7ed;
}

.madmp-q-text {
  font-size: var(--mp-fsize-q);
  font-weight: 500;
  color: var(--mp-text);
  margin: 0 0 14px;
  line-height: 1.55;
}
.madmp-q-num {
  font-weight: 700;
  color: var(--mp-accent);
  margin-right: 5px;
}

.madmp-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.madmp-opt { cursor: pointer; user-select: none; }
.madmp-opt input[type="radio"] { display: none; }

.madmp-opt-inner {
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  padding: 11px 8px;
  border: 1.5px solid var(--mp-border);
  border-radius: calc(var(--mp-radius) * .6);
  background: var(--mp-bg);
  text-align: center;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.madmp-opt:hover .madmp-opt-inner {
  border-color: var(--mp-accent);
  background: color-mix(in srgb, var(--mp-accent) 5%, var(--mp-surface));
}
.madmp-opt input:checked + .madmp-opt-inner {
  border-color: var(--mp-accent);
  background: color-mix(in srgb, var(--mp-accent) 9%, var(--mp-surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mp-accent) 20%, transparent);
}
.madmp-opt-icon { font-size: 16px; font-weight: 700; }
.madmp-opt-icon--si    { color: #16a34a; }
.madmp-opt-icon--forse { color: #d97706; }
.madmp-opt-icon--no    { color: #dc2626; }
.madmp-opt-label {
  font-size: 13px; font-weight: var(--mp-fw);
  color: var(--mp-text); display: block;
}
.madmp-opt-sub {
  font-size: 11px; color: var(--mp-muted); display: block;
}
.madmp-opt input:checked + .madmp-opt-inner .madmp-opt-label {
  color: var(--mp-accent);
}

/* Submit area */
.madmp-submit-area {
  max-width: var(--mp-max-w);
  margin: 0 auto;
  padding: 20px 20px 60px;
  text-align: center;
}
.madmp-submit-note {
  font-size: 12px; color: var(--mp-muted);
  margin: 10px 0 0;
}

/* ══════════════════════════════════════════════════════
   SCHERMATA 3 — RINGRAZIAMENTO
══════════════════════════════════════════════════════ */
#madmp-slide-3 {
  background: #1a1d2e;
}
#madmp-slide-3 .madmp-slide-inner--center { justify-content: flex-start; padding-top: 48px; }
#madmp-slide-3 .madmp-brand { width: 100%; max-width: var(--mp-max-w); margin-bottom: 40px; }
#madmp-slide-3 .madmp-logo-text { color: #fff; }
#madmp-slide-3 .madmp-step { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.7); }
#madmp-slide-3 .madmp-step--done { background: #22c55e; border-color: #22c55e; color: #fff; }
#madmp-slide-3 .madmp-step-line { background: rgba(255,255,255,.25); }
#madmp-slide-3 .madmp-step-line--done { background: #22c55e; }

.madmp-ty-card {
  background: var(--mp-surface);
  border-radius: var(--mp-radius-box);
  padding: 52px 56px;
  max-width: 540px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 64px rgba(0,0,0,.22);
  /* entrata animata */
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s .12s var(--mp-ease), transform .5s .12s var(--mp-ease);
}
.madmp-ty-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.madmp-ty-icon { font-size: 52px; margin-bottom: 20px; }
.madmp-ty-title {
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
  color: var(--mp-text);
  margin: 0 0 14px;
  line-height: 1.3;
}
.madmp-ty-text {
  color: var(--mp-muted);
  font-size: var(--mp-fsize);
  margin: 0 0 28px;
  line-height: 1.7;
}
.madmp-ty-cta { margin-top: 4px; }

/* Spinner (durante invio) */
.madmp-sending {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: rgba(255,255,255,.75);
  font-size: 15px;
}
.madmp-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: madmp-spin .75s linear infinite;
}
@keyframes madmp-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  #madmp-slide-1 .madmp-slide-inner { padding: 28px 20px 40px; margin: 16px; border-radius: var(--mp-radius); }
  .madmp-fields  { grid-template-columns: 1fr; }
  .madmp-options { grid-template-columns: 1fr; }
  .madmp-brand   { flex-direction: column; align-items: flex-start; gap: 16px; }
  .madmp-topbar-inner { flex-wrap: wrap; gap: 10px; }
  .madmp-ty-card { padding: 36px 24px; }
}
