/* ==========================================================================
   PAGE DE CONNEXION — Dental Clinic Manager
   Idée : la page s'ouvre sur une arcade dentaire. Le formulaire est placé
   « dans la bouche », sous l'arc des dents. Une seule animation : les dents
   apparaissent du centre vers le fond au chargement.
   Préfixe .lg- : aucun conflit avec les autres pages.
   ========================================================================== */

:root {
  --lg-porcelaine: #F3F7F5;   /* fond */
  --lg-email:      #FFFFFF;   /* émail des dents, champs */
  --lg-contour:    #CFE0DA;   /* contour des dents, bordures */
  --lg-gencive:    #F2B9BF;   /* gencive */
  --lg-encre:      #0F2E2A;   /* texte principal */
  --lg-ardoise:    #557069;   /* texte secondaire */
  --lg-soin:       #0F766E;   /* action principale */
  --lg-soin-fonce: #0B5C55;
}

.lg, .lg *, .lg *::before, .lg *::after { box-sizing: border-box; }

body.lg {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--lg-porcelaine);
  color: var(--lg-encre);
  font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.lg a { color: var(--lg-soin); text-decoration: none; }
.lg a:hover { color: var(--lg-soin-fonce); text-decoration: underline; text-underline-offset: 3px; }
.lg a:focus-visible,
.lg button:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.35); outline-offset: 3px; border-radius: 6px; }

/* ---------- Barre du haut ---------- */
.lg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(20px, 4vw, 48px);
}

.lg .lg-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--lg-encre);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
}
.lg .lg-brand:hover { text-decoration: none; color: var(--lg-encre); }

/* Petite dent stylisée comme marque */
.lg-brand-dot {
  width: 14px;
  height: 17px;
  border-radius: 6px 6px 7px 7px;
  background: var(--lg-email);
  border: 2px solid var(--lg-soin);
}

.lg .lg-top-link {
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border: 1px solid var(--lg-contour);
  border-radius: 999px;
  background: var(--lg-email);
}
.lg .lg-top-link:hover { border-color: var(--lg-soin); text-decoration: none; }

/* ---------- Scène : arcade + titre ---------- */
.lg-main {
  flex: 1;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 20px 32px;
}

/* ---------- Cadre ---------- */
.lg-frame {
  position: relative;
  background: var(--lg-email);
  border: 1px solid var(--lg-contour);
  border-radius: 28px;
  padding: 18px 34px 32px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset,
              0 30px 60px -32px rgba(15, 46, 42, 0.28);
}

/* Liseré rose gencive en haut du cadre : rappel de l'arcade */
.lg-frame::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 120px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 0 0 4px 4px;
  background: var(--lg-gencive);
}

.lg-stage {
  position: relative;
  margin-top: clamp(4px, 3vh, 32px);
}

.lg-arch {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.lg-gum {
  fill: none;
  stroke: var(--lg-gencive);
  stroke-width: 54;
  stroke-linecap: round;
  opacity: 0.55;
}

.lg-tooth {
  fill: #FDFEFE;
  stroke: var(--lg-contour);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: lg-pousse 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.2) both;
  animation-delay: calc(var(--d) * 60ms + 80ms);
}

@keyframes lg-pousse {
  from { opacity: 0; transform: translateY(14px) scale(0.6); }
  to   { opacity: 1; transform: none; }
}

/* Erreur de connexion : l'arcade réagit (réponse à l'action de l'utilisateur) */
.lg-arch.is-error { animation: lg-non 0.45s ease-in-out 0.1s; }
@keyframes lg-non {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(3px); }
}

/* Titre posé à l'intérieur de l'arc */
.lg-heading {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12%;
  text-align: center;
}

.lg-heading h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.1;
}

.lg-heading p {
  margin: 8px 0 0;
  color: var(--lg-ardoise);
  font-size: 15px;
}

/* ---------- Formulaire ---------- */
.lg-panel { margin-top: 40px; }

.lg-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.lg-alert i { margin-top: 3px; }
.lg-alert-err  { background: #FDECEE; color: #8F1D2C; border: 1px solid #F6C6CD; }
.lg-alert-info { background: #E6F3F0; color: var(--lg-soin-fonce); border: 1px solid #BFE0D8; }

.lg-field { display: block; margin-bottom: 16px; }

.lg-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--lg-encre);
}

.lg-field input {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--lg-contour);
  border-radius: 14px;
  background: var(--lg-email);
  color: var(--lg-encre);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lg-field input::placeholder { color: #9BB0AA; }
.lg-field input:focus {
  outline: none;
  border-color: var(--lg-soin);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.lg-pass { position: relative; }
.lg-pass input { padding-right: 52px; }

.lg-eye {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--lg-ardoise);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lg-eye:hover { background: #E6F3F0; color: var(--lg-soin); }

.lg-caps {
  display: block;
  margin-top: 7px;
  color: #9A5B00;
  font-size: 13px;
  font-weight: 600;
}
.lg-caps[hidden] { display: none; }

.lg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 54px;
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  background: var(--lg-soin);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.lg-btn:hover { background: var(--lg-soin-fonce); }
.lg-btn:active { transform: translateY(1px); }
.lg-btn:disabled { cursor: wait; opacity: 0.85; }

.lg-btn-wait { display: none; }
.lg-btn.is-loading .lg-btn-text { display: none; }
.lg-btn.is-loading .lg-btn-wait { display: inline; }

.lg-new {
  margin: 22px 0 0;
  text-align: center;
  color: var(--lg-ardoise);
  font-size: 14px;
}
.lg-new a { font-weight: 600; }


/* ---------- Se souvenir / mot de passe oublié ---------- */
.lg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: -2px 0 20px;
}

.lg-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 14px;
  color: var(--lg-encre);
  cursor: pointer;
  user-select: none;
}
.lg-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--lg-contour);
  border-radius: 6px;
  background: var(--lg-email);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.lg-check input::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform 0.12s ease;
}
.lg-check input:checked { background: var(--lg-soin); border-color: var(--lg-soin); }
.lg-check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.lg-check input:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.35); outline-offset: 2px; }

.lg .lg-forgot { font-size: 14px; font-weight: 600; }

.lg-help { display: block; margin-top: 7px; color: var(--lg-ardoise); font-size: 13px; }

/* ---------- Écrans de confirmation ---------- */
.lg-done { text-align: center; }
.lg-done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #E6F3F0;
  color: var(--lg-soin);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.lg-done-warn { background: #FDF1E3; color: #9A5B00; }
.lg-done h2 { margin: 0 0 10px; font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.lg-done p { margin: 0 0 12px; color: var(--lg-encre); }
.lg-done .lg-muted { color: var(--lg-ardoise); font-size: 14px; }
.lg .lg-btn-link { margin-top: 18px; color: #fff; text-decoration: none; }
.lg .lg-btn-link:hover { color: #fff; text-decoration: none; }

.lg-back { margin: 20px 0 0; text-align: center; font-size: 14px; }
.lg-back a { font-weight: 600; }

/* ---------- Jauge de robustesse du mot de passe ---------- */
.lg-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin: -6px 0 18px;
}
.lg-meter span { height: 5px; border-radius: 3px; background: var(--lg-contour); transition: background 0.2s ease; }
.lg-meter em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--lg-ardoise); min-width: 70px; text-align: right; }
.lg-meter[data-niveau="1"] span:nth-child(-n+1) { background: #D9534F; }
.lg-meter[data-niveau="2"] span:nth-child(-n+2) { background: #E0A23A; }
.lg-meter[data-niveau="3"] span:nth-child(-n+3) { background: #3BA58B; }
.lg-meter[data-niveau="4"] span:nth-child(-n+4) { background: var(--lg-soin); }

/* ---------- Pied de page ---------- */
.lg-foot {
  padding: 18px 20px 26px;
  text-align: center;
  color: var(--lg-ardoise);
  font-size: 13px;
}
.lg-foot p { margin: 0 auto; max-width: 420px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 480px) {
  .lg-main { padding: 0 12px 24px; }
  .lg-frame { padding: 12px 18px 24px; border-radius: 22px; }
  .lg-top { padding: 16px 18px; }
  .lg .lg-top-link { padding: 8px 12px; font-size: 13px; }
  .lg-heading p { font-size: 14px; }
  .lg-gum { stroke-width: 54; }
}

/* Écrans très bas (téléphone à l'horizontale) : l'arcade se réduit */
@media (max-height: 560px) and (orientation: landscape) {
  .lg-main { max-width: 400px; }
  .lg-stage { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-tooth, .lg-arch.is-error { animation: none; }
  .lg *, .lg *::before, .lg *::after { transition: none !important; }
}

/* Dans le cadre, l'arcade remonte un peu */
.lg-frame .lg-stage { margin-top: 0; }

/* Arcade seule (page de connexion) : phrase d'accueil sous les dents */
.lg-intro {
  margin: 22px 0 0;
  text-align: center;
  color: var(--lg-ardoise);
  font-size: 15px;
}
.lg-intro + .lg-panel { margin-top: 26px; }

/* Texte réservé aux lecteurs d'écran */
.lg-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}