/* =====================================================================
   Pages d'entrée — School Manager
   ---------------------------------------------------------------------
   Écran en deux volets : à gauche la marque, à droite le formulaire.
   Ce sont les premières pages que voit un visiteur, avant toute
   authentification.

   CSS autonome et non des classes Tailwind : la feuille Tailwind est
   compilée par Vite, et une classe absente du build déjà déployé ne
   produirait rien du tout. Ici, tout ce qui est écrit s'applique.
   ===================================================================== */

:root {
    --auth-nuit: #081842;
    --auth-bleu: #15357f;
    --auth-royal: #1d4ed8;
    --auth-ciel: #38bdf8;
    --auth-ink: #0f172a;
    --auth-ink-soft: #55637c;
    --auth-line: #e3e8ef;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.auth {
    margin: 0;
    font-family: Figtree, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--auth-ink);
    background: #f7f9fc;
    -webkit-font-smoothing: antialiased;
}

.auth-ecran {
    display: flex;
    min-height: 100vh;
}

/* --------------------------------------------------------------------
   Volet de marque
   -------------------------------------------------------------------- */
.auth-marque {
    position: relative;
    flex: 1 1 52%;
    padding: 3.5rem 3.5rem 2.5rem;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(160deg, var(--auth-nuit) 0%, var(--auth-bleu) 52%, var(--auth-royal) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Halos et quadrillage : de la profondeur sans image à télécharger */
.auth-marque::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(520px 380px at 82% 12%, rgba(56, 189, 248, .28), transparent 65%),
        radial-gradient(460px 340px at 8% 92%, rgba(16, 185, 129, .20), transparent 65%);
    pointer-events: none;
}

.auth-marque::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(70% 70% at 40% 35%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(70% 70% at 40% 35%, #000 20%, transparent 78%);
    pointer-events: none;
}

.auth-marque > * { position: relative; z-index: 1; }

.auth-logo {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.auth-logo-pastille {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, .14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 12px 30px -14px rgba(2, 6, 23, .9);
}

.auth-logo-nom {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.auth-logo-nom span { color: var(--auth-ciel); }

.auth-accroche {
    max-width: 30ch;
    margin: 2.5rem 0 0;
    font-size: 2.45rem;
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -.03em;
}

.auth-sous-accroche {
    max-width: 44ch;
    margin: 1rem 0 0;
    font-size: 1.02rem;
    line-height: 1.55;
    color: rgba(226, 240, 255, .82);
}

.auth-atouts {
    list-style: none;
    margin: 2.25rem 0 0;
    padding: 0;
    display: grid;
    gap: .7rem;
}

.auth-atouts li {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .95rem;
    color: rgba(235, 244, 255, .92);
}

.auth-atouts i {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 999px;
    font-size: .7rem;
    background: rgba(56, 189, 248, .22);
    color: #bae6fd;
}

.auth-signature {
    margin-top: 2.5rem;
    font-size: .8rem;
    color: rgba(203, 225, 255, .62);
}

/* --------------------------------------------------------------------
   Volet du formulaire
   -------------------------------------------------------------------- */
.auth-panneau {
    flex: 1 1 48%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem 1.5rem;
    background: #fff;
    background-image: radial-gradient(900px 500px at 110% -10%, rgba(37, 99, 235, .06), transparent 60%);
}

.auth-boite {
    width: 100%;
    max-width: 25rem;
    animation: authMontee 420ms cubic-bezier(.2, .8, .2, 1) both;
}

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

.auth-etape {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--auth-royal);
    background: rgba(37, 99, 235, .09);
}

.auth-titre {
    margin: 1rem 0 .4rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -.025em;
    color: var(--auth-ink);
}

.auth-aide {
    margin: 0 0 1.75rem;
    font-size: .95rem;
    line-height: 1.55;
    color: var(--auth-ink-soft);
}

.auth-champ { display: block; margin-bottom: 1.1rem; }

.auth-etiquette {
    display: block;
    margin-bottom: .45rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--auth-ink-soft);
}

.auth-saisie {
    width: 100%;
    padding: .95rem 1rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-align: center;
    text-transform: uppercase;
    color: var(--auth-ink);
    background: #f8fafc;
    border: 1.5px solid var(--auth-line);
    border-radius: 14px;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
    font-variant-numeric: tabular-nums;
}

.auth-saisie::placeholder {
    color: #9aa7bd;
    font-weight: 600;
    letter-spacing: .1em;
}

.auth-saisie:focus {
    outline: none;
    background: #fff;
    border-color: var(--auth-royal);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}

/* Champs de texte ordinaires (identifiant, mot de passe) : alignés à gauche,
   avec une icône à l'intérieur. Le code établissement, lui, reste centré et
   espacé — c'est une référence qu'on relit caractère par caractère. */
.auth-groupe { position: relative; }

.auth-groupe > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .95rem;
    color: #9aa7bd;
    pointer-events: none;
    transition: color 180ms ease;
}

.auth-saisie-texte {
    width: 100%;
    padding: .9rem 1rem .9rem 2.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--auth-ink);
    background: #f8fafc;
    border: 1.5px solid var(--auth-line);
    border-radius: 14px;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.auth-saisie-texte::placeholder { color: #9aa7bd; font-weight: 400; }

.auth-saisie-texte:focus {
    outline: none;
    background: #fff;
    border-color: var(--auth-royal);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}

.auth-groupe:focus-within > i { color: var(--auth-royal); }

/* Champ en erreur : la bordure rouge doit survivre au focus */
.auth-saisie-texte.en-erreur,
.auth-saisie.en-erreur { border-color: #ef4444; }

.auth-saisie-texte.en-erreur:focus,
.auth-saisie.en-erreur:focus { box-shadow: 0 0 0 4px rgba(239, 68, 68, .14); }

/* Œil de révélation du mot de passe */
.auth-oeil {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #8a97ad;
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease;
}

.auth-oeil:hover { color: var(--auth-royal); background: rgba(37, 99, 235, .08); }

/* Ligne « Se souvenir de moi » */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: .25rem 0 1.25rem;
}

.auth-memoire {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    color: var(--auth-ink-soft);
    cursor: pointer;
    user-select: none;
}

.auth-memoire input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--auth-royal);
    cursor: pointer;
}

/* --------------------------------------------------------------------
   Codes déjà utilisés, proposés au clic dans le champ
   -------------------------------------------------------------------- */
.auth-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    padding: .35rem;
    background: #fff;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    box-shadow: 0 16px 34px -14px rgba(15, 23, 42, .35);
    animation: authApparition 140ms ease both;
}

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

.auth-suggestions-titre {
    padding: .3rem .55rem .35rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--auth-ink-faint, #8a97ad);
}

.auth-suggestion {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    padding: .55rem;
    border: 0;
    border-radius: 9px;
    background: none;
    font-family: inherit;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--auth-ink);
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.auth-suggestion i { color: #9aa7bd; font-size: .85rem; }

.auth-suggestion:hover,
.auth-suggestion.survol {
    background: rgba(37, 99, 235, .09);
    color: var(--auth-royal);
}

.auth-suggestion:hover i,
.auth-suggestion.survol i { color: var(--auth-royal); }

.auth-bouton {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .95rem 1rem;
    font-size: 1.02rem;
    font-weight: 700;
    color: #fff;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--auth-royal) 0%, #2563eb 55%, #3b82f6 100%);
    box-shadow: 0 12px 26px -12px rgba(29, 78, 216, .75);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.auth-bouton:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px -14px rgba(29, 78, 216, .85);
    filter: saturate(1.08);
}

.auth-bouton:active { transform: translateY(0); }

.auth-bouton i { transition: transform 180ms ease; }
.auth-bouton:hover i { transform: translateX(4px); }

.auth-bouton:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .45);
    outline-offset: 3px;
}

.auth-note {
    margin: 1.4rem 0 0;
    font-size: .82rem;
    line-height: 1.5;
    color: #8a97ad;
    text-align: center;
}

/* --------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------- */
.auth-message {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: 1.1rem;
    padding: .8rem .95rem;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.45;
    border: 1px solid;
}

.auth-message i { margin-top: .12rem; }

.auth-message ul { margin: 0; padding-left: 1.1rem; }

.auth-message.succes {
    color: #065f46;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.auth-message.erreur {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

/* --------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------- */
.auth-pied {
    margin-top: auto;
    padding-top: 2rem;
    font-size: .78rem;
    color: #94a3b8;
    text-align: center;
}

/* --------------------------------------------------------------------
   Écrans étroits : le volet de marque devient un bandeau
   -------------------------------------------------------------------- */
@media (max-width: 900px) {
    .auth-ecran { flex-direction: column; }

    .auth-marque {
        flex: 0 0 auto;
        padding: 1.75rem 1.5rem;
    }

    .auth-accroche { font-size: 1.6rem; margin-top: 1.25rem; }
    .auth-sous-accroche { font-size: .95rem; }
    .auth-atouts, .auth-signature { display: none; }

    .auth-panneau { padding: 2rem 1.25rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-boite { animation: none; }
    .auth-bouton, .auth-bouton i, .auth-saisie { transition: none; }
}
