/* =============================================
   MULTI-STEP FORM — High conversion
   ============================================= */

/* --- Overlay --- */
.form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: #07070C;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.form-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Container --- */
.form-container {
    width: 100%;
    max-width: 520px;
    height: 100dvh;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- Header (progress + close) --- */
.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 16px;
}

.form-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.form-back:hover { border-color: rgba(255,255,255,0.25); color: var(--text); }
.form-back.hidden { opacity: 0; pointer-events: none; }

.form-progress {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 100px;
    overflow: hidden;
}

.form-progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.form-close:hover { border-color: rgba(255,255,255,0.25); color: var(--text); }

.form-step-indicator {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    letter-spacing: 0.05em;
}

/* --- Steps wrapper --- */
.form-steps {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.form-step {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 8px;
    animation: formFadeIn 0.35s ease;
}

.form-step.active {
    display: flex;
}

@keyframes formFadeIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Step content --- */
.form-question {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.2;
}

.form-question-sub {
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* --- Option cards (steps 1-3) --- */
.form-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

.form-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.form-option:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: var(--bg-card-hover);
}

.form-option:active {
    transform: scale(0.97);
}

.form-option.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.form-option-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.form-option-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

/* --- Input fields (steps 4-5) --- */
.form-fields {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px; /* prevents iOS zoom */
    font-family: var(--font);
    font-weight: 500;
    color: var(--text);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--primary);
}

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

.form-input.error {
    border-color: #EF4444;
}

.form-error {
    font-size: 0.75rem;
    color: #F87171;
    min-height: 18px;
}

/* --- Phone field with dial code --- */
.form-phone-row {
    display: flex;
    gap: 8px;
}

.form-dial-code {
    width: 100px;
    padding: 14px 8px;
    font-size: 16px;
    font-family: var(--font);
    font-weight: 500;
    color: var(--text);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.form-dial-code:focus {
    border-color: var(--primary);
}

.form-phone-input {
    flex: 1;
}

/* --- Submit / Continue buttons --- */
.form-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
    font-family: var(--font);
    font-weight: 700;
    color: white;
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    -webkit-tap-highlight-color: transparent;
    margin-top: 8px;
}

.form-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.form-submit:active {
    transform: translateY(0);
}

.form-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- SMS Code Inputs --- */
.sms-code-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sms-digit {
    width: 48px;
    height: 56px;
    font-size: 24px;
    font-family: var(--font);
    font-weight: 700;
    text-align: center;
    color: var(--text);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.sms-digit:focus {
    border-color: var(--primary);
}

.sms-digit.error {
    border-color: #EF4444;
    animation: shake 0.4s ease;
}

.sms-dash {
    color: var(--text-muted);
    font-size: 1.2rem;
    user-select: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.form-resend {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 0.85rem;
    font-family: var(--font);
    font-weight: 500;
    color: var(--primary-light);
    background: none;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
}

.form-resend:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-resend:not(:disabled):hover {
    text-decoration: underline;
}

/* --- Spinner --- */
.form-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Success screen --- */
.form-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.form-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success-light);
}

.form-success h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
}

.form-success p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 340px;
    line-height: 1.6;
}

/* --- Reassurance under final CTA --- */
.form-reassurance {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.form-reassurance span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.form-reassurance svg {
    color: var(--success-light);
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 640px) {
    .form-container {
        padding: 16px;
        justify-content: flex-start;
        padding-top: 20px;
    }

    .form-question {
        font-size: 1.25rem;
    }

    .form-question-sub {
        font-size: 0.82rem;
        margin-bottom: 24px;
    }

    .form-options {
        gap: 10px;
    }

    .form-option {
        padding: 16px 10px;
    }

    .form-option-label {
        font-size: 0.82rem;
    }

    .form-step.active {
        justify-content: flex-start;
        padding-top: 2vh;
    }
}

@media (max-height: 700px) {
    .form-steps {
        align-items: flex-start;
        padding-top: 4vh;
    }

    .form-question {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .form-question-sub {
        margin-bottom: 20px;
    }

    .form-option {
        padding: 14px 10px;
    }
}
