/* ======================================================================
   GOONS - pages d'authentification (/login, /register)
   Extrait de login.php pour que les deux pages partagent un seul design
   system. Charger APRES shared/css/play.css : la cascade en depend.
   Les regles propres a une page (jauge de mot de passe, case a cocher...)
   restent dans le <style> de cette page.
   ====================================================================== */

    /* ======================================================================
       /login - design system /play (shared/css/play.css) + backdrop genere.
       Le fond est une image sombre au centre : la colonne de gauche et la
       carte de droite reposent donc sur de la couleur plate, jamais sur le
       motif. Voir assets/img/auth/README.md.
       ====================================================================== */

    /* Padding haut et bas symetriques : ces pages n'ont pas de header fixe a
       degager (voir login.php / register.php), la carte est simplement centree. */
    .auth-shell {
        position: relative;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 72px 24px 72px;
        isolation: isolate;
    }

    /* Backdrop : image fixe + scrim pour garantir le contraste du texte. */
    .auth-shell::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -2;
        background-color: var(--play-bg);
        /* Chaque page fournit son visuel via --auth-backdrop (voir son <style>). */
        background-image: var(--auth-backdrop);
        background-position: center;
        background-size: cover;
        background-repeat: no-repeat;
    }

    /* Variante legere (46 Ko au lieu de 131) sur petit ecran. */
    @media (max-width: 900px) {
        .auth-shell::before {
            background-image: var(--auth-backdrop-sm, var(--auth-backdrop));
        }
    }

    .auth-shell::after {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -1;
        background:
            radial-gradient(70% 60% at 50% 45%, rgba(5, 5, 10, 0.86), rgba(5, 5, 10, 0.62) 55%, rgba(5, 5, 10, 0.9) 100%),
            linear-gradient(180deg, rgba(5, 5, 10, 0.92) 0%, rgba(5, 5, 10, 0.55) 30%, rgba(5, 5, 10, 0.95) 100%);
    }

    .auth-grid {
        width: 100%;
        max-width: 1140px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
        gap: 56px;
        align-items: center;
    }

    /* ---------- Colonne marque ---------- */
    .auth-brand {
        min-width: 0;
    }

    .auth-logo {
        display: inline-flex;
        align-items: center;
        gap: 18px;
        margin-bottom: 28px;
        text-decoration: none;
    }

    .auth-logo svg {
        width: 68px;
        height: 68px;
        display: block;
        filter: drop-shadow(0 0 22px rgba(0, 229, 255, 0.35));
    }

    /* Le signal qui court dans la vague : meme langage que le splash loader. */
    .auth-logo .scan {
        stroke-dasharray: 22 100;
        animation: authScan 3.2s linear infinite;
    }

    @keyframes authScan {
        from { stroke-dashoffset: 124; }
        to   { stroke-dashoffset: 0; }
    }

    .auth-lockup {
        display: flex;
        flex-direction: column;
        gap: 4px;
        line-height: 1;
    }

    .auth-wordmark {
        font-size: 42px;
        font-weight: 900;
        letter-spacing: 6px;
        background: linear-gradient(102deg, var(--play-magenta), var(--play-cyan) 55%, var(--play-lime));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .auth-wordmark-sub {
        font-family: var(--play-mono);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 8px;
        color: var(--play-faint);
    }

    .auth-brand h1 {
        margin: 0 0 16px;
        font-size: clamp(30px, 4vw, 46px);
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -0.02em;
    }

    .auth-brand h1 em {
        font-style: normal;
        background: linear-gradient(102deg, var(--play-magenta), var(--play-cyan));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .auth-brand > p {
        margin: 0 0 32px;
        max-width: 46ch;
        font-size: 16px;
        line-height: 1.65;
        color: var(--play-muted);
    }

    .auth-points {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        gap: 13px;
        max-width: 46ch;
    }

    .auth-points li {
        display: flex;
        align-items: flex-start;
        gap: 13px;
        font-size: 14.5px;
        color: var(--play-text);
    }

    .auth-points svg {
        flex: none;
        width: 20px;
        height: 20px;
        margin-top: 1px;
    }

    /* ---------- Carte formulaire ---------- */
    .auth-card {
        min-width: 0;
        padding: 38px;
        border-radius: var(--play-radius);
        border: 1px solid var(--play-border-strong);
        background: rgba(9, 9, 18, 0.82);
        backdrop-filter: blur(22px) saturate(140%);
        -webkit-backdrop-filter: blur(22px) saturate(140%);
        box-shadow: var(--play-shadow);
    }

    .auth-card h2 {
        margin: 0 0 6px;
        font-size: 26px;
        font-weight: 800;
        letter-spacing: -0.01em;
    }

    .auth-card > p.auth-sub {
        margin: 0 0 26px;
        font-size: 14px;
        color: var(--play-muted);
    }

    .auth-alert {
        display: flex;
        align-items: flex-start;
        gap: 11px;
        margin-bottom: 22px;
        padding: 13px 16px;
        border-radius: var(--play-radius-sm);
        border: 1px solid rgba(255, 90, 120, 0.42);
        background: rgba(255, 60, 100, 0.12);
        color: #ffb3c4;
        font-size: 14px;
        line-height: 1.5;
    }

    .auth-field {
        margin-bottom: 18px;
    }

    .auth-field label {
        display: block;
        margin-bottom: 8px;
        font-family: var(--play-mono);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--play-faint);
    }

    .auth-field input {
        width: 100%;
        padding: 14px 16px;
        border-radius: var(--play-radius-sm);
        border: 1px solid var(--play-border);
        background: rgba(255, 255, 255, 0.04);
        color: var(--play-text);
        font-family: var(--play-font);
        font-size: 15px;
        transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    }

    .auth-field input::placeholder {
        color: rgba(232, 236, 255, 0.32);
    }

    .auth-field input:focus {
        outline: none;
        border-color: var(--play-cyan);
        background: rgba(255, 255, 255, 0.06);
        box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.16);
    }

    .auth-submit {
        width: 100%;
        margin-top: 6px;
        padding: 15px 28px;
        font-size: 15px;
    }

    .auth-submit[disabled] {
        opacity: 0.65;
        cursor: progress;
        transform: none;
    }

    /* Separateur */
    .auth-sep {
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 24px 0;
        font-family: var(--play-mono);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: var(--play-faint);
    }

    .auth-sep::before,
    .auth-sep::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--play-border);
    }

    /* Google : le seul SSO reellement branche, donc pleine largeur. */
    .auth-sso-primary {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }

    .auth-sso-primary i {
        font-size: 17px;
    }

    .auth-links {
        margin-top: 24px;
        text-align: center;
        font-size: 14px;
        color: var(--play-muted);
    }

    .auth-links a {
        color: var(--play-cyan);
        text-decoration: none;
    }

    .auth-links a:hover {
        text-decoration: underline;
    }

    .auth-legal {
        margin-top: 18px;
        padding-top: 18px;
        border-top: 1px solid var(--play-border);
        text-align: center;
        font-size: 11.5px;
        line-height: 1.7;
        color: var(--play-faint);
    }

    .auth-legal a {
        color: var(--play-muted);
        text-decoration: none;
    }

    .auth-legal a:hover {
        color: var(--play-cyan);
        text-decoration: underline;
    }

    /* ---------- Responsive ---------- */
    @media (max-width: 980px) {
        .auth-grid {
            grid-template-columns: minmax(0, 1fr);
            gap: 40px;
            max-width: 520px;
        }

        .auth-shell {
            padding: 60px 20px 60px;
        }

        .auth-brand {
            text-align: center;
        }

        .auth-logo {
            margin-bottom: 22px;
        }

        .auth-brand > p,
        .auth-points {
            margin-left: auto;
            margin-right: auto;
        }

        .auth-points {
            text-align: left;
        }
    }

    @media (max-width: 560px) {
        .auth-shell {
            padding: 48px 14px 48px;
        }

        .auth-card {
            padding: 26px 20px;
        }

        .auth-logo svg {
            width: 54px;
            height: 54px;
        }

        .auth-wordmark {
            font-size: 32px;
            letter-spacing: 4px;
        }

        .auth-wordmark-sub {
            font-size: 12px;
            letter-spacing: 6px;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .auth-logo .scan { animation: none; }
    }
