/* ================================================================
   ONBOARDING OVERLAY — Mobile-first, 4 écrans bloquants
   Glassmorphism : fond du site visible + blur
   ================================================================ */

/* ── Overlay plein écran ─────────────────────────────────────────── */
#onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 8000;
    display: none;                   /* affiché par JS */
    align-items: flex-end;           /* bottom-sheet sur mobile */
    justify-content: center;
    background: rgba(7, 9, 15, 0.60);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

@media (min-width: 600px) {
    #onboarding-overlay {
        align-items: center;
        padding: 24px;
    }
}

/* ── Glass card ──────────────────────────────────────────────────── */
.onb-card {
    width: 100%;
    max-width: 100%;
    max-height: 96svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 36px 24px 44px;          /* bas généreux pour iOS home bar */

    background: linear-gradient(
        160deg,
        rgba(22, 25, 42, 0.96) 0%,
        rgba(13, 16, 28, 0.98) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    box-shadow:
        0 -12px 60px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    /* Glossy highlight */
    position: relative;
}

.onb-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.04) 0%,
        transparent 40%
    );
    pointer-events: none;
}

@media (min-width: 600px) {
    .onb-card {
        max-width: 480px;
        max-height: 92svh;
        border-radius: 24px;
        border: 1px solid rgba(255, 255, 255, 0.09);
        padding: 44px 40px 48px;
    }
}

/* ── Screen wrapper ──────────────────────────────────────────────── */
.onb-screen {
    display: none;                    /* affiché par JS */
    flex-direction: column;
    align-items: center;             /* centre la card sur desktop */
    width: 100%;
    animation: onbIn 0.32s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

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

/* Mobile : la card colle au bas (bottom-sheet) */
@media (max-width: 599px) {
    .onb-screen {
        align-items: stretch;
    }
}

/* ── Step dots ───────────────────────────────────────────────────── */
.onb-steps {
    display: flex;
    gap: 7px;
    justify-content: center;
    margin-bottom: 32px;
}

.onb-dot {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    transition: width 0.3s ease, background 0.3s ease;
    width: 6px;
}

.onb-dot.is-active  { width: 22px; background: var(--accent, #6366f1); }
.onb-dot.is-done    { background: rgba(99, 102, 241, 0.45); }

/* ── Logo ────────────────────────────────────────────────────────── */
.onb-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-bottom: 28px;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent, #6366f1);
}

.onb-logo-sym {
    font-size: 1.4rem;
    display: inline-block;
}

/* ── Headings ────────────────────────────────────────────────────── */
.onb-card h2 {
    font-size: clamp(1.45rem, 5vw, 1.75rem);
    font-weight: 800;
    color: var(--text-primary, #eef0ff);
    letter-spacing: -0.04em;
    margin: 0 0 10px;
    text-align: center;
    line-height: 1.15;
}

.onb-card p {
    color: var(--text-secondary, #8892aa);
    font-size: 0.93rem;
    line-height: 1.65;
    text-align: center;
    margin: 0 0 30px;
}

/* ── Strava button — official "Connect with Strava" ─────────────── */
.onb-btn-strava {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    margin: 0 auto;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.18s;
}

.onb-btn-strava:hover:not(:disabled) {
    transform: translateY(-2px);
    opacity: 0.92;
}

.onb-btn-strava:active:not(:disabled) {
    transform: translateY(0);
}

.onb-btn-strava:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.onb-strava-img {
    height: 48px;
    width: auto;
    display: block;
    margin: 0 auto;
}

/* ── Profile form ────────────────────────────────────────────────── */
.onb-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin-bottom: 16px;
}

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

.onb-field label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary, #8892aa);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.onb-field input,
.onb-field select,
.onb-field textarea {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 11px;
    color: var(--text-primary, #eef0ff);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.18s, background 0.18s;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.onb-field input:focus,
.onb-field select:focus,
.onb-field textarea:focus {
    outline: none;
    border-color: var(--accent, #6366f1);
    background: rgba(99, 102, 241, 0.08);
}

.onb-field input::placeholder { color: rgba(255, 255, 255, 0.2); }

/* Ligne 2 champs côte-à-côte */
.onb-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Date picker icon */
input[type="date"].onb-date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    opacity: 0.6;
    cursor: pointer;
}

/* ── Primary button ──────────────────────────────────────────────── */
.onb-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 24px;
    background: var(--accent, #6366f1);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    letter-spacing: -0.01em;
    transition: background 0.18s, transform 0.15s, box-shadow 0.18s, opacity 0.15s;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.32);
    margin-top: 4px;
}

.onb-btn-primary:hover:not(:disabled) {
    background: var(--accent-hover, #818cf8);
    transform: translateY(-1px);
    box-shadow: 0 6px 26px rgba(99, 102, 241, 0.42);
}

.onb-btn-primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

/* ── Error message ───────────────────────────────────────────────── */
.onb-error {
    display: none;
    padding: 10px 14px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.28);
    border-radius: 9px;
    color: #fca5a5;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 8px;
    animation: onbIn 0.2s ease both;
}

/* ── Sync step — Premium orbital animation ───────────────────────── */
.onb-orbit {
    width: 110px;
    height: 110px;
    margin: 8px auto 32px;
    position: relative;
}

.onb-orbit-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    animation: onbGlow 3s ease-in-out infinite;
}

@keyframes onbGlow {
    0%, 100% { opacity: 0.3; transform: scale(0.95); }
    50%      { opacity: 1;   transform: scale(1.08); }
}

.onb-orbit-track {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(99, 102, 241, 0.10);
}

.onb-orbit-arc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2.5px solid transparent;
    border-top-color: var(--accent, #6366f1);
    border-right-color: rgba(129, 140, 248, 0.4);
    animation: onbOrbitSpin 1.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.4));
}

.onb-orbit-arc-2 {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-bottom-color: rgba(129, 140, 248, 0.35);
    border-left-color: rgba(99, 102, 241, 0.15);
    animation: onbOrbitSpin 2.8s cubic-bezier(0.45, 0, 0.55, 1) infinite reverse;
}

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

.onb-orbit-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent, #6366f1);
    opacity: 0.85;
}

/* Dot orbiting the ring */
.onb-orbit-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent, #6366f1);
    border-radius: 50%;
    top: -4px;
    left: 50%;
    margin-left: -4px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6), 0 0 20px rgba(99, 102, 241, 0.3);
    animation: onbDotOrbit 1.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    transform-origin: 4px 59px; /* center of ring: 55px from top */
}

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

/* Shimmer progress bar */
.onb-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    margin: 28px 0 16px;
    position: relative;
}

.onb-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
    position: relative;
    background: linear-gradient(90deg, var(--accent, #6366f1) 0%, #818cf8 50%, var(--accent, #6366f1) 100%);
    background-size: 200% 100%;
    animation: onbShimmer 2s ease-in-out infinite;
}

@keyframes onbShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Sync completed state */
.onb-orbit.is-done .onb-orbit-arc,
.onb-orbit.is-done .onb-orbit-arc-2,
.onb-orbit.is-done .onb-orbit-dot {
    animation: none;
}

.onb-orbit.is-done .onb-orbit-arc {
    border-color: var(--accent-green, #34d399);
    opacity: 0.5;
    transition: all 0.5s ease;
}

.onb-orbit.is-done .onb-orbit-arc-2,
.onb-orbit.is-done .onb-orbit-dot {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.onb-orbit.is-done .onb-orbit-center {
    color: var(--accent-green, #34d399);
    transition: color 0.4s ease;
}

.onb-orbit.is-done .onb-orbit-glow {
    background: radial-gradient(circle, rgba(52, 211, 153, 0.12) 0%, transparent 70%);
    animation: none;
    opacity: 0.8;
}

.onb-sync-status {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-secondary, #8892aa);
    min-height: 22px;
    margin-bottom: 18px;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.onb-sync-status.is-ok    { color: var(--accent-green, #34d399); font-weight: 600; }
.onb-sync-status.is-error { color: var(--danger, #f87171); }

/* ── Spinner inline ──────────────────────────────────────────────── */
.onb-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: onbSpin 0.75s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}

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

/* ── Hint / legal text ───────────────────────────────────────────── */
.onb-hint {
    font-size: 0.78rem;
    color: var(--text-muted, #464d62);
    text-align: center;
    margin-top: 14px;
    line-height: 1.5;
}

/* ── Section titles (step 2 & 3) ──────────────────────────────────── */
.onb-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent, #6366f1);
    margin: 18px 0 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

.onb-section-title:first-of-type { margin-top: 0; }

/* ── Metrics step hint ───────────────────────────────────────────── */
.onb-metrics-hint {
    font-size: 0.85rem !important;
    color: var(--text-muted, #464d62) !important;
    font-style: italic;
    margin-bottom: 20px !important;
}

/* ── Input with unit suffix ──────────────────────────────────────── */
.onb-input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.onb-input-with-unit input {
    flex: 1;
    padding-right: 68px;  /* room for unit */
}

.onb-unit {
    position: absolute;
    right: 12px;
    font-size: 0.78rem;
    color: var(--text-muted, #464d62);
    pointer-events: none;
    white-space: nowrap;
}

/* ── Field hints ─────────────────────────────────────────────────── */
.onb-field-hint {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted, #464d62);
    line-height: 1.35;
    margin-top: 2px;
}

/* ── W/kg display ────────────────────────────────────────────────── */
.onb-wkg-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    background: rgba(99, 102, 241, 0.10);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 11px;
    color: var(--accent, #6366f1);
    font-size: 1.15rem;
    font-weight: 700;
    height: 46px;
}

/* ── Step 3 actions (skip + continue) ────────────────────────────── */
.onb-step3-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

/* ── Skip link ───────────────────────────────────────────────────── */
.onb-skip-link {
    font-size: 0.82rem;
    color: var(--text-muted, #464d62);
    text-decoration: none;
    transition: color 0.18s;
    white-space: nowrap;
}

.onb-skip-link:hover {
    color: var(--text-secondary, #8892aa);
}

/* ── Safe-area bottom (iOS) ──────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .onb-card {
        padding-bottom: calc(44px + env(safe-area-inset-bottom));
    }
}
