/* =====================================================================
   SWEPEARL-IO: FORM ARCHITECTURE (forms.css)
   Modern Wizard & Form UI. Modulär och responsiv design.
   ===================================================================== */

:root {
    --form-radius: 16px;
    --card-radius: 16px;
    --form-spacing: 32px;
    --input-bg: #ffffff;
    --input-border: #e5e7eb;
    --input-focus: var(--accent, #0071e3);
    --input-focus-shadow: rgba(0, 113, 227, 0.15);
    --error-red: #ef4444;
    --error-bg: #fef2f2;
    --success-green: #10b981;
    --success-bg: #ecfdf5;
    --text-main: #111827;
    --text-muted: #6b7280;
    --card-hover: #f9fafb;
    --card-active-bg: #f0f7ff;
}

/* 1. CONTAINER & WIZARD LAYOUT */
.demo-form-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    text-align: left;
}

.wizard-header {
    margin-bottom: 40px;
}

/* Progress Bar */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    position: relative;
}

.wizard-progress-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--input-border);
    transform: translateY(-50%);
    border-radius: 2px;
    z-index: 1;
}

.wizard-progress-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    background: var(--input-focus);
    transform: translateY(-50%);
    border-radius: 2px;
    z-index: 2;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    z-index: 3;
    transition: all 0.3s ease;
}

.wizard-step-indicator.active {
    border-color: var(--input-focus);
    color: var(--input-focus);
    box-shadow: 0 0 0 4px var(--input-focus-shadow);
}

.wizard-step-indicator.completed {
    background: var(--input-focus);
    border-color: var(--input-focus);
    color: #fff;
}

/* 2. WIZARD CARDS (VISUAL BOXES) */
.wizard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
    margin-bottom: 32px;
}

.wizard-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--card-radius);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.wizard-card input[type="radio"],
.wizard-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wizard-card-icon {
    font-size: 32px;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.wizard-card-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.wizard-card:hover {
    border-color: #d1d5db;
    background: var(--card-hover);
    transform: translateY(-2px);
}

.wizard-card:has(input:checked) {
    border-color: var(--input-focus);
    background: var(--card-active-bg);
    box-shadow: 0 4px 12px var(--input-focus-shadow);
}

.wizard-card:has(input:checked) .wizard-card-icon {
    color: var(--input-focus);
    transform: scale(1.1);
}

/* 3. PROGRESSIVE DISCLOSURE (SMOOTH REVEAL) */
.step-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.step-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    height: auto;
    overflow: visible;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--input-border);
}

/* 4. STANDARD INPUTS (STEG 4 m.m.) */
.demo-input {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.demo-input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 4px var(--input-focus-shadow);
}

textarea.demo-input {
    resize: vertical;
    min-height: 120px;
}

.demo-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

/* 5. NAVIGATION BUTTONS */
.wizard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--input-border);
}

.btn-wizard-back {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-wizard-back:hover {
    background: var(--card-hover);
    color: var(--text-main);
}

.btn-wizard-next {
    background: var(--input-focus);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, opacity 0.2s;
}

.btn-wizard-next:hover {
    opacity: 0.9;
}

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

/* 6. ERROR & OTP */
.demo-error-banner {
    background: var(--error-bg);
    color: var(--error-red);
    border: 1px solid #fecaca;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-weight: 500;
    animation: shake 0.4s ease-in-out;
}

.demo-input-otp {
    text-align: center;
    font-size: 2.5rem;
    letter-spacing: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    padding: 20px;
    border-radius: 16px;
}

/* 7. ANIMATIONS */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.fade-up {
    animation: fadeUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@media (max-width: 640px) {
    .wizard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .demo-input-otp {
        font-size: 2rem;
        letter-spacing: 8px;
    }
}