/* ═══════════════════════════════════════════════════════════════════════════
   Pages d'authentification — Hopwise
   ═══════════════════════════════════════════════════════════════════════════
   Feuille commune aux parcours client et admin, d'apres les maquettes Figma.
   Deux themes, une seule structure :

     .auth--client   carte centree, bleu Hopwise   #e5322d
     .auth--admin    pleine page, sans carte, bleu profond #2c2e34

   Regrouper ici evite de recopier ces regles dans les six <head> concernes,
   et garantit que les six pages evoluent ensemble.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --auth-client-accent:  #e5322d;
  --auth-admin-accent:   #2c2e34;
  --auth-surface:        #F2F2F0;   /* fond du panneau formulaire */
  --auth-border:         #D6D7DA;   /* contour des champs (client) */
  --auth-muted:          #6B7079;   /* libelles et textes secondaires */
  --auth-faint:          #BFBFBF;   /* texte tres discret */
  --auth-overlay:        #111214;   /* voile bleu sur la photo */
  --auth-radius:         10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.auth {
  min-height: 100vh;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111214;
  -webkit-font-smoothing: antialiased;
}

/* ── Structure commune ──────────────────────────────────────────────────── */
.auth-split {
  display: grid;
  overflow: hidden;
}

.auth-form-side {
  background: var(--auth-surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 2rem;
}

.auth-form-inner { width: 100%; max-width: 408px; }

/* ── Panneau visuel ─────────────────────────────────────────────────────── */
.auth-visual { position: relative; overflow: hidden; min-height: 320px; }

/* Cible uniquement la photo de fond : l'enfant direct suffit a exclure le logo
   pose par-dessus, qui est un petit-enfant. Sans cette restriction, il etait
   lui aussi etire sur tout le panneau. */
.auth-visual > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Voile anthracite : plus dense en haut a gauche (logo), plus leger a droite
   pour laisser voir les baies et leurs voyants derriere le slogan. */
.auth-visual::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(17,18,20,.88) 0%, rgba(17,18,20,.55) 100%);
}

.auth-visual-content {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column;
  padding: 2.5rem;
}

.auth-visual-logo { align-self: flex-start; width: 176px; max-width: 60%; }

.auth-claim {
  margin-top: auto; margin-bottom: auto;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 1.5rem;
}

.auth-claim-text {
  text-align: right;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.12;
  letter-spacing: .01em;
  font-size: clamp(1.6rem, 3.4vw, 3.1rem);
}

.auth-claim-text .keep-case { text-transform: none; }

.auth-claim-bar {
  width: 5px; align-self: stretch;
  background: #E5322D; border-radius: 3px;
  flex-shrink: 0;
}

/* ── Titre ──────────────────────────────────────────────────────────────── */
.auth-logo { display: block; margin: 0 auto 1.1rem; }

.auth-title {
  text-align: center;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 2.2rem;
}

/* ── Champs ─────────────────────────────────────────────────────────────── */
.auth-field { margin-bottom: 1rem; }

.auth-input {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  color: #1e293b;
  background: transparent;
  transition: border-color .15s, box-shadow .15s;
}

.auth-input::placeholder { color: var(--auth-muted); }
.auth-input:focus { outline: none; }

/* ── Bouton ─────────────────────────────────────────────────────────────── */
.auth-btn {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: .85rem 1rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}

.auth-btn:hover  { filter: brightness(1.06); }
.auth-btn:active { transform: translateY(1px); }

/* ── Messages ───────────────────────────────────────────────────────────── */
.auth-alert {
  display: flex; align-items: flex-start; gap: .6rem;
  border-radius: 6px;
  padding: .7rem .9rem;
  margin-bottom: 1.1rem;
  font-size: .84rem;
  line-height: 1.4;
}

.auth-alert--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.auth-alert--success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.auth-alert--info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.auth-links {
  margin-top: 1.1rem;
  text-align: center;
  font-size: .82rem;
  color: var(--auth-faint);
  font-weight: 600;
}

.auth-links a { font-weight: 700; text-decoration: underline; }
.auth-links .sep { display: block; margin-top: .5rem; }

/* Libelle reserve aux lecteurs d'ecran : la maquette n'affiche que le
   placeholder, mais un champ sans libelle n'est pas annonce correctement. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.auth-captcha { display: flex; justify-content: center; margin-bottom: .9rem; }

/* ═══ Theme client ═════════════════════════════════════════════════════════ */
.auth--client { background: #111214; display: flex; align-items: center; justify-content: center; padding: 2rem; }

.auth--client .auth-split {
  width: 100%; max-width: 1140px;
  grid-template-columns: 47% 53%;
  min-height: min(810px, 80vh);
  border-radius: var(--auth-radius);
  box-shadow: 0 24px 60px rgba(17, 18, 20, .18);
}

.auth--client .auth-title { color: var(--auth-client-accent); font-size: 1.45rem; }
.auth--client .auth-logo  { width: 176px; margin-bottom: 1.8rem; }

.auth--client .auth-input {
  border: 1.5px solid var(--auth-border);
  border-radius: 6px;
  padding: .75rem 1rem;
  background: #fff;
}

.auth--client .auth-input:focus {
  border-color: var(--auth-client-accent);
  box-shadow: 0 0 0 3px rgba(229, 50, 45, .22);
}

.auth--client .auth-btn   { background: var(--auth-client-accent); margin-top: .3rem; }
.auth--client .auth-links a { color: var(--auth-client-accent); }

/* ═══ Theme admin ══════════════════════════════════════════════════════════ */
.auth--admin .auth-split {
  min-height: 100vh;
  grid-template-columns: 58% 42%;
}

.auth--admin .auth-form-side {
  background: var(--auth-surface);
}

.auth--admin .auth-form-inner { max-width: 424px; }
.auth--admin .auth-logo  { width: 220px; margin-bottom: 2rem; }
.auth--admin .auth-title { color: var(--auth-admin-accent); font-size: 1.75rem; letter-spacing: .05em; }

/* Champs souligne : pas de boite, un simple trait sous le libelle. */
.auth--admin .auth-field { margin-bottom: 1.6rem; }

.auth--admin .auth-input {
  border: none;
  border-bottom: 2px solid var(--auth-admin-accent);
  border-radius: 0;
  padding: .35rem 0 .45rem;
  font-weight: 600;
}

.auth--admin .auth-input::placeholder { color: var(--auth-muted); font-weight: 700; }
.auth--admin .auth-input:focus { box-shadow: 0 2px 0 -1px var(--auth-admin-accent); }

.auth--admin .auth-btn   { background: var(--auth-admin-accent); margin-top: 1.2rem; }
.auth--admin .auth-links a { color: var(--auth-admin-accent); }

/* ── Ecrans 2FA ──────────────────────────────────────────────────────────── */
.auth-sub {
  text-align: center;
  color: var(--auth-muted);
  font-size: .86rem;
  line-height: 1.5;
  margin: -1.4rem 0 1.8rem;
}

.auth-code-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: .38em;
  /* Le decalage compense la chasse ajoutee a droite du dernier caractere,
     que l'interlettrage rend visible sur un champ centre. */
  text-indent: .38em;
  text-align: center;
  background: transparent;
  color: #111214;
  transition: border-color .15s, box-shadow .15s;
}

.auth-code-input:focus { outline: none; }
.auth-code-input::placeholder { color: #D6D7DA; letter-spacing: .38em; }

.auth-hint {
  text-align: center;
  font-size: .76rem;
  color: var(--auth-faint);
  margin: .7rem 0 1.2rem;
}

.auth-note {
  border-radius: 12px;
  padding: .75rem .9rem;
  font-size: .78rem;
  line-height: 1.5;
  color: #475569;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(0,0,0,.06);
  margin-top: 1.2rem;
}

.auth-back {
  display: block;
  text-align: center;
  margin-top: 1.2rem;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-back:hover { text-decoration: underline; }

.auth--client .auth-code-input {
  border: 1.5px solid var(--auth-border);
  border-radius: 6px;
  background: #fff;
  padding: .8rem 1rem;
}
.auth--client .auth-code-input:focus {
  border-color: var(--auth-client-accent);
  box-shadow: 0 0 0 3px rgba(229, 50, 45, .22);
}
.auth--client .auth-back { color: var(--auth-client-accent); }

.auth--admin .auth-code-input {
  border: none;
  border-bottom: 2px solid var(--auth-admin-accent);
  border-radius: 0;
  padding: .4rem 0 .5rem;
}
.auth--admin .auth-back { color: var(--auth-admin-accent); }

/* ── Responsive ─────────────────────────────────────────────────────────────
   Sous 900 px le panneau visuel passerait sous le formulaire et repousserait
   la connexion hors de l'ecran : on le retire et on garde le formulaire seul. */
@media (max-width: 900px) {
  .auth--client { padding: 0; }
  .auth--client .auth-split,
  .auth--admin  .auth-split {
    grid-template-columns: 1fr;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
  .auth-visual { display: none; }
  .auth-form-side { min-height: 100vh; padding: 2.5rem 1.5rem; }
}
