/* ==========================================================================
   Onboarding Flow Styles
   ========================================================================== */

/* Ensure consistent box-sizing */
.onboarding-body *,
.onboarding-body *::before,
.onboarding-body *::after {
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Base Layout
   -------------------------------------------------------------------------- */
.onboarding-body {
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
}

.onboarding-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--border);
    z-index: 100;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    width: 12.5%;
    transition: width 0.4s ease-out;
}

/* --------------------------------------------------------------------------
   Back Button
   -------------------------------------------------------------------------- */
.back-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background-color: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

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

.back-btn svg {
    width: 20px;
    height: 20px;
}

/* --------------------------------------------------------------------------
   Step Slides
   -------------------------------------------------------------------------- */
.onboarding-step {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px 48px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    overflow-y: auto;
}

.onboarding-step.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.onboarding-step.exit-up {
    opacity: 0;
    transform: translateY(-30px);
}

.onboarding-step.exit-down {
    opacity: 0;
    transform: translateY(30px);
}

.onboarding-step.enter-up {
    transform: translateY(30px);
}

.onboarding-step.enter-down {
    transform: translateY(-30px);
}

/* --------------------------------------------------------------------------
   Step Content
   -------------------------------------------------------------------------- */
.step-content {
    max-width: 640px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.step-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-md);
    color: var(--accent);
}

.step-icon svg {
    width: 100%;
    height: 100%;
}

.step-content h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 400;
    color: var(--text);
    margin-bottom: var(--space-sm);
    max-width: none;
}

.step-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

/* --------------------------------------------------------------------------
   Option Cards
   -------------------------------------------------------------------------- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.options-grid.options-4 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 480px;
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    min-height: 100px;
    background-color: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
}

.option-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.option-card.selected {
    border-color: var(--accent);
    background-color: rgba(26, 95, 74, 0.04);
}

.option-card.selected::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}

.option-label {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.option-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Summary Step
   -------------------------------------------------------------------------- */
.summary-content {
    max-width: 480px;
    width: 100%;
    box-sizing: border-box;
}

.summary-icon {
    width: 64px;
    height: 64px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin: var(--space-md) 0 var(--space-lg);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.summary-item {
    display: flex;
    flex-direction: column;
    padding: var(--space-sm);
    background-color: var(--bg-subtle);
    border-radius: 6px;
    border: 1px solid var(--border);
    box-sizing: border-box;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.summary-icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

.summary-icon svg {
    width: 100%;
    height: 100%;
}

.summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    padding-left: 24px;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--accent);
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.cta-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.summary-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .onboarding-step.active .step-icon {
        animation: fadeIn 0.5s ease-out both;
    }

    .onboarding-step.active h1 {
        animation: fadeUp 0.5s ease-out 0.1s both;
    }

    .onboarding-step.active .step-subtitle {
        animation: fadeUp 0.5s ease-out 0.15s both;
    }

    .onboarding-step.active .option-card {
        animation: fadeUp 0.4s ease-out both;
    }

    .onboarding-step.active .option-card:nth-child(1) { animation-delay: 0.2s; }
    .onboarding-step.active .option-card:nth-child(2) { animation-delay: 0.25s; }
    .onboarding-step.active .option-card:nth-child(3) { animation-delay: 0.3s; }
    .onboarding-step.active .option-card:nth-child(4) { animation-delay: 0.35s; }

    .onboarding-step.active .summary-grid {
        animation: fadeUp 0.5s ease-out 0.2s both;
    }

    .onboarding-step.active .cta-button {
        animation: fadeUp 0.5s ease-out 0.3s both;
    }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .onboarding-step {
        padding: 60px 20px 32px;
        align-items: center;
        justify-content: center;
    }

    .back-btn {
        top: 16px;
        left: 16px;
        width: 40px;
        height: 40px;
    }

    .step-content {
        max-width: 100%;
        width: 100%;
        padding: 0 4px;
        box-sizing: border-box;
    }

    .step-icon {
        width: 48px;
        height: 48px;
        margin-bottom: var(--space-sm);
    }

    .step-content h1 {
        font-size: 1.375rem;
        line-height: 1.3;
        padding: 0 8px;
    }

    .step-subtitle {
        font-size: 0.95rem;
        margin-bottom: var(--space-md);
        padding: 0 8px;
    }

    /* Single column for all option grids on mobile */
    .options-grid,
    .options-grid.options-4 {
        grid-template-columns: 1fr;
        max-width: 340px;
        width: 100%;
        margin: 0 auto;
        gap: 10px;
    }

    .option-card {
        padding: 18px 20px;
        min-height: 64px;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: var(--space-sm);
        text-align: left;
    }

    .option-card.selected::after {
        top: 50%;
        right: 16px;
        width: 20px;
        height: 20px;
        background-size: 12px;
        transform: translateY(-50%);
    }

    .option-label {
        font-size: 1.1rem;
        margin-bottom: 0;
        font-weight: 500;
    }

    .option-desc {
        display: none;
    }

    /* Summary step adjustments */
    .summary-content {
        max-width: 100%;
        width: 100%;
        padding: 0 4px;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        max-width: 340px;
        margin: var(--space-sm) auto var(--space-md);
    }

    /* Compact horizontal layout with icon on left */
    .summary-item {
        display: grid;
        grid-template-columns: 36px 1fr;
        grid-template-rows: auto auto;
        gap: 1px 10px;
        padding: 10px 12px;
        align-items: center;
    }

    .summary-header {
        display: contents;
    }

    .summary-header .summary-icon {
        grid-column: 1;
        grid-row: 1 / 3;
        width: 36px;
        height: 36px;
        background-color: rgba(26, 95, 74, 0.1);
        border-radius: 8px;
        padding: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .summary-header .summary-icon svg {
        width: 100%;
        height: 100%;
        color: var(--accent);
    }

    .summary-label {
        grid-column: 2;
        grid-row: 1;
        font-size: 0.6rem;
        align-self: end;
    }

    .summary-value {
        grid-column: 2;
        grid-row: 2;
        font-size: 0.95rem;
        padding-left: 0;
        align-self: start;
    }

    .summary-icon {
        width: 36px;
        height: 36px;
    }

    .cta-button {
        width: 100%;
        max-width: 340px;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .summary-note {
        padding: 0 16px;
        margin-top: var(--space-xs);
        font-size: 0.8rem;
    }

    /* Make summary step more compact */
    .onboarding-step[data-step="8"] .step-icon {
        width: 40px;
        height: 40px;
        margin-bottom: var(--space-xs);
    }

    .onboarding-step[data-step="8"] h1 {
        font-size: 1.25rem;
        margin-bottom: var(--space-xs);
    }

    .onboarding-step[data-step="8"] .step-subtitle {
        margin-bottom: var(--space-sm);
        font-size: 0.9rem;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .onboarding-step {
        padding: 56px 16px 24px;
    }

    .step-icon {
        width: 40px;
        height: 40px;
    }

    .step-content h1 {
        font-size: 1.25rem;
    }

    .step-subtitle {
        font-size: 0.9rem;
    }

    .options-grid,
    .options-grid.options-4 {
        max-width: 100%;
        gap: 8px;
    }

    .option-card {
        padding: 16px 18px;
        min-height: 58px;
    }

    .option-label {
        font-size: 1rem;
    }

    .summary-grid {
        max-width: 100%;
        gap: 6px;
    }

    .summary-item {
        grid-template-columns: 32px 1fr;
        gap: 1px 8px;
        padding: 8px 10px;
    }

    .summary-header .summary-icon {
        width: 32px;
        height: 32px;
        padding: 6px;
        border-radius: 6px;
    }

    .summary-label {
        font-size: 0.55rem;
    }

    .summary-value {
        font-size: 0.85rem;
        padding-left: 0;
    }

    .onboarding-step[data-step="8"] .step-icon {
        width: 36px;
        height: 36px;
    }

    .onboarding-step[data-step="8"] h1 {
        font-size: 1.125rem;
    }

    .cta-button {
        max-width: 100%;
        padding: 16px 20px;
    }
}

/* --------------------------------------------------------------------------
   Keyboard Focus States
   -------------------------------------------------------------------------- */
.option-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.back-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.cta-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
