/*
 * Onboarding v2 — Step-based onboarding flow
 * Sprint 2 spec v1.0.3 §2A.2
 * Uses existing index.css design tokens — no new colors.
 */

/* Exception: gradient reuses login page bg but is not a token (no --bg-gradient exists) */
.onboarding-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    padding: 20px;
}

/* ── Container ──────────────────────────────────────────────── */
.onboarding-container {
    max-width: 520px;
    width: 100%;
    padding: 40px;
}

@media (max-width: 560px) {
    .onboarding-container {
        padding: 28px 20px;
        border-radius: 16px;
    }
}

/* ── Step Indicator ─────────────────────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.step-dot.active {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.step-dot.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-dot.completed span {
    display: none;
}

.step-dot.completed::after {
    content: '✓';
    font-size: 0.9rem;
    font-weight: 800;
}

.step-line {
    flex: 1;
    height: 2px;
    max-width: 80px;
    background: var(--border);
    margin: 0 8px;
    transition: background 0.3s ease;
}

.step-line.completed {
    background: var(--success);
}

/* ── Step Header ────────────────────────────────────────────── */
.step-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.step-subtitle {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 32px;
}

/* ── Option Cards (goal / modality selection) ───────────────── */
.option-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.option-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
}

.option-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.option-card.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.option-card .option-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.option-card .option-label {
    flex: 1;
}

/* ── Checkbox Cards (agreements) ────────────────────────────── */
.agreement-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    user-select: none;
}

.agreement-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.agreement-card.checked {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.agreement-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    transition: all 0.2s ease;
}

.agreement-card.checked .agreement-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.agreement-card.checked .agreement-checkbox::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
}

.agreement-text {
    flex: 1;
}

.agreement-text .title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

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

.agreement-text a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.agreement-text a:hover {
    opacity: 0.7;
}

.agreement-card.optional {
    border-style: dashed;
}

/* ── Section Label ──────────────────────────────────────────── */
.section-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 8px;
}

/* ── Form Field ─────────────────────────────────────────────── */
.field-group {
    margin-bottom: 24px;
}

.field-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.field-group select {
    margin-bottom: 4px;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 4px;
}

/* ── Error ──────────────────────────────────────────────────── */
.field-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 6px;
    display: none;
}

.field-error.visible {
    display: block;
}

.inline-error {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    padding: 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: none;
    text-align: center;
}

.inline-error.visible {
    display: block;
}

/* ── Navigation ─────────────────────────────────────────────── */
.onboarding-nav {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.btn-premium:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Step Transitions ───────────────────────────────────────── */
.step-panel {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.step-panel.slide-out-left {
    transform: translateX(-30px);
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.step-panel.slide-in-right {
    transform: translateX(30px);
    opacity: 0;
}

/* ── Completion Screen ──────────────────────────────────────── */
.completion-screen {
    text-align: center;
    padding: 40px 0;
}

.completion-check {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.completion-check circle {
    fill: none;
    stroke: var(--success);
    stroke-width: 3;
    opacity: 0;
    animation: circle-appear 0.3s ease forwards;
}

.completion-check polyline {
    fill: none;
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkmark-draw 0.4s ease forwards 0.3s;
}

@keyframes circle-appear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes checkmark-draw {
    0% {
        stroke-dashoffset: 50;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

.completion-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.completion-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ── Document Viewer Modal ─────────────────────────────────── */
.doc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: modal-fade-in 0.25s ease;
}

.doc-modal-overlay.open {
    display: flex;
}

.doc-modal {
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.doc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.doc-modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.doc-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.doc-modal-close:hover {
    color: var(--text-main);
}

.doc-modal-frame {
    flex: 1;
    border: none;
    width: 100%;
    min-height: 400px;
    background: #1e293b;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal footer — sticky accept bar */
.doc-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.95);
}

.doc-accept-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main, #e2e8f0);
    flex: 1;
    user-select: none;
}

.doc-accept-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.doc-accept-btn {
    padding: 10px 28px;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

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