/* ============================================================
   auth.css — Connexion / Création de compte
   Visuel plein cadre, carte centrée, champs à icône.
   ============================================================ */

.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 40px 20px;
  position: relative; overflow-x: hidden;
}

/* Fond : le visuel du hero, assombri juste ce qu'il faut pour la carte. */
.auth-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(9,11,16,.35) 0%, rgba(9,11,16,.15) 35%, rgba(9,11,16,.55) 100%),
    image-set(url('../images/hero.webp') type('image/webp'),
              url('../images/hero.jpg')  type('image/jpeg'));
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.auth-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column; align-items: center; gap: 26px;
}

/* ---- Marque + langue ---- */
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  width: 100%;
}
.auth-brand .brand { text-shadow: 0 2px 20px rgba(0,0,0,.8); }

/* ---- Carte ---- */
.auth-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 36px;
  box-shadow: var(--shadow);
}
@supports (backdrop-filter: blur(1px)) {
  .auth-card {
    background: rgba(17, 22, 31, .88);
    backdrop-filter: blur(16px);
  }
}
@media (prefers-reduced-transparency: reduce) {
  .auth-card { background: var(--card); backdrop-filter: none; }
}

.auth-card-header { margin-bottom: 28px; }
.auth-card-header h1 { font-size: 2rem; margin-bottom: 6px; }
.auth-card-header p { color: var(--muted); font-size: .95rem; }

.auth-form { display: flex; flex-direction: column; gap: 18px; }

/* Empilés par défaut, avec le même espacement que le reste du formulaire.
   Ils passent côte à côte sur les écrans bas (voir la section responsive). */
.password-row { display: grid; gap: inherit; }

/* ---- Libellé + lien sur la même ligne ---- */
.label-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.label-link {
  font-size: .82rem; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.label-link:hover { color: var(--accent); }

/* ---- Champs à icône ---- */
.input-wrap { position: relative; display: block; }
.input-wrap > .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 1.15rem; color: var(--faint);
  pointer-events: none; transition: color .25s var(--ease);
}
.input-wrap input { padding-left: 44px; }
.input-wrap:focus-within > .input-icon { color: var(--accent); }
.input-wrap:has(.toggle-password) input { padding-right: 48px; }

.toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: var(--faint);
  border-radius: var(--r-btn);
  transition: color .25s var(--ease);
}
.toggle-password:hover { color: var(--accent); }

/* ---- Jauge de mot de passe (4 segments) ---- */
.password-strength {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
}
.strength-meter { display: flex; gap: 6px; flex: 1; }
.strength-seg {
  flex: 1; height: 4px; border-radius: var(--r-badge);
  background: var(--border);
  transition: background-color .25s var(--ease);
}
.password-strength[data-score="1"] .strength-seg:nth-child(-n+1),
.password-strength[data-score="2"] .strength-seg:nth-child(-n+2) { background: var(--danger); }
.password-strength[data-score="3"] .strength-seg:nth-child(-n+3) { background: var(--accent); }
.password-strength[data-score="4"] .strength-seg { background: var(--success); }

#strengthLabel { font-size: .75rem; color: var(--faint); min-width: 52px; text-align: right; }

/* ---- Consentement ---- */
.form-consent {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .85rem; color: var(--muted); line-height: 1.5;
}
.form-consent input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg-surface);
  cursor: pointer; position: relative;
  transition: all .2s var(--ease);
}
.form-consent input[type="checkbox"]:hover { border-color: var(--accent); }
.form-consent input[type="checkbox"]:checked {
  background: var(--accent); border-color: var(--accent);
}
.form-consent input[type="checkbox"]:checked::after {
  content: ''; position: absolute;
  left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #170C02; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form-consent a { color: var(--accent); font-weight: 600; }
.form-consent a:hover { color: var(--accent-hover); }

/* ---- Bouton ---- */
.btn-auth {
  width: 100%; padding: 15px;
  background: var(--accent);
  color: #170C02; border: none; border-radius: var(--r-btn);
  font-size: 1rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .25s var(--ease);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-auth:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.02);
  box-shadow: 0 10px 30px var(--glow);
}
.btn-auth:active:not(:disabled) { transform: scale(.99); }
.btn-auth:disabled { opacity: .6; cursor: not-allowed; }
.btn-loader { font-size: 1rem; }

/* ---- Bas de carte ---- */
.auth-footer-links {
  margin-top: 22px; text-align: center;
  color: var(--muted); font-size: .9rem;
}
.auth-footer-links a {
  display: inline-block; padding: 8px 6px;
  color: var(--accent); font-weight: 600;
}
.auth-footer-links a:hover { color: var(--accent-hover); }

/* ===== RESPONSIVE ===== */
@media (max-width: 560px) {
  .auth-body { padding: 24px 14px; }
  .auth-container { gap: 18px; }
  .auth-card { padding: 24px 18px; }
  .auth-card-header { margin-bottom: 20px; }
  .auth-card-header h1 { font-size: 1.7rem; }
  .auth-form { gap: 15px; }
  /* Deux champs côte à côte deviennent illisibles sous 560px. */
  .auth-form .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .auth-body { padding: 12px; }
  .auth-card { padding: 20px 14px; }
  .auth-brand { flex-wrap: wrap; gap: 10px; }
  .form-consent { font-size: .8rem; }
  #strengthLabel { display: none; }
}

/* ===== TENIR SANS DÉFILEMENT =====
   Le formulaire doit rentrer dans l'écran. Ces paliers dépendent de la
   HAUTEUR disponible, pas de la largeur : c'est elle qui manque. */

@media (max-height: 940px) {
  .auth-body { padding: 20px 16px; }
  .auth-container { gap: 16px; }
  .auth-card { padding: 26px 28px; }
  .auth-card-header { margin-bottom: 18px; }
  .auth-card-header h1 { font-size: 1.75rem; }
  .auth-form { gap: 13px; }
  .form-group { gap: 5px; }
  .auth-form input { padding-top: 11px; padding-bottom: 11px; }
  .password-strength { margin-top: 6px; }
  .btn-auth { padding: 14px; }
  .auth-footer-links { margin-top: 12px; }
}

@media (max-height: 820px) {
  .auth-body { padding: 14px; }
  .auth-container { gap: 12px; }
  .auth-card { padding: 18px 20px; }
  .auth-card-header { margin-bottom: 14px; }
  .auth-card-header h1 { font-size: 1.55rem; }
  .auth-card-header p { font-size: .88rem; }
  .auth-form { gap: 11px; }
  .auth-form label { font-size: .82rem; }
  .auth-form input { padding-top: 10px; padding-bottom: 10px; font-size: .9rem; }
  .form-consent { font-size: .8rem; }
  .btn-auth { padding: 12px; }
  .auth-footer-links { margin-top: 8px; font-size: .85rem; }
  .auth-footer-links a { padding: 6px 4px; }
}

/* Écran bas mais assez large : les deux mots de passe passent côte à côte,
   c'est le dernier bloc de hauteur récupérable. */
@media (max-height: 820px) and (min-width: 561px) {
  .auth-form .password-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

/* Petit mobile bas de gamme (360x740 et en dessous) : les mots de passe ne
   peuvent pas passer côte à côte, on récupère la hauteur sur les marges. */
@media (max-height: 820px) and (max-width: 400px) {
  .auth-body { padding: 10px 12px; }
  .auth-card { padding: 18px 14px; }
  .auth-container { gap: 10px; }
}
