/* ============================================================
   nexitnow — Landing Page Styles
   Mobile-first, system font stack, dark theme
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --text: #f0f0f0;
    --text-muted: #888;
    --blue: #185FA5;
    --blue-light: #2a7fd4;
    --blue-glow: rgba(24, 95, 165, 0.3);
    --radius: 8px;
    --transition: 0.3s ease;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
            Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- HERO ---- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.hero__container {
    max-width: 600px;
}

.hero__logo {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    user-select: none;
}

.logo__n, .logo__ow {
    color: var(--text);
}

.logo__bracket {
    color: var(--text-muted);
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo__bracket--open .logo__bracket--left,
.hero__logo.logo__bracket--open .logo__bracket--left {
    transform: translateX(-4px);
}

.logo__bracket--open .logo__bracket--right,
.hero__logo.logo__bracket--open .logo__bracket--right {
    transform: translateX(4px);
}

.logo__exit {
    color: var(--blue);
    display: inline-block;
    min-width: 0;
}

.logo__cursor {
    color: var(--blue);
    animation: blink 1s step-end infinite;
    font-weight: 300;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero__tagline {
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    letter-spacing: 0.3em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 3rem;
}

.maintenance__message {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
    margin-top: 1rem;
}

.hero__cta {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.hero__cta:hover {
    background: var(--blue-light);
    box-shadow: 0 0 30px var(--blue-glow);
    transform: translateY(-2px);
}

.hero__cta:active {
    transform: translateY(0);
}

.cta__arrow {
    display: inline-block;
    transition: transform var(--transition);
}

.hero__cta:hover .cta__arrow {
    transform: translateX(4px);
}

/* ---- QUESTIONARIO ---- */
.questionnaire {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.questionnaire__container {
    width: 100%;
    max-width: 560px;
}

.questionnaire__progress {
    height: 3px;
    background: #222;
    border-radius: 2px;
    margin-bottom: 3rem;
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    background: var(--blue);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
}

.questionnaire__step {
    min-height: 200px;
}

.step__question {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 600;
    margin-bottom: 2rem;
    line-height: 1.3;
}

.step__options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option__btn {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.option__btn:hover {
    border-color: var(--blue);
    background: rgba(24, 95, 165, 0.1);
}

.option__btn.selected {
    border-color: var(--blue);
    background: rgba(24, 95, 165, 0.15);
    box-shadow: 0 0 0 1px var(--blue);
}

.step__input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.step__input:focus {
    border-color: var(--blue);
}

.step__input::placeholder {
    color: var(--text-muted);
}

/* Campi multipli (es. fatturato 3 anni) */
.step__multi-input {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step__multi-input label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* Step number */
.step__number {
    display: block;
    font-size: 0.8rem;
    color: var(--blue);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Hint "Premi Invio" */
.step__hint {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.step__hint kbd,
.btn__kbd {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: 0.75rem;
    font-family: var(--font);
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--text-muted);
    margin-left: 0.15em;
    vertical-align: middle;
    line-height: 1.4;
}

/* Shortcut key badge sulle opzioni */
.option__key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    font-size: 0.75rem;
    font-weight: 700;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--text-muted);
    margin-right: 0.6rem;
    flex-shrink: 0;
    transition: all var(--transition);
}

.option__btn:hover .option__key,
.option__btn.selected .option__key {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* ---- STEP TRANSITIONS ---- */
.questionnaire__step {
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.step--exiting {
    opacity: 0;
    transform: translateY(-10px);
}

.step--entering {
    animation: stepFadeIn 0.35s ease forwards;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shake feedback quando manca la risposta */
.step--shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* ---- LOOKUP DATI CAMERALI ---- */
.step__subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: -1rem 0 1.5rem;
    line-height: 1.4;
}

.lookup__actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn--lookup {
    padding: 0.7rem 1.5rem;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn--lookup:hover {
    background: var(--blue-light);
}

.btn--lookup:disabled {
    opacity: 0.5;
    cursor: wait;
}

.btn--skip-lookup {
    padding: 0.7rem 1.5rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #333;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.btn--skip-lookup:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.lookup__result {
    margin-top: 1.5rem;
}

.lookup__card {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    overflow: hidden;
}

.lookup__card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lookup__card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.lookup__provider {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lookup__card-body {
    padding: 0.75rem 1.25rem;
}

.lookup__field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #1a1a1a;
}

.lookup__field:last-child {
    border-bottom: none;
}

.lookup__field span {
    color: var(--text-muted);
}

.lookup__field strong {
    color: var(--text);
    text-align: right;
}

.lookup__card-actions {
    padding: 1rem 1.25rem;
    border-top: 1px solid #222;
    display: flex;
    gap: 0.75rem;
}

.btn--confirm-lookup {
    flex: 1;
}

.btn--edit-lookup {
    flex-shrink: 0;
}

.lookup__not-found {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lookup__multiple {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lookup__multiple > p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.lookup__option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.lookup__option-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- VALIDAZIONE & OTP ---- */
.step__error {
    color: #e53935;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    animation: fadeIn 0.3s ease;
}

.otp__container {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
}

.otp__message {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.otp__destination {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.otp__error {
    color: #e53935;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- CONSENT BANNER ---- */
.consent__intro {
    text-align: center;
    margin-bottom: 2rem;
}

.consent__intro p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 1rem;
}

.consent__banner {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.consent__text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.consent__link {
    color: var(--blue);
    text-decoration: none;
}

.consent__link:hover {
    text-decoration: underline;
}

.consent__checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.consent__checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    cursor: pointer;
}

.consent__start {
    width: 100%;
    padding: 0.9rem;
    font-size: 1.05rem;
}

.consent__start:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.consent__reminder {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.4;
}

.consent__reminder a {
    color: var(--blue);
    text-decoration: none;
}

.consent__reminder a:hover {
    text-decoration: underline;
}

/* ---- OTP VERIFICA POST-QUESTIONARIO ---- */
.otp__verify-section {
    margin-top: 1.5rem;
    text-align: left;
}

.otp__verify-intro {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.otp__verify-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(24, 95, 165, 0.08);
    border-left: 3px solid var(--blue);
    border-radius: 4px;
}

.otp__verify-block {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.otp__verify-block label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.otp__verify-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.otp__field {
    max-width: 160px;
    text-align: center;
    font-size: 1.1rem !important;
    letter-spacing: 0.2em;
}

.otp__verify-status {
    font-size: 0.8rem;
    margin-top: 0.4rem;
    min-height: 1.2em;
}

.otp__success {
    color: #4caf50;
}

.otp__edit-row {
    margin-top: 0.5rem;
}

.otp__edit-link {
    font-size: 0.8rem;
    color: var(--blue);
    text-decoration: none;
}

.otp__edit-link:hover {
    text-decoration: underline;
}

/* OTP gate inline (dentro lo step) */
.otp__inline-status {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    min-height: 1.2em;
    color: var(--text-muted);
}

.otp__inline-status.otp__success {
    color: #4caf50;
}

.otp__inline-status.otp__error {
    color: #e53935;
}

.questionnaire__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    gap: 1rem;
}

.btn {
    padding: 0.85rem 2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn--primary {
    background: var(--blue);
    color: #fff;
    margin-left: auto;
}

.btn--primary:hover {
    background: var(--blue-light);
}

.btn--primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn--secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #333;
}

.btn--secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ---- THANK YOU ---- */
.thankyou {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.thankyou__container {
    max-width: 500px;
}

.thankyou__icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.thankyou__title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.thankyou__message {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.7;
}

/* ---- RESPONSIVE MOBILE ---- */
@media (max-width: 640px) {
    .hero {
        padding: 1.5rem 1rem;
    }

    .hero__cta {
        width: 100%;
        padding: 1.1rem 2rem;
        font-size: 1rem;
    }

    .questionnaire {
        padding: 1.5rem 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .questionnaire__container {
        max-width: 100%;
    }

    .step__question {
        font-size: 1.2rem;
    }

    .option__btn {
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
        /* Touch-friendly: area minima 44px */
        min-height: 48px;
    }

    .step__input {
        padding: 0.9rem 1rem;
        font-size: 1rem;
    }

    .questionnaire__nav {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .btn--primary,
    .btn--secondary {
        margin-left: 0;
        width: 100%;
        padding: 0.9rem;
        min-height: 48px;
        text-align: center;
    }

    /* Lookup mobile */
    .lookup__actions {
        flex-direction: column;
    }

    .btn--lookup,
    .btn--skip-lookup {
        width: 100%;
        min-height: 48px;
    }

    .lookup__card-header {
        flex-direction: column;
        gap: 0.3rem;
    }

    .lookup__card-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .lookup__field {
        flex-direction: column;
        gap: 0.1rem;
    }

    .lookup__field strong {
        text-align: left;
    }

    .step__hint {
        display: none; /* Nascondi hint tastiera su mobile */
    }

    .step__number {
        font-size: 0.75rem;
    }

    /* Thank you mobile */
    .thankyou__icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .thankyou__title {
        font-size: 1.4rem;
    }
}
