/* Page de connexion — feuille autonome (style.css n'est pas chargé ici) */

:root {
    --lg-bg: #f6f6fb;
    --lg-surface: #ffffff;
    --lg-text: #15162c;
    --lg-muted: #6a6e86;
    --lg-border: #e2e3ef;
    --lg-accent: #5b5fe9;
    --lg-accent-2: #8b5cf6;
    --lg-ring: rgba(91, 95, 233, 0.18);
    --lg-danger: #dc2626;
    --lg-danger-bg: #fef2f2;
    --lg-danger-border: #fecaca;
    --lg-warning: #b45309;
    --lg-veil: linear-gradient(165deg, rgba(79, 70, 229, 0.62) 0%, rgba(109, 40, 217, 0.72) 55%, rgba(30, 16, 74, 0.92) 100%);
}
[data-theme="dark"] {
    --lg-bg: #0d0f1e;
    --lg-surface: #171a2f;
    --lg-text: #eef0fb;
    --lg-muted: #9a9fbd;
    --lg-border: #2b2f4c;
    --lg-accent: #8b8ff7;
    --lg-accent-2: #b197fc;
    --lg-ring: rgba(139, 143, 247, 0.25);
    --lg-danger: #fca5a5;
    --lg-danger-bg: rgba(220, 38, 38, 0.12);
    --lg-danger-border: rgba(248, 113, 113, 0.35);
    --lg-warning: #fbbf24;
    --lg-veil: linear-gradient(165deg, rgba(30, 27, 75, 0.78) 0%, rgba(46, 16, 101, 0.84) 55%, rgba(8, 8, 24, 0.96) 100%);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.login-page {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--lg-text);
    background: var(--lg-bg);
    -webkit-font-smoothing: antialiased;
}

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

/* ---------- Volet visuel ---------- */

.login-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 52px 52px;
    color: #fff;
    isolation: isolate;
}
.login-hero-photo {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: #2b1d6b url('/gestionimmo/static/img/login-bg.jpg') 62% center / cover no-repeat;
    animation: lg-drift 28s ease-in-out infinite alternate;
}
.login-hero-veil {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--lg-veil);
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.01em;
}
.login-brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.login-hero-copy { max-width: 30rem; }
.login-hero-copy h2 {
    margin: 0 0 14px;
    font-size: clamp(30px, 3.1vw, 46px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-wrap: balance;
}
.login-hero-copy p {
    margin: 0 0 26px;
    font-size: 16px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
}
.login-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.login-chips li {
    padding: 7px 13px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.22);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* ---------- Volet formulaire ---------- */

.login-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 72px 32px 28px;
}

.login-theme {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--lg-muted);
    background: var(--lg-surface);
    border: 1px solid var(--lg-border);
    border-radius: 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, transform 0.15s;
}
.login-theme:hover { color: var(--lg-accent); border-color: var(--lg-accent); transform: rotate(12deg); }
.login-theme .icon-sun { display: none; }
[data-theme="dark"] .login-theme .icon-sun { display: block; }
[data-theme="dark"] .login-theme .icon-moon { display: none; }

.login-card {
    width: 100%;
    max-width: 380px;
    margin: auto 0;
}
.login-card > * { animation: lg-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.login-card > *:nth-child(2) { animation-delay: 0.06s; }
.login-card > *:nth-child(3) { animation-delay: 0.12s; }
.login-card > *:nth-child(4) { animation-delay: 0.18s; }

.login-head { margin-bottom: 30px; }
.login-eyebrow {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--lg-accent);
}
.login-head h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.login-head p:last-child {
    margin: 0;
    font-size: 15px;
    color: var(--lg-muted);
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--lg-danger);
    background: var(--lg-danger-bg);
    border: 1px solid var(--lg-danger-border);
    border-radius: 12px;
    animation: lg-shake 0.45s ease-in-out both !important;
}
.login-alert svg { flex: none; margin-top: 1px; }

/* Champs à libellé flottant */
.login-field {
    position: relative;
    margin-bottom: 16px;
}
.login-field input {
    width: 100%;
    height: 58px;
    padding: 22px 46px 6px 46px;
    font: inherit;
    font-size: 16px;
    color: var(--lg-text);
    background: var(--lg-surface);
    border: 1.5px solid var(--lg-border);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:hover { border-color: color-mix(in srgb, var(--lg-accent) 45%, var(--lg-border)); }
.login-field input:focus {
    border-color: var(--lg-accent);
    box-shadow: 0 0 0 4px var(--lg-ring);
}
.login-field input:-webkit-autofill {
    -webkit-text-fill-color: var(--lg-text);
    box-shadow: 0 0 0 100px var(--lg-surface) inset;
    caret-color: var(--lg-text);
}
.login-field input:-webkit-autofill:focus {
    box-shadow: 0 0 0 100px var(--lg-surface) inset, 0 0 0 4px var(--lg-ring);
}
.login-field label {
    position: absolute;
    left: 46px;
    top: 19px;
    font-size: 16px;
    color: var(--lg-muted);
    pointer-events: none;
    transform-origin: left top;
    transition: transform 0.15s ease, color 0.15s ease;
}
.login-field input:focus ~ label,
.login-field input:not(:placeholder-shown) ~ label,
.login-field input:-webkit-autofill ~ label {
    transform: translateY(-10px) scale(0.75);
}
.login-field input:focus ~ label { color: var(--lg-accent); }
.login-field-icon {
    position: absolute;
    left: 15px;
    top: 20px;
    color: var(--lg-muted);
    pointer-events: none;
    transition: color 0.15s;
}
.login-field:focus-within .login-field-icon { color: var(--lg-accent); }

.login-reveal {
    position: absolute;
    right: 8px;
    top: 9px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--lg-muted);
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}
.login-reveal:hover { color: var(--lg-accent); }
.login-reveal:focus-visible,
.login-theme:focus-visible,
.login-submit:focus-visible {
    outline: 2px solid var(--lg-accent);
    outline-offset: 2px;
}
.login-reveal .icon-eye-off { display: none; }
.login-reveal[aria-pressed="true"] .icon-eye { display: none; }
.login-reveal[aria-pressed="true"] .icon-eye-off { display: block; }

.login-caps {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -6px 0 14px 2px;
    font-size: 13px;
    font-weight: 500;
    color: var(--lg-warning);
}
.login-caps[hidden] { display: none; }

.login-submit {
    position: relative;
    width: 100%;
    height: 54px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #5b5fe9 0%, #7c3aed 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 10px 24px -10px rgba(91, 95, 233, 0.75);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.login-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 16px 28px -12px rgba(91, 95, 233, 0.85);
}
.login-submit:active { transform: translateY(0); }
.login-submit .arrow { transition: transform 0.2s; }
.login-submit:hover .arrow { transform: translateX(4px); }
.login-submit .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lg-spin 0.7s linear infinite;
}
.login-submit.is-loading { pointer-events: none; filter: saturate(0.8); }
.login-submit.is-loading .spinner { display: block; }
.login-submit.is-loading .arrow { display: none; }

.login-foot {
    margin-top: 32px;
    font-size: 12.5px;
    color: var(--lg-muted);
    text-align: center;
}

/* Voiliers en WebGPU (login-mer.js) : la classe has-mer n'est posée que si le rendu démarre */
.login-mer {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.4s ease;
}
.login-panel.has-mer { background: #0b0d18; }
.login-panel.has-mer .login-mer { opacity: 1; }
.login-panel.has-mer .login-card {
    max-width: 444px;
    padding: 34px 32px 30px;
    background: color-mix(in srgb, var(--lg-surface) 80%, transparent);
    border: 1px solid color-mix(in srgb, var(--lg-surface) 40%, transparent);
    border-radius: 24px;
    box-shadow: 0 30px 70px -28px rgba(5, 6, 20, 0.7);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
}
.login-panel.has-mer .login-foot {
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ---------- Animations ---------- */

@keyframes lg-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}
@keyframes lg-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
@keyframes lg-spin { to { transform: rotate(360deg); } }
@keyframes lg-drift {
    from { transform: scale(1.04); }
    to { transform: scale(1.14) translate(-1.5%, -1%); }
}

/* ---------- Mobile / tablette ---------- */

@media (max-width: 900px) {
    .login-shell { position: relative; grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .login-hero { padding: 22px 20px 26px; min-height: 190px; }
    .login-hero-copy h2 { font-size: 26px; margin: 28px 0 0; }
    .login-hero-copy p, .login-chips { display: none; }
    .login-panel { position: static; padding: 32px 20px 24px; justify-content: flex-start; }
    .login-mer { display: none; }
    .login-card { margin: 0; }
    .login-theme {
        top: 20px;
        right: 16px;
        color: #fff;
        background: rgba(255, 255, 255, 0.16);
        border-color: rgba(255, 255, 255, 0.28);
    }
    .login-theme:hover { color: #fff; border-color: #fff; }
    .login-head h1 { font-size: 26px; }
    .login-foot { margin-top: auto; padding-top: 28px; }
}

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