/* ============================================================
   CRD Habitat — espace client : connexion en deux étapes
   Complète css/style.css. Page autonome : pas de header de site,
   un visuel plein cadre à gauche sur grand écran, le formulaire
   à droite.
   ============================================================ */

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ivoire);
}

/* ------------------------------------------------------------
   Deux volets
   ------------------------------------------------------------ */
.auth-layout { display: grid; min-height: 100vh; min-height: 100dvh; }
@media (min-width: 1024px) {
  .auth-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

/* Volet visuel : photo, voile bleu nuit, logo blanc et signature */
.auth-visual {
  position: relative;
  display: none;
  overflow: hidden;
  background: var(--nuit);
  color: var(--ivoire);
}
@media (min-width: 1024px) { .auth-visual { display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; } }
.auth-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}
.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 19, 33, 0.85), rgba(8, 19, 33, 0.15) 55%, rgba(8, 19, 33, 0.35));
}
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual .logo img { position: static; height: 3.1rem; width: auto; opacity: 1; }
.auth-visual-quote {
  max-width: 24rem;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.auth-visual-quote em { font-style: italic; color: rgba(246, 244, 239, 0.7); }

/* Volet formulaire */
.auth-panel {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem 2rem;
}
@media (min-width: 640px) { .auth-panel { padding: 2.5rem; } }
@media (min-width: 1024px) { .auth-panel { padding: 3rem 4rem; } }

.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.auth-top .logo img { height: 2.5rem; width: auto; }
@media (min-width: 1024px) { .auth-top .logo { visibility: hidden; } }

.auth-body {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
}
.auth-card { width: 100%; max-width: 26rem; }

.auth-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.72rem;
  color: rgba(26, 26, 24, 0.5);
}
.auth-foot a:hover { color: var(--nuit); }

/* ------------------------------------------------------------
   Étapes
   ------------------------------------------------------------ */
.auth-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  font-size: 0.72rem;
  color: rgba(26, 26, 24, 0.55);
}
.auth-progress span { display: block; height: 3px; width: 2.25rem; border-radius: 999px; background: rgba(12, 27, 43, 0.12); transition: background-color 0.4s var(--ease); }
.auth-progress span.is-done { background: var(--nuit); }
.auth-progress b { font-weight: 500; margin-left: 0.4rem; }

.auth-title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
  color: var(--nuit);
}
.auth-lede { margin-top: 0.9rem; font-size: 0.9rem; line-height: 1.75; color: rgba(26, 26, 24, 0.7); }

/* Un seul panneau visible ; le suivant glisse depuis la droite */
.auth-step { display: none; }
.auth-step.is-active { display: block; animation: auth-in 0.55s var(--ease-out) both; }
@keyframes auth-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}
.auth-step.is-back.is-active { animation-name: auth-back; }
@keyframes auth-back {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------
   Champs
   ------------------------------------------------------------ */
.auth-label { display: block; margin-bottom: 0.5rem; font-size: 0.8rem; font-weight: 500; color: black; }
.auth-field { position: relative; }
.auth-field .field { padding-right: 3.25rem; }

/* Bouton œil : afficher / masquer le mot de passe */
.auth-eye {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: rgba(26, 26, 24, 0.5);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.auth-eye:hover { color: var(--nuit); background: rgba(12, 27, 43, 0.06); }
.auth-eye svg { width: 1rem; height: 1rem; }
.auth-eye .off { display: none; }
.auth-eye.is-on .on { display: none; }
.auth-eye.is-on .off { display: block; }

/* Messages sous le formulaire : erreur, information, verrou */
.auth-msg {
  display: none;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--r-md);
  font-size: 0.8rem;
  line-height: 1.55;
}
.auth-msg.is-visible { display: flex; }
.auth-msg svg { flex: none; width: 0.95rem; height: 0.95rem; margin-top: 0.1rem; }
.auth-msg.is-error { background: rgba(155, 44, 44, 0.07); color: #8A2424; }
.auth-msg.is-info { background: var(--ivoire-2); color: rgba(26, 26, 24, 0.75); }

.auth-caps { display: none; margin-top: 0.5rem; font-size: 0.72rem; color: var(--pierre-2); }
.auth-caps.is-visible { display: block; }

/* Bouton principal : état d'attente */
.auth-submit { width: 100%; justify-content: center; }
.auth-submit .spin { display: none; width: 0.95rem; height: 0.95rem; animation: auth-spin 0.9s linear infinite; }
.auth-submit.is-busy { pointer-events: none; opacity: 0.85; }
.auth-submit.is-busy .spin { display: block; }
.auth-submit.is-busy .btn-ic { display: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Règles du mot de passe, cochées en direct (activation, nouveau mot de passe) */
.pw-rules { display: grid; gap: 0.3rem; margin: 0.75rem 0 0; padding: 0; list-style: none; font-size: 0.8rem; color: rgba(26, 26, 24, 0.58); }
.pw-rules li { display: flex; align-items: center; gap: 0.55rem; }
.pw-rules li::before { content: ""; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1px solid currentColor; }
.pw-rules li.is-ok { color: #2E6B4E; }
.pw-rules li.is-ok::before { background: #2E6B4E; border-color: #2E6B4E; }

/* Case à cocher (consentement) */
.auth-check { display: flex; align-items: flex-start; gap: 0.75rem; min-height: 2.75rem; margin-top: 1.25rem; font-size: 0.85rem; line-height: 1.55; color: rgba(26, 26, 24, 0.8); cursor: pointer; }
.auth-check input { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.1rem; accent-color: var(--nuit); }
.auth-check a { color: var(--nuit); text-decoration: underline; text-underline-offset: 0.2em; }

/* ------------------------------------------------------------
   Code à six chiffres
   ------------------------------------------------------------ */
.otp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}
@media (min-width: 400px) { .otp { gap: 0.55rem; } }
.otp-sep { width: 0.75rem; height: 1px; flex: none; background: rgba(12, 27, 43, 0.25); }
.otp input {
  width: 100%;
  min-width: 0;
  height: 3.6rem;
  padding: 0;
  border-radius: var(--r-md);
  border: 1px solid rgba(12, 27, 43, 0.14);
  background: #fff;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--nuit);
  outline: none;
  caret-color: var(--nuit);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.3s var(--ease);
}
@media (min-width: 400px) { .otp input { height: 4rem; font-size: 1.7rem; } }
.otp input:focus { border-color: var(--nuit); box-shadow: 0 0 0 4px rgba(12, 27, 43, 0.06); }
.otp input.is-filled { border-color: rgba(12, 27, 43, 0.4); }
.otp input:disabled { background: var(--ivoire-2); color: rgba(26, 26, 24, 0.35); }
.otp.is-error input { border-color: #B54A4A; }
.otp.is-ok input { border-color: var(--nuit); background: var(--nuit); color: var(--ivoire); }

.otp.is-shake { animation: otp-shake 0.45s var(--ease); }
@keyframes otp-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* Compte utilisé, rappelé en étape 2 */
.auth-who {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 100%;
  margin-bottom: 1.75rem;
  padding: 0.55rem 1rem 0.55rem 0.6rem;
  border-radius: var(--r-pill);
  background: var(--ivoire-2);
  font-size: 0.78rem;
  color: var(--nuit);
}
.auth-who .avatar {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  flex: none;
  border-radius: 50%;
  background: var(--nuit);
  color: var(--ivoire);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
}
.auth-who span:not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-who button {
  flex: none;
  margin-left: 0.25rem;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--pierre-2);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.auth-who button:hover { color: var(--nuit); }

/* Étape finale */
.auth-done-mark {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.35rem;
  border-radius: 50%;
  background: var(--nuit);
  color: var(--ivoire);
}
.auth-done-mark svg { width: 1.15rem; height: 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  .auth-step.is-active { animation: none; }
  .otp.is-shake { animation: none; }
  .auth-submit .spin { animation: none; }
}
