/* ============================================================
   Page Login — Design moderne institutionnel
   RGAA 4.1 / WCAG 2.1 AA — Marchés publics
   ============================================================ */

:root {
    --login-brand-bg:      #1a2f4e;
    --login-brand-accent:  #2563eb;
    --login-brand-light:   #3b82f6;
    --login-text-muted:    #94a3b8;
    --login-form-bg:       #ffffff;
    --login-input-border:  #d1d5db;
    --login-input-focus:   #2563eb;
    --login-radius:        0.625rem;
    --login-transition:    0.2s ease;
}

/* ── Reset page ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    background: var(--login-brand-bg);
}

/* ── Skip link (WCAG 2.4.1) ─────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: #fbbf24;
    color: #1a2f4e;
    border-radius: 0 0 0.375rem 0.375rem;
    font-weight: 700;
    text-decoration: none;
    transition: top 0.1s;
}
.skip-link:focus { top: 0; outline: 3px solid #2563eb; outline-offset: 2px; }

/* ── Focus visible global (WCAG 2.4.7) ──────────────────── */
:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Layout deux colonnes ───────────────────────────────── */
.login-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Panneau gauche — branding ───────────────────────────── */
.login-brand {
    flex: 1;
    background: linear-gradient(160deg, #1a2f4e 0%, #0f1e35 60%, #1a2f4e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

/* Motif décoratif en fond */
.login-brand::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.12);
    pointer-events: none;
}
.login-brand::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.08);
    pointer-events: none;
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 360px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.92;
    margin-bottom: 1.5rem;
}

.login-brand-title {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.login-brand-tagline {
    color: var(--login-text-muted);
    font-size: 0.95rem;
    margin: 0 0 2.5rem;
    line-height: 1.5;
}

.login-brand-divider {
    width: 40px;
    height: 3px;
    background: var(--login-brand-accent);
    border: none;
    border-radius: 2px;
    margin: 0 auto 2rem;
}

.login-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.login-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: #cbd5e1;
    font-size: 0.875rem;
    margin-bottom: 0.9rem;
    line-height: 1.4;
}

.login-features li .feat-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
    font-size: 0.65rem;
    color: #93c5fd;
}

.login-brand-footer {
    margin-top: 3rem;
    color: #475569;
    font-size: 0.75rem;
    text-align: center;
}

/* ── Panneau droit — formulaire ──────────────────────────── */
.login-form-panel {
    width: 100%;
    max-width: 480px;
    background: var(--login-form-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
}

.login-form-header {
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
}

.login-form-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.3rem;
    color: var(--login-brand-accent);
}

.login-form-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.25rem;
}

.login-form-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

/* ── Champs ──────────────────────────────────────────────── */
.login-field {
    width: 100%;
    margin-bottom: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem;
}

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

.login-input-wrap .input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.875rem;
    pointer-events: none;
}

.login-input-wrap input {
    width: 100%;
    padding: 0.65rem 2.75rem 0.65rem 2.5rem;
    border: 1.5px solid var(--login-input-border);
    border-radius: var(--login-radius);
    font-size: 0.925rem;
    color: #111827;
    background: #f9fafb;
    transition: border-color var(--login-transition), box-shadow var(--login-transition);
    outline: none;
}

.login-input-wrap input:focus {
    border-color: var(--login-input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #ffffff;
}

.login-input-wrap input::placeholder { color: #9ca3af; }

/* Bouton show/hide password */
.btn-toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.875rem;
    border-radius: 3px;
    transition: color var(--login-transition);
}
.btn-toggle-password:hover { color: #374151; }

/* ── Bouton connexion ────────────────────────────────────── */
.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: var(--login-brand-accent);
    color: #ffffff;
    border: none;
    border-radius: var(--login-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--login-transition), transform var(--login-transition),
                box-shadow var(--login-transition);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-login:active { transform: translateY(1px); }

.btn-login:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* ── Lien mot de passe oublié ────────────────────────────── */
.login-forgot {
    display: block;
    text-align: center;
    margin-top: 1.25rem;
    color: #6b7280;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color var(--login-transition);
}
.login-forgot:hover { color: var(--login-brand-accent); text-decoration: underline; }
.login-forgot:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Alertes ─────────────────────────────────────────────── */
.login-alert {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--login-radius);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

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

.login-alert.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* ── Loading spinner dans le bouton ─────────────────────── */
.btn-login .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-login.loading .spinner { display: inline-block; }
.btn-login.loading .btn-label { opacity: 0.7; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .login-shell { flex-direction: column; }

    .login-brand {
        padding: 2rem 1.5rem 1.5rem;
        min-height: auto;
    }

    .login-brand::before,
    .login-brand::after { display: none; }

    .login-logo { width: 56px; height: 56px; margin-bottom: 1rem; }
    .login-brand-title { font-size: 1.25rem; }
    .login-brand-tagline { font-size: 0.85rem; margin-bottom: 0; }
    .login-features,
    .login-brand-divider,
    .login-brand-footer { display: none; }

    .login-form-panel {
        max-width: 100%;
        padding: 2rem 1.25rem;
        flex: 1;
        justify-content: flex-start;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .login-brand { padding: 2rem 1.5rem; }
    .login-form-panel { max-width: 420px; padding: 2.5rem 2rem; }
}
