/*
 * Overlay d'authentification — thème clair (Saisonly).
 *
 * L'overlay couvre la totalité du viewport avec un fond clair tant que
 * l'utilisateur n'est pas connecté. Il est volontairement chargé avant
 * styles.css dans index.html pour rester prioritaire si une autre règle
 * tente de le masquer pendant la rehydratation de l'app.
 *
 * Direction artistique : SaaS moderne "Revbell-like" en version claire.
 * Fond blanc cassé avec léger gradient pastel bleu/blanc cohérent avec
 * le bleu turquoise du logo Saisonly. Carte centrée avec ombre douce.
 */

/* Quand l'overlay est visible, on bloque le scroll body pour éviter qu'on
   "voit" l'app dessous avec la roulette. */
body.auth-locked {
  overflow: hidden;
}

#auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Fond clair façon SaaS moderne : blanc dominant + halos pastels très
     diffus dans les coins pour donner de la profondeur sans charger
     l'œil. La teinte bleue rappelle le cyan du logo Saisonly. */
  background: #f8fafc;
  color: #0f172a;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  animation: auth-overlay-fade-in 220ms ease-out;
}

#auth-overlay[hidden] {
  display: none !important;
}

@keyframes auth-overlay-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 20px;
  padding: 52px 40px 52px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.06),
    0 24px 60px rgba(15, 23, 42, 0.08);
}

.auth-card-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 24px 0;
}

.auth-card-logo {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
}

/* Bloc de bienvenue : titre + accroche sous le logo */
.auth-welcome {
  text-align: center;
  margin: 0 0 28px 0;
}

.auth-welcome-heading {
  font-size: 1.65rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
  line-height: 1.2;
  font-family: "Outfit", "Inter", system-ui, sans-serif;
}

.auth-welcome-tagline {
  font-size: 0.95rem;
  color: #64748b;
  margin: 0;
  line-height: 1.45;
}

.auth-card-subtitle {
  font-size: 0.88rem;
  color: #94a3b8;
  margin: 0 0 24px 0;
  line-height: 1.45;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* 4 cases PIN individuelles */
.auth-pin-boxes {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-pin-digit {
  appearance: none;
  width: 72px;
  height: 84px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 16px;
  padding: 0;
  font-size: 2.2rem;
  font-family: "Outfit", "Inter", monospace;
  font-weight: 700;
  text-align: center;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-pin-digit:focus {
  outline: none;
  border-color: #2563eb;
  border-width: 3px;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.auth-pin-boxes.auth-shake {
  animation: auth-shake 320ms ease;
}

.auth-error {
  margin: 14px 0 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  /* Sur fond clair, on inverse la palette : background pastel rouge,
     texte rouge soutenu pour rester lisible. */
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #b91c1c;
  font-size: 0.86rem;
  line-height: 1.4;
}

.auth-error[hidden] {
  display: none;
}

/* Bouton "Se déconnecter" intégré dans la sidebar profile dropdown : on
   réutilise les classes existantes et on ajoute juste un accent rouge. */
.topbar-profile-dropdown-item.auth-signout-item {
  color: #dc2626;
  font-weight: 600;
}

.topbar-profile-dropdown-item.auth-signout-item:hover {
  background: rgba(220, 38, 38, 0.08);
}

/* =====================================================================
   Responsive mobile (< 768px) — page de login
   =====================================================================
   Adapte la carte de login aux petits écrans : marges réduites, carte
   plein-largeur, padding optimisé, taille de typo ajustée.
   ===================================================================== */
@media (max-width: 768px) {
  #auth-overlay {
    padding: 16px;
    align-items: center;
    padding-top: max(32px, env(safe-area-inset-top, 0px));
  }

  .auth-card {
    max-width: 100%;
    padding: 36px 24px 36px;
    border-radius: 16px;
    box-shadow:
      0 1px 2px rgba(15, 23, 42, 0.04),
      0 6px 16px rgba(15, 23, 42, 0.05),
      0 16px 40px rgba(15, 23, 42, 0.06);
  }

  .auth-card-brand {
    margin: 0 0 18px 0;
  }

  .auth-card-logo {
    max-width: 160px;
  }

  .auth-welcome {
    margin: 0 0 22px 0;
  }

  .auth-welcome-heading {
    font-size: 1.45rem;
  }

  .auth-card-subtitle {
    font-size: 0.83rem;
    margin-bottom: 20px;
  }

  .auth-pin-boxes {
    gap: 10px;
  }

  .auth-pin-digit {
    width: 64px;
    height: 74px;
    /* font-size >= 16px sur mobile pour éviter le zoom auto iOS Safari */
    font-size: 1.9rem;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding: 28px 16px 28px;
  }

  .auth-card-logo {
    max-width: 140px;
  }

  .auth-welcome-heading {
    font-size: 1.3rem;
  }

  .auth-pin-digit {
    width: 58px;
    height: 68px;
  }
}
