/**
 * Auth flow — style stepper (inspiré Untitled UI)
 * Sidebar gauche + formulaire centré + barre de progression
 */

:root {
    --auth-flow-sidebar-bg: #FDF8F9;
    --auth-flow-main-bg: #FFFFFF;
    --auth-flow-step-active-bg: #FFFFFF;
    --auth-flow-step-border: #F0E0E4;
    --auth-flow-watermark: rgba(220, 20, 60, 0.06);
}

.auth-flow-body {
    background: var(--auth-flow-main-bg);
    min-height: 100vh;
    overflow: hidden;
}

.auth-flow {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    min-height: 100vh;
}

/* ── Sidebar ── */
.auth-flow-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 32px 28px 24px;
    background: var(--auth-flow-sidebar-bg);
    border-right: 1px solid var(--grey-200, #F0E0E4);
    overflow: hidden;
}

.auth-flow-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

.auth-flow-brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.auth-flow-brand .brand-wordmark {
    font-size: 20px;
    font-weight: 800;
}

/* Stepper */
.auth-flow-stepper {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 2;
    flex: 1;
}

.auth-flow-stepper::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 28px;
    bottom: 28px;
    width: 1px;
    background: var(--grey-200, #F0E0E4);
    z-index: 0;
}

.auth-flow-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    position: relative;
    z-index: 1;
    transition: background 0.2s, border-color 0.2s;
}

.auth-flow-step.is-active {
    background: var(--auth-flow-step-active-bg);
    border-color: var(--auth-flow-step-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.auth-flow-step.is-done .auth-flow-step-icon {
    background: var(--primary, #DC143C);
    color: #fff;
    border-color: var(--primary, #DC143C);
}

.auth-flow-step-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--grey-200, #F0E0E4);
    background: var(--auth-flow-sidebar-bg);
    color: var(--grey-500, #6B5A5E);
    font-size: 15px;
}

.auth-flow-step.is-active .auth-flow-step-icon {
    border-color: var(--primary, #DC143C);
    color: var(--primary, #DC143C);
    background: #FDE8EC;
}

.auth-flow-step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding-top: 2px;
}

.auth-flow-step-text strong {
    font-size: 14px;
    font-weight: 800;
    color: var(--grey-700, #1A0F12);
    line-height: 1.3;
}

.auth-flow-step-text span {
    font-size: 13px;
    font-weight: 600;
    color: var(--grey-500, #6B5A5E);
    line-height: 1.4;
}

.auth-flow-step:not(.is-active):not(.is-done) .auth-flow-step-text strong,
.auth-flow-step:not(.is-active):not(.is-done) .auth-flow-step-text span {
    color: var(--grey-400, #8a8578);
}

/* Sidebar footer */
.auth-flow-sidebar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 24px;
    position: relative;
    z-index: 2;
    font-size: 14px;
    font-weight: 700;
}

.auth-flow-sidebar-foot a {
    color: var(--grey-500, #6B5A5E);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-flow-sidebar-foot a:hover {
    color: var(--primary, #DC143C);
}

/* Watermark */
.auth-flow-watermark {
    position: absolute;
    right: -20px;
    bottom: 60px;
    width: 200px;
    height: 200px;
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

.auth-flow-watermark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.5;
}

/* ── Main panel ── */
.auth-flow-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 80px;
    background: var(--auth-flow-main-bg);
    position: relative;
    min-height: 100vh;
}

.auth-flow-panel {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-flow-panel-logo {
    margin-bottom: 24px;
}

.auth-flow-panel-logo img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
}

.auth-flow-panel-content {
    width: 100%;
}

/* Auth cards in flow mode */
.auth-flow .auth-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 100%;
    max-width: none;
}

.auth-flow .auth-card h1 {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-flow .auth-sub {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-flow .auth-switch,
.auth-flow .auth-forgot-link {
    text-align: center;
}

.auth-method-switch {
    margin: 0.85rem 0 0;
}

.auth-method-switch-btn {
    width: 100%;
    border: none;
    background: #1A0F12;
    color: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.auth-method-switch-btn:hover {
    background: #000;
    color: #fff;
}

[data-theme="dark"] .auth-method-switch-btn {
    background: #0a0a0a;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .auth-method-switch-btn:hover {
    background: #000;
}

.auth-password-block {
    margin: 0.85rem 0 0.25rem;
}

.auth-password-block .field-label {
    display: block;
    margin-bottom: 0.4rem;
}

.auth-password-block[hidden] {
    display: none !important;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.1rem 0 0.85rem;
    color: var(--auth-channel-inactive, #94A3B8);
    font-size: 13px;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--grey-200, #F0E0E4);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #1A0F12;
    color: #fff;
    border: 1px solid #1A0F12;
    border-radius: 12px;
    font-weight: 700;
    padding: 13px 18px;
    cursor: pointer;
}

.btn-google:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

.btn-google-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #dadce0;
    color: #4285F4;
    font-weight: 800;
    font-size: 14px;
}

.google-btn-host {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

[data-theme="dark"] .btn-google {
    background: #0a0a0a;
    color: #fff;
    border-color: #0a0a0a;
}

.auth-flow .btn-primary.btn-block {
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 800;
    margin-top: 0.5rem;
}

/* OTP digit inputs */
.otp-input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.otp-digit {
    width: 56px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    border: 1px solid var(--grey-200, #F0E0E4);
    border-radius: 10px;
    background: var(--auth-flow-main-bg);
    color: var(--grey-700, #1A0F12);
    padding: 0;
    caret-color: var(--primary, #DC143C);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.otp-digit:focus {
    outline: none;
    border-color: var(--primary, #DC143C);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.12);
}

.otp-digit.filled {
    border-color: var(--primary, #DC143C);
}

.otp-resend {
    text-align: center;
    font-size: 14px;
    color: var(--grey-500, #6B5A5E);
    margin-top: 1rem;
}

.otp-resend a,
.otp-resend button.btn-text {
    color: var(--primary, #DC143C);
    font-weight: 700;
}

/* Progress bar */
.auth-flow-progress {
    position: fixed;
    bottom: 0;
    left: minmax(280px, 360px);
    right: 0;
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, var(--auth-flow-main-bg) 70%, transparent);
    pointer-events: none;
}

.auth-flow-progress-inner {
    display: flex;
    gap: 6px;
    width: min(200px, 50vw);
}

.auth-flow-progress-seg {
    flex: 1;
    height: 4px;
    border-radius: 99px;
    background: var(--grey-200, #F0E0E4);
    transition: background 0.25s;
}

.auth-flow-progress-seg.is-filled {
    background: var(--primary, #DC143C);
}

/* Theme + language toggles */
.auth-top-toggles {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-flow-body .auth-theme-toggle {
    position: static;
    top: auto;
    right: auto;
}

.auth-lang-toggle #auth-lang-flag,
.auth-lang-toggle .auth-lang-flag-img {
    display: block;
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

html[dir="rtl"] .auth-top-toggles {
    right: auto;
    left: 16px;
}

/* Solo mode (complete-profile) */
.auth-flow--solo {
    grid-template-columns: 1fr;
}

.auth-flow--solo .auth-flow-sidebar,
.auth-flow--solo .auth-flow-progress {
    display: none;
}

.auth-flow--solo .auth-flow-panel-logo--solo-hide {
    display: none;
}

/* Dark mode */
[data-theme="dark"] .auth-flow-body {
    background: #0a0a0a;
}

[data-theme="dark"] .auth-flow-sidebar {
    background: #111;
    border-color: #222;
}

[data-theme="dark"] .auth-flow-main {
    background: #0a0a0a;
}

[data-theme="dark"] .auth-flow-step.is-active {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] .auth-flow-step-text strong {
    color: #f5f5f5;
}

[data-theme="dark"] .otp-digit {
    background: #1a1a1a;
    border-color: #333;
    color: #f5f5f5;
}

/* Responsive */
@media (max-width: 900px) {
    .auth-flow {
        grid-template-columns: 1fr;
    }

    .auth-flow-sidebar {
        display: none;
    }

    .auth-flow-main {
        padding: 32px 20px 72px;
        min-height: 100dvh;
    }

    .auth-flow-progress {
        left: 0;
    }

    .otp-digit {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

/* E-mail / numéro — toggle segmenté (aligné mobile Explorer) */
.auth-channel-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    height: 44px;
    padding: 3px;
    margin-bottom: 20px;
    background: var(--auth-channel-track, #F3F4F6);
    border: none;
    border-radius: 12px;
    box-sizing: border-box;
}

.auth-channel-indicator {
    display: none;
}

.auth-channel-tab {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--auth-channel-inactive, #1A0F12);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.auth-channel-tab:hover:not(.is-active) {
    color: var(--auth-channel-hover, #1A0F12);
    background: rgba(26, 15, 18, 0.04);
}

.auth-channel-tab.is-active {
    background: var(--primary, #DC143C);
    color: #fff;
    font-weight: 600;
}

.auth-channel-tab-icon {
    display: none;
}

.auth-channel-tab:focus-visible {
    outline: 2px solid var(--primary, #DC143C);
    outline-offset: 2px;
}

.auth-channel-panel[hidden] {
    display: none !important;
}

[data-theme="dark"] .auth-channel-tabs {
    --auth-channel-track: #1A1416;
    --auth-channel-inactive: #F5F0F1;
    --auth-channel-hover: #F5F0F1;
}

[data-theme="dark"] .auth-channel-tab:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.06);
}

.interest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.chip-toggle {
    border: 1.5px solid var(--border, #e5e5e5);
    background: var(--surface, #fff);
    color: var(--text, #1a1a1a);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}
.chip-toggle.is-active {
    background: var(--primary, #DC143C);
    border-color: var(--primary, #DC143C);
    color: #fff;
}
