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

:root {
    --login-primary: #0d7a85;
    --login-primary-vivid: #11929f;
    --login-primary-dark: #09646e;
    --login-primary-light: #a0d3d9;
    --login-accent: #e3b505;
    --login-accent-light: #fdf6e3;
    --login-accent-text: #946b00;
    --login-bg: #f7f8fc;
    --login-text: #001427;
    --login-primary-rgb: 13, 122, 133;
    --login-accent-rgb: 227, 181, 5;
    --login-dark: #001427;
    --login-text-secondary: #5a5a72;
    --login-text-muted: #8c8c9a;
    --login-border: #e2e4ed;
    --login-input-bg: #f8f9fc;
    --login-radius: 12px;
    --login-success: #28a745;
    --login-warning: #ffc107;
    --login-danger: #dc3545;
    --login-gradient-panel: linear-gradient(161deg, var(--login-dark) 3%, var(--login-primary-vivid) 47%, var(--login-primary-light) 100%);
}

body {
    font-family: 'DM Sans', sans-serif;
    height: 100vh;
    background: var(--login-bg);
    display: flex;
    overflow: hidden;
}

/* =============================================
   LEFT PANEL — Brand / Visual
   ============================================= */
.login-brand-panel {
    position: relative;
    width: 45%;
    min-height: 100vh;
    background: var(--login-gradient-panel);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    overflow: hidden;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
    background-size: 32px 32px;
    animation: panelDrift 20s linear infinite;
}

@keyframes panelDrift {
    0% { background-position: 0 0; }
    100% { background-position: 32px 64px; }
}

.login-brand-panel::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--login-accent-rgb), 0.12) 0%, transparent 70%);
    bottom: -200px;
    right: -150px;
    pointer-events: none;
}

.brand-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.brand-orb--1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(var(--login-primary-rgb), 0.25) 0%, transparent 70%);
    top: -80px;
    left: -100px;
    animation: orbFloat 8s ease-in-out infinite;
}

.brand-orb--2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(var(--login-accent-rgb), 0.08) 0%, transparent 70%);
    top: 30%;
    right: -60px;
    animation: orbFloat 12s ease-in-out infinite reverse;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(15px, -20px); }
}

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 380px;
}

.brand-logo {
    height: 44px;
    width: auto;
    margin-bottom: 40px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
    animation: logoEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.brand-tagline {
    color: rgba(255, 255, 255, 0.85);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: -0.01em;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.brand-tagline strong {
    color: #fff;
    font-weight: 600;
}

.brand-divider {
    width: 48px;
    height: 3px;
    background: var(--login-accent);
    border-radius: 3px;
    margin: 28px auto;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.brand-subtitle {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

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

/* =============================================
   RIGHT PANEL — Form
   ============================================= */
.login-form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px;
    position: relative;
    overflow-y: auto;
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
    margin: auto;
    animation: formEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes formEnter {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.login-welcome {
    font-size: 18px;
    font-weight: 600;
    /* RGAA : #0d7a85 sur #fff = ratio ~4.8:1 ✓ */
    color: var(--login-primary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.login-greeting {
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 700;
    color: var(--login-text);
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 15px;
    color: var(--login-text-muted);
    margin-bottom: 20px;
    font-weight: 400;
    line-height: 1.6;
}

/* =============================================
   Pill Connexion / S'inscrire
   ============================================= */
.login-pill {
    display: inline-flex;
    background: var(--login-bg);
    border-radius: 100px;
    padding: 4px;
    margin-bottom: 32px;
    gap: 2px;
}

.login-pill__item {
    padding: 8px 22px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    /* RGAA : #5a5a72 sur #f7f8fc = ratio ~4.6:1 ✓ */
    color: var(--login-text-secondary);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.login-pill__item:hover {
    color: var(--login-text);
}

.login-pill__item--active {
    background: #fff;
    /* RGAA : #001427 sur #fff = ratio >18:1 ✓ */
    color: var(--login-text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* =============================================
   Form fields
   ============================================= */
.login-field {
    margin-bottom: 20px;
}

.login-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--login-text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.login-input-wrapper {
    position: relative;
}

.login-input-wrapper > i:first-of-type {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--login-text-muted);
    font-size: 16px;
    transition: color 0.2s ease;
    pointer-events: none;
}

.login-input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 1.5px solid var(--login-border);
    border-radius: var(--login-radius);
    background: var(--login-input-bg);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--login-text);
    transition: all 0.25s ease;
    outline: none;
}

.login-input::placeholder {
    color: var(--login-text-muted);
    font-weight: 400;
}

.login-input:hover {
    border-color: #c8cce0;
}

.login-input:focus {
    border-color: var(--login-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(var(--login-primary-rgb), 0.08);
}

.login-input-wrapper:focus-within > i:first-of-type {
    color: var(--login-primary);
}

.login-input.input-error {
    border-color: var(--login-danger);
}

.login-input.input-error:focus {
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.08);
}

.login-field-error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--login-danger);
    animation: alertSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-field-error i {
    font-size: 13px;
}

/* =============================================
   Password toggle
   ============================================= */
.login-password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--login-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: color 0.2s ease;
}

.login-password-toggle:hover {
    color: var(--login-primary);
}

/* =============================================
   Password strength (reset password page)
   ============================================= */
.password-strength {
    height: 4px;
    background: var(--login-border);
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: var(--login-danger);
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-bar.strength-weak   { background-color: var(--login-danger); }
.password-strength-bar.strength-medium { background-color: var(--login-warning); }
.password-strength-bar.strength-strong { background-color: var(--login-success); }

.password-requirements {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.password-req {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--login-text-muted);
    transition: color 0.2s ease;
}

.password-req i {
    font-size: 14px;
    transition: color 0.2s ease;
}

.password-req.met {
    color: var(--login-success);
}

.password-req.met i {
    color: var(--login-success);
}

/* =============================================
   Submit button
   ============================================= */
.login-submit {
    width: 100%;
    padding: 15px 24px;
    border: none;
    border-radius: var(--login-radius);
    background: var(--login-primary-vivid);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.login-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-submit:hover:not(:disabled) {
    background: var(--login-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(var(--login-primary-rgb), 0.3);
}

.login-submit:hover:not(:disabled)::before {
    opacity: 1;
}

.login-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(var(--login-primary-rgb), 0.2);
}

.login-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-submit i {
    margin-right: 8px;
    font-size: 16px;
}

.login-submit--link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* =============================================
   Links (forgot password, back)
   ============================================= */
.login-forgot {
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--login-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-forgot:hover {
    color: var(--login-primary);
}

.login-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    font-size: 13px;
    color: var(--login-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-back:hover {
    color: var(--login-primary);
}

/* =============================================
   Alert messages
   ============================================= */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--login-radius);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    animation: alertSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-alert--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.login-alert--error i {
    color: #dc2626;
    font-size: 16px;
    margin-top: 1px;
}

.login-alert--success {
    background: var(--login-accent-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.login-alert--success i {
    color: var(--login-accent);
    font-size: 16px;
    margin-top: 1px;
}

.login-alert__close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    transition: opacity 0.2s;
}

.login-alert__close:hover {
    opacity: 1;
}

/* =============================================
   Already connected state
   ============================================= */
.login-already-connected {
    text-align: center;
}

.login-already-connected .login-greeting {
    margin-bottom: 8px;
}

.login-already-connected .login-subtitle {
    margin-bottom: 32px;
}

.login-already-connected .login-subtitle strong {
    color: var(--login-text);
}

.login-already-connected__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--login-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-already-connected__icon i {
    font-size: 28px;
    color: var(--login-accent);
}

/* =============================================
   Footer
   ============================================= */
.login-footer {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--login-text-muted);
    white-space: nowrap;
}

/* =============================================
   Mobile logo (hidden on desktop)
   ============================================= */
.login-mobile-logo {
    display: none;
    margin-bottom: 32px;
}

.login-mobile-logo img {
    height: 36px;
    width: auto;
}

/* =============================================
   RESPONSIVE
   ============================================= */
/* Utilitaire : masquer un élément */
.login-hidden { display: none; }

/* Animation dismiss alert (remplace inline JS styles) */
.login-alert--dismissing {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991px) {
    .login-brand-panel {
        display: none;
    }

    body {
        background: #fff;
        overflow: auto;
    }

    .login-form-panel {
        padding: 32px 24px;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 80px;
    }

    .login-mobile-logo {
        display: block;
    }

    .login-greeting {
        font-size: 24px;
    }

    .login-footer {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        text-align: center;
        margin-top: 48px;
    }
}

@media (max-width: 480px) {
    .login-form-panel {
        padding: 24px 20px;
        padding-top: 60px;
    }

    .login-input {
        padding: 13px 14px 13px 42px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .login-submit {
        padding: 14px 20px;
    }
}
