/* Page d'authentification Facilite (facilite02.pages.dev).
 *
 * Reproduction fidèle de la page « Connexion » de la boutique Facilite
 * (lib/src/ui/pages/connexion_page.dart), avec la palette et les composants de
 * lib/src/ui/theme/boutique_theme.dart :
 *   fond #F6F7F9, carte blanche #FFFFFF bordée #E4E7EC (rayon 16),
 *   titre 22/600, sous-titre 13,5 #667085, champ centré (rayon 10),
 *   bouton principal noir #111114 (hauteur 50, rayon 10),
 *   « Créer un compte » en lien bleu #1D4ED8, ici DÉSACTIVÉ (gris).
 */

:root {
  --fond: #f6f7f9;
  --surface: #ffffff;
  --bordure: #e4e7ec;
  --texte: #101828;
  --texte-secondaire: #667085;
  --primaire: #111114;
  --lien: #1d4ed8;
  --danger: #b42318;
  --danger-fond: #fef3f2;
  --desactive: #98a2b3;
  --desactive-fond: #f2f4f7;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Mise en page : contenu centré, largeur maximale 430 px ─────────────── */

.page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
}

.contenu {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ── En-tête de marque ──────────────────────────────────────────────────── */

.marque {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 16.8px;
  font-size: 28.2px;
  line-height: 1;
  /* Les émojis couleur Windows/Linux restent lisibles sur le fond blanc. */
  font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif;
  user-select: none;
}

.nom {
  margin-top: 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--texte);
}

/* ── Carte ──────────────────────────────────────────────────────────────── */

.carte {
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 16px;
  padding: 26px 26px 22px;
}

.titre {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.25;
  text-align: center;
  color: var(--texte);
}

.sous-titre {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.35;
  text-align: center;
  color: var(--texte-secondaire);
}

/* ── Champ de saisie ────────────────────────────────────────────────────── */

#formulaire {
  margin-top: 20px;
}

.champ {
  display: block;
  width: 100%;
  height: 47px;
  padding: 16px 14px;
  border: 1px solid var(--bordure);
  border-radius: 10px;
  background: transparent;
  color: var(--texte);
  font: inherit;
  font-size: 15px;
  line-height: 15px;
  text-align: center;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.champ::placeholder {
  color: var(--texte-secondaire);
  opacity: 1;
}

.champ:hover:not(:disabled) {
  border-color: #cfd4dc;
}

.champ:focus:not(:disabled) {
  border-color: var(--texte);
  box-shadow: inset 0 0 0 0.4px var(--texte);
}

.champ:disabled {
  background: var(--desactive-fond);
  color: var(--texte-secondaire);
  cursor: not-allowed;
}

/* ── Bandeau d'erreur (BandeauInfo danger, centré) ──────────────────────── */

.bandeau {
  margin-top: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--danger-fond);
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: 10px;
  color: var(--danger);
}

.bandeau[hidden] {
  display: none;
}

.bandeau-icone {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.bandeau-texte {
  font-size: 13.5px;
  line-height: 1.35;
  text-align: center;
}

/* ── Bouton principal (BoutonPrincipal) ─────────────────────────────────── */

.bouton-principal {
  margin-top: 18px;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--primaire);
  color: #ffffff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: background-color 120ms ease, opacity 120ms ease;
}

.bouton-principal:hover:not(:disabled) {
  background: #26262b;
}

.bouton-principal:focus-visible {
  box-shadow: 0 0 0 3px rgba(17, 17, 20, 0.22);
}

.bouton-principal:disabled {
  cursor: progress;
  opacity: 0.82;
}

/* Roue de progression : 20 × 20, blanche, 2 px (BoutonPrincipal.chargement). */
.roue {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: tourner 720ms linear infinite;
}

.roue[hidden] {
  display: none;
}

@keyframes tourner {
  to {
    transform: rotate(360deg);
  }
}

/* ── « Créer un compte » : VISIBLE mais GRISÉ (inactivable) ─────────────── */

.lien-compte {
  margin-top: 4px;
  display: flex;
  justify-content: center;
}

.bouton-texte {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--lien);
  cursor: pointer;
}

.bouton-texte:disabled,
.bouton-texte[aria-disabled="true"] {
  color: var(--desactive);
  cursor: not-allowed;
  background: transparent;
}

.bouton-texte:disabled:hover {
  background: transparent;
}

/* ── Note de bas de page (diagnostic / aide) ────────────────────────────── */

.note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  color: var(--texte-secondaire);
}

.note a {
  color: var(--lien);
}

.note[hidden] {
  display: none;
}

/* ── État « Connexion réussie » (page ouverte seule, sans application) ──── */

.succes {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.succes-icone {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ecfdf3;
  color: #067647;
  font-size: 28px;
  font-weight: 700;
}

.succes-titre {
  margin: 16px 0 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--texte);
}

.succes-texte {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--texte-secondaire);
}

.succes-adresse {
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--texte);
  word-break: break-all;
}

/* ── Accessibilité ──────────────────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 380px) {
  .page {
    padding: 20px 14px;
  }

  .carte {
    padding: 22px 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .roue {
    animation-duration: 1.6s;
  }
}
