/* ============================================================
   Connexion (v4, 2026-08-28)
   Jetons et primitives d'app.css ; la photo de l'établissement
   reste en fond (flou + voile marine), inchangée.
   ============================================================ */

.page-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--bg);
  color: var(--ink);
}

/* Photo (inset négatif : cache le liseré clair du flou) */
.page-login::after {
  content: '';
  position: fixed;
  inset: -14px;
  background: url('/assets/images/saint-elme-background.jpg') center/cover no-repeat;
  filter: blur(6px) brightness(0.78) saturate(1.05);
  z-index: -2;
}

/* Voile marine ; plus dense en sombre */
.page-login::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, rgba(22, 44, 90, 0.5) 0%, rgba(22, 44, 90, 0.72) 100%);
  z-index: -1;
}
html[data-theme="dark"] .page-login::before {
  background: linear-gradient(160deg, rgba(10, 9, 34, 0.68) 0%, rgba(10, 9, 34, 0.86) 100%);
}

/* Liseré marine + rouge en haut, signature Saint Elme */
.lg-wrap::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #162C5A 0%, #162C5A 72%, #CF0A0A 72%, #CF0A0A 100%);
  z-index: 2;
}

/* Bascule clair / sombre */
.lg-theme {
  position: fixed;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3;
  transition: background 160ms ease;
}
.lg-theme:hover, .lg-theme:focus-visible { background: rgba(255, 255, 255, 0.26); outline: none; }
.lg-theme .ui-i { width: 18px; height: 18px; }
.lg-theme__sun { display: none; }
html[data-theme="dark"] .lg-theme__sun { display: block; }
html[data-theme="dark"] .lg-theme__moon { display: none; }

/* ------------------------------------------------------------
   Carte
   ------------------------------------------------------------ */
.lg-wrap { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.page-login [hidden] { display: none !important; }

.lg-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  padding: 36px 32px 22px;
  box-shadow: 0 28px 80px -10px rgba(8, 16, 40, 0.55);
  animation: lgIn 380ms cubic-bezier(0.2, 0, 0, 1) both;
}
html[data-theme="dark"] .lg-card { border-color: var(--border); }

@keyframes lgIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.lg-head { text-align: center; margin-bottom: 26px; }
.lg-logo { height: 118px; width: auto; margin: -10px 0 4px; }
.lg-logo--dark, .lg-welcome__logo.lg-logo--dark { display: none; }
html[data-theme="dark"] .lg-logo--dark, html[data-theme="dark"] .lg-welcome__logo.lg-logo--dark { display: inline-block; }
html[data-theme="dark"] .lg-logo--light { display: none; }
.lg-title {
  font-family: var(--font-display);
  font-size: 23px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--ink); margin: 0 0 3px;
}
.lg-sub { font-size: 13.5px; color: var(--sub); margin: 0 0 12px; }
.lg-head::after {
  content: ''; display: block; width: 34px; height: 2px; margin: 0 auto;
  background: #CF0A0A; border-radius: 1px;
}

/* ------------------------------------------------------------
   Google
   ------------------------------------------------------------ */
.lg-google {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1.5px solid var(--btn-brd);
  border-radius: 14px;
  background: var(--white-btn);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.lg-google:hover, .lg-google:focus-visible {
  border-color: var(--prim); box-shadow: var(--shadow); transform: translateY(-1px);
  color: var(--ink); outline: none;
}
.lg-google__chip {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; background: #fff; border: 1px solid var(--border);
}
.lg-google__txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.lg-google__txt strong { font-size: 15px; font-weight: 700; }
.lg-google__txt small { font-size: 12.5px; color: var(--sub); }
.lg-google__arrow { width: 18px; height: 18px; color: var(--faint); transition: transform 160ms ease, color 160ms ease; }
.lg-google:hover .lg-google__arrow { transform: translateX(3px); color: var(--prim); }

.lg-or {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 10px;
  color: var(--faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.lg-or::before, .lg-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------
   Formulaire
   ------------------------------------------------------------ */
.lg-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 42px;
  border: 1.5px dashed var(--btn-brd); border-radius: 12px;
  background: transparent; color: var(--sub);
  font: inherit; font-size: 13.5px; font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.lg-toggle:hover, .lg-toggle:focus-visible { color: var(--ink); border-color: var(--prim-brd); background: var(--inner); outline: none; }
.lg-toggle .ui-i { width: 15px; height: 15px; }

.lg-form-wrap { animation: lgIn 260ms cubic-bezier(0.2, 0, 0, 1) both; }

.lg-field { display: block; margin-bottom: 14px; }
.lg-field__lbl {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--sub);
  margin-bottom: 6px;
}
.lg-field__lbl .ui-i { width: 14px; height: 14px; }
.lg-field .ui-input { height: 46px; }
.lg-field .ui-input:focus { box-shadow: 0 0 0 3px var(--prim-soft); }
.lg-field .ui-input.is-invalid { border-color: var(--red-ink); }
.lg-field__hint {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--amber-ink);
}
.lg-field__hint .ui-i { width: 13px; height: 13px; }

.lg-pwd { position: relative; }
.lg-pwd .ui-input { padding-right: 46px; }
.lg-pwd__eye {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 9px; background: transparent; color: var(--faint);
  cursor: pointer;
}
.lg-pwd__eye:hover, .lg-pwd__eye:focus-visible { color: var(--ink); background: var(--inner); outline: none; }
.lg-pwd__eye[aria-pressed="true"] { color: var(--prim); }
.lg-pwd__eye .ui-i { width: 17px; height: 17px; }

.lg-remember {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0 16px;
  font-size: 13px; color: var(--sub); cursor: pointer;
}
.lg-remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--prim); cursor: pointer; }

.lg-submit { width: 100%; position: relative; }
.lg-submit__spin {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%;
  animation: lgSpin 700ms linear infinite;
}
.lg-submit.is-loading .lg-submit__spin { display: inline-block; }
.lg-submit:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }
@keyframes lgSpin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Pied
   ------------------------------------------------------------ */
.lg-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--faint);
}
.lg-foot span { display: inline-flex; align-items: center; gap: 4px; }
.lg-foot .ui-i { width: 12px; height: 12px; }

/* ------------------------------------------------------------
   Bienvenue (connexion réussie)
   ------------------------------------------------------------ */
.lg-welcome {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity 360ms ease;
}
.lg-welcome.is-on { opacity: 1; pointer-events: auto; }
.lg-welcome__box { text-align: center; animation: lgIn 420ms cubic-bezier(0.2, 0, 0, 1) both; }
.lg-welcome__logo { height: 130px; width: auto; margin-bottom: 8px; }
.lg-welcome__title { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink); margin: 0 0 10px; }
.lg-welcome__role { margin-bottom: 26px; }
.lg-welcome__ring {
  width: 28px; height: 28px; margin: 0 auto 10px;
  border: 3px solid var(--border); border-top-color: var(--prim); border-radius: 50%;
  animation: lgSpin 800ms linear infinite;
}
.lg-welcome__txt { font-size: 13px; color: var(--faint); margin: 0; }

/* ------------------------------------------------------------
   Écrans étroits, préférences
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .page-login { padding: 56px 12px 20px; align-items: flex-start; }
  .lg-card { padding: 28px 20px 18px; border-radius: 18px; }
  .lg-logo { height: 100px; }
  .lg-theme { top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-card, .lg-form-wrap, .lg-welcome__box { animation: none; }
  .lg-google, .lg-toggle, .lg-theme { transition: none; }
  .lg-submit__spin, .lg-welcome__ring { animation-duration: 1.6s; }
}
