/* =====================================================================
   PAGE DE CONNEXION — thème sombre AFPTM (cf. css/afptm-theme.css)
   ===================================================================== */
html, body { height: 100%; }

body.af-login {
    margin: 0;
    min-height: 100vh;
    background: var(--af-bg);
    color: var(--af-text);
    font-family: var(--af-font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
/* neutralise le fond générique de css/style.css */
body.af-login::before { background: var(--af-bg) !important; }

.lg-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(440px, 0.88fr);
    gap: 24px;
    min-height: 100vh;
    padding: 24px;
}

/* ---------- Panneau visuel ---------- */
.lg-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 560px;
    padding: 34px 44px 44px;
    border-radius: 16px;
    border: 1px solid #1f2731;
    overflow: hidden;
    background: #0b1119 url("../images/afptm-chantier.svg") center 70% / cover no-repeat;
}
.lg-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(9, 13, 17, 0.55) 0%, rgba(9, 13, 17, 0) 26%),
        linear-gradient(0deg, rgba(9, 13, 17, 0.92) 0%, rgba(9, 13, 17, 0.55) 32%, rgba(9, 13, 17, 0) 56%);
    pointer-events: none;
}
.lg-hero > * { position: relative; }

.lg-logo {
    display: block;
    width: 232px;
    height: auto;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.55));
}

.lg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 12px;
    margin-bottom: 18px;
    border-radius: 999px;
    border: 1px solid rgba(214, 160, 45, 0.55);
    background: rgba(240, 180, 40, 0.10);
    color: var(--af-gold-text);
    font: 600 12px/1 var(--af-font);
}
.lg-hero h2 {
    margin: 0 0 14px;
    max-width: 560px;
    color: #fff;
    font: 700 40px/1.15 var(--af-font);
    letter-spacing: -0.02em;
}
.lg-hero p {
    margin: 0;
    max-width: 520px;
    color: var(--af-text-2);
    font: 400 15.5px/1.6 var(--af-font);
}

.lg-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}
.lg-features li {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    padding: 0 18px 0 8px;
    border-radius: var(--af-radius);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(16, 22, 28, 0.78);
    color: #e8ecf0;
    font: 500 14px/1 var(--af-font);
    backdrop-filter: blur(6px);
}
.lg-features li span.lg-ico {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--af-gold-soft);
    color: var(--af-gold);
}

/* ---------- Panneau formulaire ---------- */
.lg-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
.lg-card {
    width: 100%;
    max-width: 440px;
    padding: 36px 36px 32px;
    border-radius: var(--af-radius-lg);
}
.lg-card-logo { display: none; width: 180px; margin: 0 auto 26px; }

.lg-title {
    margin: 0;
    color: #fff;
    font: 700 28px/34px var(--af-font);
    letter-spacing: -0.01em;
}
.lg-subtitle {
    margin: 4px 0 28px;
    color: #a3acb6;
    font: 400 14px/20px var(--af-font);
}

.lg-form .lg-group { margin-bottom: 18px; }
.lg-form .af-input { height: 46px; }
.lg-form .af-field > svg + .af-input { padding-left: 46px; }
.lg-form .lg-pwd .af-input { padding-right: 48px; }

.lg-eye {
    position: absolute;
    right: 6px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8a949f;
    cursor: pointer;
}
.lg-eye:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.lg-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(245, 177, 42, 0.28); }
.lg-eye .lg-eye-off { display: none; }
.lg-eye[aria-pressed="true"] .lg-eye-on { display: none; }
.lg-eye[aria-pressed="true"] .lg-eye-off { display: block; }

.lg-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 26px;
}
.lg-forgot {
    color: var(--af-gold-text);
    font: 500 13.5px/1.2 var(--af-font);
    text-decoration: none;
}
.lg-forgot:hover { color: var(--af-gold-hover); text-decoration: underline; }

.lg-form .btn-login {
    height: 46px;
    font-size: 15px;
}
.lg-form .btn-login:disabled { opacity: .7; cursor: progress; }

.lg-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--af-line);
    color: var(--af-muted);
    font: 400 12.5px/1.4 var(--af-font);
}
.lg-secure svg { color: var(--af-gold); }

.lg-footer {
    margin-top: 22px;
    color: var(--af-muted);
    font: 400 12.5px/1.4 var(--af-font);
    text-align: center;
}
.lg-footer a { color: var(--af-text-3); text-decoration: none; }
.lg-footer a:hover { color: #fff; }

/* ---------- Écran de démarrage (conservé) ---------- */
#splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 45%, #111922 0%, var(--af-bg) 70%);
    opacity: 1;
    transition: opacity .6s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash .splash-logo {
    width: min(420px, 70vw);
    height: auto;
    filter: drop-shadow(0 6px 26px rgba(0, 0, 0, 0.55));
    animation: splashLogo 1.6s ease both;
}
@keyframes splashLogo {
    0%   { opacity: 0; transform: scale(0.82); }
    22%  { opacity: 1; transform: scale(1); }
    80%  { opacity: 1; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.04); }
}
#splash .splash-spinner {
    position: absolute;
    bottom: 14%;
    width: 26px;
    height: 26px;
    border: 3px solid rgba(245, 177, 42, 0.25);
    border-top-color: var(--af-gold);
    border-radius: 50%;
    animation: splashSpin .7s linear infinite;
}
@keyframes splashSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    #splash .splash-logo, #splash .splash-spinner { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .lg-shell { grid-template-columns: minmax(0, 1fr) minmax(400px, 1fr); }
    .lg-hero { padding: 30px 32px 34px; }
    .lg-hero h2 { font-size: 32px; }
    .lg-features li { height: 44px; font-size: 13px; }
}
@media (max-width: 900px) {
    .lg-shell { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
    .lg-hero { min-height: 0; padding: 22px 24px 26px; gap: 40px; }
    .lg-logo { width: 170px; }
    .lg-hero h2 { font-size: 26px; }
    .lg-hero p { font-size: 14px; }
    .lg-features { display: none; }
    .lg-panel { padding: 0 0 8px; }
}
@media (max-width: 520px) {
    .lg-hero { display: none; }
    .lg-card-logo { display: block; }
    .lg-card { padding: 28px 22px 24px; }
    .lg-options { flex-wrap: wrap; }
}

/* ---------- Double authentification ---------- */
.lg-step[hidden], .lg-error[hidden] { display: none !important; }

.lg-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: -8px 0 18px -6px;
    padding: 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--af-text-3);
    font: 500 13px/1 var(--af-font);
    cursor: pointer;
}
.lg-back:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.lg-back:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(245, 177, 42, 0.28); }

.lg-step-ico {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 18px;
    border-radius: 12px;
    background: var(--af-gold-soft);
    border: 1px solid rgba(214, 160, 45, 0.35);
    color: var(--af-gold);
}

.lg-form .af-input.lg-otp {
    height: 56px;
    text-align: center;
    font: 600 26px/1 var(--af-font);
    letter-spacing: 0.5em;
    padding-left: calc(14px + 0.5em);
    font-variant-numeric: tabular-nums;
}
.lg-form .af-input.lg-otp::placeholder { color: #3a444f; }

.lg-error {
    margin: 10px 0 0;
    color: #ff8a84;
    font: 500 13px/1.4 var(--af-font);
}

.lg-link {
    display: block;
    margin: 18px auto 0;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: var(--af-gold-text);
    font: 500 13.5px/1.2 var(--af-font);
    cursor: pointer;
}
.lg-link:hover { color: var(--af-gold-hover); text-decoration: underline; }

.lg-qr {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 22px;
    padding: 14px;
    border-radius: var(--af-radius);
    border: 1px solid var(--af-border);
    background: var(--af-field);
}
.lg-qr-box {
    flex: none;
    display: grid;
    place-items: center;
    width: 168px;
    height: 168px;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.lg-qr-box img { display: block; width: 100%; height: 100%; }
.lg-qr-missing { padding: 12px; color: #4b5563; font: 500 12px/1.4 var(--af-font); text-align: center; }
.lg-secret { min-width: 0; }
.lg-secret code {
    display: block;
    margin-bottom: 12px;
    color: #fff;
    font: 600 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .04em;
    word-break: break-all;
}

.lg-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 14px;
    padding: 14px;
    list-style: none;
    border-radius: var(--af-radius);
    border: 1px solid var(--af-border);
    background: var(--af-field);
}
.lg-codes li {
    color: #fff;
    font: 600 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .05em;
    text-align: center;
}
.lg-codes-actions { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.lg-ack { margin-bottom: 20px; }

.lg-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(245, 177, 42, 0.25);
    border-top-color: var(--af-gold);
    border-radius: 50%;
    animation: splashSpin .7s linear infinite;
}

@media (max-width: 520px) {
    .lg-qr { flex-direction: column; text-align: center; }
    .lg-secret .af-btn { margin: 0 auto; }
}

@view-transition { navigation: none; }
