/* ========================================================================
   ULF — PAGE DE CONNEXION
   Design split-screen : marque à gauche (sceau en filigrane), formulaire à droite.
   Palette officielle ULF : marine (#141B4D) / glacier (#CADCFC) — raccord landing.
   100% local, no CDN
   ======================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

:root {
    --c-navy-900: #141B4D;
    --c-navy-800: #1E2761;
    --c-navy-700: #38428C;
    --c-navy-600: #5468B8;
    --c-cyan-400: #5468B8;
    --c-cyan-500: #1E2761;
    --c-cyan-600: #141B4D;
    --c-gold-500: #CADCFC;
    --c-white:    #ffffff;
    --c-gray-50:  #f9fafb;
    --c-gray-100: #f3f4f6;
    --c-gray-200: #e5e7eb;
    --c-gray-300: #d1d5db;
    --c-gray-400: #9ca3af;
    --c-gray-500: #6b7280;
    --c-gray-600: #4b5563;
    --c-gray-700: #374151;
    --c-gray-800: #1f2937;
    --c-error:    #ef4444;
    --c-success:  #10b981;

    --shadow-input: 0 0 0 4px rgba(30, 39, 97, 0.12);
    --r-md: 10px;
    --r-lg: 14px;
    --t-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --grad-navy: linear-gradient(135deg, #141B4D 0%, #1E2761 50%, #38428C 100%);
    --f-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Noto Serif', serif;
}

body.auth-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--c-gray-50);
    color: var(--c-gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   SPLIT LAYOUT
   ============================================================ */
.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    min-height: 100vh;
}

/* ============================================================
   PANNEAU GAUCHE — BRAND
   ============================================================ */
.auth-brand {
    background: var(--grad-navy);
    color: var(--c-white);
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

/* Décorations subtiles */
.auth-brand__decor {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}
.auth-brand__decor--1 {
    width: 350px; height: 350px;
    background: var(--c-cyan-500);
    top: -100px; right: -100px;
    opacity: 0.25;
}
.auth-brand__decor--2 {
    width: 280px; height: 280px;
    background: var(--c-gold-500);
    bottom: -80px; left: -80px;
    opacity: 0.15;
}
.auth-brand__seal {
    position: absolute;
    bottom: -18%; left: -16%;
    width: 620px;
    max-width: 90%;
    height: auto;
    transform: rotate(-6deg);
    opacity: 0.08;
    filter: grayscale(1) brightness(2.6);
    pointer-events: none;
}
@media (max-width: 960px) { .auth-brand__seal { display: none; } }

.auth-brand__top,
.auth-brand__middle,
.auth-brand__bottom {
    position: relative;
    z-index: 1;
}

/* Logo + nom institution */
.auth-brand__logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    transition: opacity var(--t-base);
}
.auth-brand__logo:hover { opacity: 0.85; }

.auth-brand__logo-mark {
    width: 48px;
    height: 48px;
    background: var(--c-white);
    color: var(--c-navy-900);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.auth-brand__logo-mark::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1.5px solid var(--c-cyan-500);
    border-radius: 7px;
    pointer-events: none;
}
.auth-brand__logo-img {
    width: 48px;
    height: 48px;
    border-radius: var(--r-md);
    object-fit: contain;
    background: white;
    padding: 4px;
}
.auth-brand__logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-white);
    letter-spacing: -0.3px;
    line-height: 1.15;
}
.auth-brand__logo-text small {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--c-gray-400);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-top: 3px;
}

/* Citation centrale */
.auth-brand__middle {
    max-width: 420px;
}
.auth-brand__quote {
    font-family: var(--f-display);
    font-style: italic;
    font-size: clamp(22px, 2.6vw, 32px);
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: 0;
    color: var(--c-white);
    margin-bottom: 16px;
}
.auth-brand__quote-mark {
    color: var(--c-cyan-500);
    font-size: 1.3em;
    font-weight: 700;
    line-height: 0;
}
.auth-brand__quote-accent {
    background: linear-gradient(135deg, #E4ECFC 0%, #CADCFC 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}
.auth-brand__quote-author {
    font-size: 13px;
    color: var(--c-gray-400);
    letter-spacing: 0.3px;
}

/* Stats en bas */
.auth-brand__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.auth-brand__stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--c-white);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}
.auth-brand__stat-label {
    font-size: 12px;
    color: var(--c-gray-400);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================================
   PANNEAU DROIT — FORMULAIRE
   ============================================================ */
.auth-form-panel {
    background: var(--c-white);
    padding: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.auth-back-mobile {
    position: absolute;
    top: 24px;
    left: 24px;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--c-gray-100);
    color: var(--c-gray-600);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--t-base);
}
.auth-back-mobile:hover {
    background: var(--c-gray-200);
    color: var(--c-gray-800);
}

.auth-form-wrapper {
    width: 100%;
    max-width: 400px;
    animation: formEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@keyframes formEnter {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header du formulaire */
.auth-form-header {
    margin-bottom: 32px;
}
.auth-form-title {
    font-family: var(--f-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--c-navy-900);
    letter-spacing: 0;
    line-height: 1.1;
    margin-bottom: 8px;
}
.auth-form-subtitle {
    font-size: 15px;
    color: var(--c-gray-500);
    line-height: 1.5;
}

/* Alertes */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 20px;
    animation: alertSlide 0.3s ease;
}
@keyframes alertSlide {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}
.auth-alert svg { flex-shrink: 0; margin-top: 1px; }
.auth-alert--error {
    background: #fef2f2;
    border-left: 3px solid var(--c-error);
    color: #991b1b;
}
.auth-alert--success {
    background: #f0fdf4;
    border-left: 3px solid var(--c-success);
    color: #166534;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 24px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.auth-field__label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.auth-field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-gray-700);
    letter-spacing: 0.2px;
}
.auth-field__help {
    font-size: 12.5px;
    color: var(--c-cyan-600);
    font-weight: 500;
    transition: color var(--t-base);
}
.auth-field__help:hover { color: var(--c-cyan-500); }

.auth-field__wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-field__icon {
    position: absolute;
    left: 14px;
    color: var(--c-gray-400);
    transition: color var(--t-base);
    pointer-events: none;
    z-index: 1;
}
.auth-field__wrap:focus-within .auth-field__icon {
    color: var(--c-cyan-500);
}

.auth-field__input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    font-size: 14px;
    font-family: inherit;
    color: var(--c-gray-800);
    background: var(--c-white);
    border: 1.5px solid var(--c-gray-200);
    border-radius: var(--r-md);
    transition: all var(--t-base);
    outline: none;
}
.auth-field__input::placeholder {
    color: var(--c-gray-400);
}
.auth-field__input:hover {
    border-color: var(--c-gray-300);
}
.auth-field__input:focus {
    border-color: var(--c-cyan-500);
    box-shadow: var(--shadow-input);
    background: var(--c-white);
}

/* Toggle password */
.auth-field__toggle {
    position: absolute;
    right: 8px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--c-gray-400);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base);
}
.auth-field__toggle:hover {
    background: var(--c-gray-100);
    color: var(--c-gray-700);
}

/* Checkbox custom */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.auth-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.auth-checkbox__box {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--c-gray-300);
    border-radius: 5px;
    background: var(--c-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base);
    flex-shrink: 0;
}
.auth-checkbox:hover .auth-checkbox__box {
    border-color: var(--c-cyan-500);
}
.auth-checkbox__box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--c-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--t-base);
    margin-top: -2px;
}
.auth-checkbox input:checked + .auth-checkbox__box {
    background: var(--c-cyan-500);
    border-color: var(--c-cyan-500);
}
.auth-checkbox input:checked + .auth-checkbox__box::after {
    transform: rotate(45deg) scale(1);
}
.auth-checkbox__label {
    font-size: 13px;
    color: var(--c-gray-600);
}

/* Choix du canal (email / SMS) — mot de passe oublié */
.auth-channel-choice {
    display: flex;
    gap: 10px;
}
.auth-channel-choice__option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1.5px solid var(--c-gray-300);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--c-gray-600);
    transition: all var(--t-base);
    -webkit-tap-highlight-color: transparent;
}
.auth-channel-choice__option:hover {
    border-color: var(--c-cyan-500);
}
.auth-channel-choice__option input {
    accent-color: var(--c-cyan-500);
    margin: 0;
}
.auth-channel-choice__option:has(input:checked) {
    border-color: var(--c-cyan-500);
    background: rgba(30, 39, 97, 0.06);
    color: var(--c-gray-800);
    font-weight: 600;
}

/* Submit button */
.auth-submit {
    position: relative;
    width: 100%;
    margin-top: 8px;
    padding: 14px 24px;
    background: var(--c-navy-900);
    color: var(--c-white);
    border: none;
    border-radius: var(--r-md);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--t-base);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(20, 27, 77, 0.2);
}
.auth-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-cyan-500) 0%, var(--c-cyan-600) 100%);
    opacity: 0;
    transition: opacity var(--t-base);
}
.auth-submit > * { position: relative; z-index: 1; }
.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(30, 39, 97, 0.35);
}
.auth-submit:hover::before { opacity: 1; }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { cursor: not-allowed; opacity: 0.7; }

.auth-submit__arrow {
    transition: transform var(--t-base);
}
.auth-submit:hover .auth-submit__arrow { transform: translateX(4px); }

.auth-submit__spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--c-white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-submit.is-loading .auth-submit__label,
.auth-submit.is-loading .auth-submit__arrow { display: none; }
.auth-submit.is-loading .auth-submit__spinner { display: inline-block; }

/* Footer du formulaire */
.auth-form-footer {
    text-align: center;
    color: var(--c-gray-500);
}
.auth-form-footer p {
    font-size: 13px;
    margin-bottom: 14px;
}
.auth-form-footer a {
    color: var(--c-cyan-600);
    font-weight: 600;
    transition: color var(--t-base);
}
.auth-form-footer a:hover { color: var(--c-cyan-500); }
.auth-form-footer__copy {
    font-size: 11.5px !important;
    color: var(--c-gray-400);
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--c-gray-100);
}

/* ============================================================
   RESPONSIVE
   Notes : 16px sur inputs en mobile pour éviter zoom auto iOS
   ============================================================ */
@media (max-width: 960px) {
    .auth-split {
        grid-template-columns: 1fr;
    }
    .auth-brand {
        min-height: auto;
        padding: 32px 32px 28px;
    }
    .auth-brand__top { margin-bottom: 0; }
    .auth-brand__middle { display: none; }
    .auth-brand__bottom { display: none; }
    .auth-brand__decor--1 { width: 200px; height: 200px; top: -60px; right: -60px; }
    .auth-brand__decor--2 { display: none; }

    .auth-form-panel { padding: 32px 24px; }
    .auth-back-mobile { display: -webkit-inline-flex; display: inline-flex; }
    .auth-form-wrapper { padding-top: 16px; }
}

@media (max-width: 640px) {
    .auth-brand {
        padding: 24px 20px;
    }
    .auth-brand__logo-mark,
    .auth-brand__logo-img {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .auth-brand__logo-text { font-size: 16px; }
    .auth-brand__logo-text small { font-size: 9.5px; }

    .auth-form-panel {
        padding: 24px 20px;
    }
    .auth-form-wrapper { padding-top: 10px; }
    .auth-form-header { margin-bottom: 24px; }
    .auth-form-title { font-size: 26px; }
    .auth-form-subtitle { font-size: 14px; }
}

@media (max-width: 380px) {
    .auth-brand { padding: 20px 16px; }
    .auth-form-panel { padding: 20px 16px; }
    .auth-form-title { font-size: 24px; }
}

/* iOS / mobile : forcer 16px sur les inputs pour empêcher le zoom au focus */
@media (max-width: 768px) {
    .auth-field__input { font-size: 16px !important; }
}

/* Anti-overflow horizontal */
html, body { overflow-x: hidden; max-width: 100%; }
