/* ==========================================================================
   Travelife — Pages d'authentification (connexion, mot de passe, 2FA, appareil)
   Layout « split » : panneau de marque bleu + panneau formulaire blanc.
   Responsive (desktop / tablette / mobile) et compatible RTL (arabe).
   ========================================================================== */

:root {
    --auth-navy-900: #071447;
    --auth-navy-800: #0a1a5c;
    --auth-navy-700: #10236f;
    --auth-navy-600: #17308a;
    --auth-ink: #13225f;
    --auth-text: #2b3553;
    --auth-muted: #6b7591;
    --auth-border: #d9deea;
    --auth-border-focus: #f26b2b;
    --auth-orange: #f26b2b;
    --auth-orange-600: #e35a19;
    --auth-blue-dot: #2f63e0;
    --auth-danger: #c62f2f;
    --auth-danger-bg: #fdecec;
    --auth-success: #157347;
    --auth-success-bg: #e7f6ee;
    --auth-radius: 10px;
    --auth-font: 'Outfit', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

html[lang="ar"] { --auth-font: 'Tajawal', 'Outfit', 'Segoe UI', Tahoma, Arial, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body.auth-body {
    margin: 0;
    font-family: var(--auth-font);
    color: var(--auth-text);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

.auth-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Panneau de marque (bleu) ───────────────────────────────────────────── */
.auth-hero {
    position: relative;
    flex: 0 0 57%;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(1200px 700px at 85% 15%, rgba(47, 99, 224, .28), transparent 60%),
        radial-gradient(900px 600px at 10% 95%, rgba(10, 26, 92, .9), transparent 70%),
        linear-gradient(135deg, var(--auth-navy-800) 0%, var(--auth-navy-700) 55%, var(--auth-navy-900) 100%);
    display: flex;
    flex-direction: column;
    padding: 48px 64px 44px;
}

/* carte du monde en pointillés (motif + masque) */
.auth-hero__dots {
    position: absolute;
    inset: 22% -6% 8% 38%;
    background-image: radial-gradient(rgba(108, 140, 230, .55) 1.4px, transparent 1.6px);
    background-size: 11px 11px;
    -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
            mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
    opacity: .55;
    pointer-events: none;
}

.auth-hero__orbits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.auth-hero__orbits .orbit { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1.1; stroke-dasharray: 3 7; }
.auth-hero__orbits .dot-orange { fill: var(--auth-orange); }
.auth-hero__orbits .dot-blue { fill: var(--auth-blue-dot); }

.auth-hero__logo {
    position: relative;
    z-index: 1;
    display: inline-block;
    line-height: 0;
}
.auth-hero__logo img { height: 66px; width: auto; max-width: 100%; }

.auth-hero__content {
    position: relative;
    z-index: 1;
    margin-top: 44px;
    max-width: 640px;
}

.auth-hero__title {
    margin: 0;
    font-size: clamp(2rem, 3.4vw, 3.35rem);
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -.02em;
}
.auth-hero__title span { display: block; }
.auth-hero__title .accent { display: inline; color: var(--auth-orange); }

.auth-hero__subtitle {
    margin: 18px 0 0;
    max-width: 520px;
    font-size: clamp(1rem, 1.25vw, 1.2rem);
    line-height: 1.5;
    color: rgba(255, 255, 255, .88);
}

.auth-hero__tagline {
    position: relative;
    z-index: 1;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .95rem;
    color: rgba(255, 255, 255, .85);
}
.auth-hero__tagline::before {
    content: "";
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: var(--auth-orange);
    flex: 0 0 auto;
}

/* ── Panneau formulaire (blanc) ─────────────────────────────────────────── */
.auth-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
}

.auth-panel__main {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

.auth-card__logo {
    display: block;
    margin: 0 auto 36px;
    height: 74px;
    width: auto;
    max-width: 100%;
}

.auth-card__title {
    margin: 0;
    text-align: center;
    font-size: clamp(1.5rem, 2.1vw, 2rem);
    font-weight: 700;
    color: var(--auth-ink);
    letter-spacing: -.01em;
}

.auth-card__subtitle {
    margin: 10px 0 30px;
    text-align: center;
    font-size: 1.02rem;
    line-height: 1.5;
    color: var(--auth-muted);
}

/* alertes */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: var(--auth-radius);
    font-size: .93rem;
    line-height: 1.45;
}
.auth-alert svg { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.auth-alert--error { background: var(--auth-danger-bg); color: var(--auth-danger); }
.auth-alert--success { background: var(--auth-success-bg); color: var(--auth-success); }

/* champs */
.auth-field { margin-bottom: 20px; }

.auth-label {
    display: block;
    margin-bottom: 8px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--auth-ink);
}

.auth-input-wrap { position: relative; }

.auth-input-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 16px;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    color: #7b84a0;
    pointer-events: none;
}

.auth-input {
    display: block;
    width: 100%;
    height: 54px;
    padding-block: 0;
    padding-inline: 50px 16px;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: #fff;
    font: inherit;
    font-size: 1rem;
    color: var(--auth-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input::placeholder { color: #9aa2b8; }
.auth-input:focus {
    outline: none;
    border-color: var(--auth-border-focus);
    box-shadow: 0 0 0 4px rgba(242, 107, 43, .14);
}
.auth-input.is-invalid { border-color: var(--auth-danger); }
.auth-input--with-toggle { padding-inline-end: 52px; }
.auth-input--code {
    padding-inline: 16px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: .5em;
    font-variant-numeric: tabular-nums;
}

.auth-toggle-pwd {
    position: absolute;
    top: 50%;
    inset-inline-end: 8px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b7591;
    cursor: pointer;
}
.auth-toggle-pwd:hover { background: #f2f4f9; color: var(--auth-ink); }
.auth-toggle-pwd:focus-visible { outline: 2px solid var(--auth-orange); outline-offset: 1px; }
.auth-toggle-pwd svg { width: 20px; height: 20px; }
.auth-toggle-pwd .icon-hide { display: none; }
.auth-toggle-pwd[aria-pressed="true"] .icon-show { display: none; }
.auth-toggle-pwd[aria-pressed="true"] .icon-hide { display: inline; }

.auth-error {
    display: block;
    margin-top: 7px;
    font-size: .88rem;
    color: var(--auth-danger);
}

/* ligne « se souvenir » + lien */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 4px 0 26px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .95rem;
    color: var(--auth-muted);
    cursor: pointer;
    user-select: none;
}
.auth-check input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--auth-orange);
    cursor: pointer;
}

.auth-link {
    font-weight: 600;
    color: var(--auth-ink);
    text-decoration: none;
}
.auth-link:hover { color: var(--auth-orange-600); text-decoration: underline; }

/* bouton principal */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: var(--auth-radius);
    background: linear-gradient(180deg, #f6793b 0%, var(--auth-orange) 100%);
    box-shadow: 0 8px 20px -10px rgba(242, 107, 43, .75);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.auth-btn:hover { background: linear-gradient(180deg, #f26b2b 0%, var(--auth-orange-600) 100%); color: #fff; }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: 3px solid rgba(242, 107, 43, .35); outline-offset: 2px; }
.auth-btn[disabled] { opacity: .75; cursor: progress; }
.auth-btn svg { width: 20px; height: 20px; }
[dir="rtl"] .auth-btn svg.auth-arrow { transform: scaleX(-1); }

.auth-btn--ghost {
    background: #fff;
    box-shadow: none;
    border: 1.5px solid var(--auth-border);
    color: var(--auth-ink);
}
.auth-btn--ghost:hover { background: #f5f7fb; color: var(--auth-ink); }

.auth-actions { display: grid; gap: 12px; }

.auth-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    font-size: .95rem;
}
.auth-back svg { width: 18px; height: 18px; }
[dir="rtl"] .auth-back svg { transform: scaleX(-1); }

.auth-divider { height: 1px; margin: 34px 0 24px; background: #e9ecf3; border: 0; }

.auth-help {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: .93rem;
    color: var(--auth-muted);
}
.auth-help svg { width: 22px; height: 22px; color: #6b7591; }
.auth-help a { color: var(--auth-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* 2FA : QR code + clé */
.auth-qr {
    display: flex;
    justify-content: center;
    margin: 6px auto 22px;
    padding: 14px;
    width: fit-content;
    border: 1.5px solid var(--auth-border);
    border-radius: 14px;
    background: #fff;
}
.auth-qr svg, .auth-qr img { display: block; width: 200px; height: 200px; }

.auth-secret {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 26px;
    padding: 10px 10px 10px 14px;
    border: 1.5px dashed var(--auth-border);
    border-radius: var(--auth-radius);
    background: #f8f9fc;
}
.auth-secret code {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--auth-ink);
    direction: ltr;
    text-align: start;
}
.auth-secret button {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 14px;
    border: 1.5px solid var(--auth-border);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--auth-ink);
    cursor: pointer;
}
.auth-secret button:hover { border-color: var(--auth-orange); color: var(--auth-orange-600); }
.auth-hint { margin: -8px 0 22px; font-size: .9rem; color: var(--auth-muted); text-align: center; }

/* pied de page du panneau */
.auth-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 18px 32px 22px;
    font-size: .9rem;
    color: var(--auth-muted);
}
.auth-footer__sep { width: 1px; height: 14px; background: #d6dbe6; }

.auth-lang { position: relative; }
.auth-lang summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    cursor: pointer;
    color: var(--auth-text);
    padding: 4px 2px;
}
.auth-lang summary::-webkit-details-marker { display: none; }
.auth-lang summary svg { width: 16px; height: 16px; transition: transform .15s ease; }
.auth-lang[open] summary svg { transform: rotate(180deg); }
.auth-lang ul {
    position: absolute;
    bottom: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 150px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid #e3e7f0;
    border-radius: 10px;
    box-shadow: 0 14px 30px -12px rgba(16, 35, 111, .28);
    z-index: 10;
}
.auth-lang a {
    display: block;
    padding: 8px 12px;
    border-radius: 7px;
    color: var(--auth-text);
    text-decoration: none;
}
.auth-lang a:hover, .auth-lang a[aria-current="true"] { background: #f2f4f9; color: var(--auth-ink); font-weight: 600; }

/* ── Tablette : le panneau de marque passe en bandeau supérieur ─────────── */
@media (max-width: 991.98px) {
    .auth-shell { flex-direction: column; }
    .auth-hero {
        flex: 0 0 auto;
        padding: 26px 28px 30px;
    }
    .auth-hero__logo img { height: 46px; }
    .auth-hero__content { margin-top: 22px; }
    .auth-hero__title { font-size: clamp(1.6rem, 5vw, 2.3rem); }
    .auth-hero__title span { display: inline; }
    .auth-hero__subtitle { margin-top: 10px; font-size: 1rem; }
    .auth-hero__tagline { display: none; }
    .auth-hero__dots { inset: 10% -20% -30% 45%; }
    .auth-panel__main { padding: 34px 24px 16px; align-items: flex-start; }
    .auth-card__logo { display: none; }
    .auth-footer { justify-content: center; padding: 16px 20px 22px; }
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .auth-hero { padding: 20px 20px 24px; }
    .auth-hero__logo img { height: 40px; }
    .auth-hero__content { margin-top: 16px; }
    .auth-hero__title { font-size: 1.5rem; }
    .auth-hero__subtitle { display: none; }
    .auth-panel__main { padding: 26px 18px 10px; }
    .auth-card__subtitle { margin-bottom: 24px; font-size: .97rem; }
    .auth-input, .auth-btn { height: 52px; }
    .auth-qr svg, .auth-qr img { width: 170px; height: 170px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
