/* Styles communs aux pages de comptes (login, signup, forgot-password, reset-password, auth-callback).
   Préfixe : auth-. Fichier de l'agent A05. */

.auth {
  padding: var(--space-6, 1.5rem) 16px var(--space-8, 3rem);
  background: var(--sand, #f6f1e7);
  min-height: 70vh;
}
.auth__wrap { max-width: 32rem; margin: 0 auto; }
.auth__wrap--wide { max-width: 40rem; }
.auth__card {
  background: var(--surface, #fff);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 0 0 1px rgb(15 42 68 / 0.06), 0 1px 2px rgb(15 42 68 / 0.04), 0 8px 24px rgb(15 42 68 / 0.06);
}
@media (min-width: 600px) {
  .auth { padding-top: 48px; }
  .auth__card { padding: 36px 36px; }
}
.auth__title { margin: 0 0 8px; color: var(--navy, #0f2a44); font-size: 1.625rem; line-height: 1.2; text-wrap: balance; }
.auth__lead { margin: 0 0 24px; color: var(--muted, #5f6b76); text-wrap: pretty; }
.auth__form { display: grid; gap: 18px; }
.auth__alt { margin: 20px 0 0; text-align: center; color: var(--muted, #5f6b76); }
.auth__alt a { font-weight: 600; }

/* Champs : 16 px pour éviter le zoom sur iPhone, hauteur tactile 48 px. */
.auth .input, .auth input[type="text"], .auth input[type="email"], .auth input[type="tel"], .auth input[type="password"] {
  font-size: 16px;
  min-height: 48px;
  width: 100%;
}
.auth .btn { min-height: 48px; }
.auth .btn[disabled], .auth .btn[aria-busy="true"] { cursor: not-allowed; opacity: 0.7; }

/* Message de statut (erreur générale, info) */
.auth-status:empty { display: none; }
.auth-status { margin: 0; }

/* Choix du profil : deux grandes cartes */
.auth-roles { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-roles legend { padding: 0; margin-bottom: 10px; font-weight: 600; color: var(--navy, #0f2a44); }
@media (min-width: 520px) { .auth-roles { grid-template-columns: 1fr 1fr; } .auth-roles legend { grid-column: 1 / -1; } }
.auth-role { position: relative; display: block; }
.auth-role input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.auth-role__box {
  display: grid; gap: 4px; padding: 16px 16px 16px 56px; min-height: 88px; position: relative;
  border-radius: 12px; background: var(--surface, #fff);
  box-shadow: 0 0 0 1px var(--line, #dfe3e8);
  transition: box-shadow 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), background-color 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.auth-role__icon {
  position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; color: var(--sea, #1d5c8c);
}
.auth-role__name { font-weight: 700; color: var(--navy, #0f2a44); }
.auth-role__desc { font-size: 0.875rem; color: var(--muted, #5f6b76); line-height: 1.35; }
.auth-role__check {
  position: absolute; right: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--sea, #1d5c8c); color: #fff; display: grid; place-items: center;
  opacity: 0; transform: scale(0.5);
  transition: opacity 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.auth-role__check svg { width: 14px; height: 14px; }
.auth-role input:checked + .auth-role__box { box-shadow: 0 0 0 2px var(--sea, #1d5c8c); background: #f3f8fc; }
.auth-role input:checked + .auth-role__box .auth-role__check { opacity: 1; transform: scale(1); }
.auth-role input:focus-visible + .auth-role__box { outline: 3px solid var(--sea, #1d5c8c); outline-offset: 2px; }
.auth-role input:active + .auth-role__box { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .auth-role input:not(:checked):hover + .auth-role__box { box-shadow: 0 0 0 1px var(--sea, #1d5c8c); }
}

/* Mot de passe : champ + bouton afficher/masquer */
.auth-pw { position: relative; }
.auth-pw .input, .auth-pw input { padding-right: 52px; }
.auth-pw__toggle {
  position: absolute; right: 2px; top: 50%; margin-top: -22px; width: 44px; height: 44px;
  display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px;
  color: var(--muted, #5f6b76); cursor: pointer;
  transition: color 150ms ease, transform 120ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.auth-pw__toggle:active { transform: scale(0.96); }
.auth-pw__toggle:focus-visible { outline: 3px solid var(--sea, #1d5c8c); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .auth-pw__toggle:hover { color: var(--navy, #0f2a44); } }
.auth-pw__toggle svg { width: 22px; height: 22px; grid-area: 1 / 1; transition: opacity 150ms ease, transform 150ms ease; }
.auth-pw__toggle .auth-pw__eye-off { opacity: 0; transform: scale(0.8); }
.auth-pw__toggle.is-shown .auth-pw__eye { opacity: 0; transform: scale(0.8); }
.auth-pw__toggle.is-shown .auth-pw__eye-off { opacity: 1; transform: scale(1); }

/* Indicateur de solidité */
.auth-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.auth-meter span { height: 4px; border-radius: 2px; background: var(--line, #dfe3e8); transition: background-color 200ms ease; }
.auth-meter[data-level="1"] span:nth-child(-n+1) { background: var(--danger, #b3261e); }
.auth-meter[data-level="2"] span:nth-child(-n+2) { background: var(--warning, #b7791f); }
.auth-meter[data-level="3"] span:nth-child(-n+3) { background: var(--success, #1f7a4d); }
.auth-meter[data-level="4"] span:nth-child(-n+4) { background: var(--success, #1f7a4d); }
.auth-meter__label { min-height: 1.25rem; margin: 6px 0 0; font-size: 0.875rem; color: var(--muted, #5f6b76); }
.auth-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.875rem; color: var(--muted, #5f6b76); }
.auth-rules li { display: flex; gap: 8px; align-items: center; }
.auth-rules li::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 2px var(--line, #dfe3e8);
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.auth-rules li.is-met { color: var(--success, #1f7a4d); }
.auth-rules li.is-met::before { background: var(--success, #1f7a4d); box-shadow: none; }

/* Cases à cocher (CGU) : zone tactile large */
.auth-check { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.auth-check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--sea, #1d5c8c); }
.auth-check span { line-height: 1.45; }

/* Écran "Vérifiez votre boîte mail" et états du retour de lien */
.auth-done { text-align: center; display: grid; gap: 14px; justify-items: center; }
.auth-done__icon {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: #e8f1f8; color: var(--sea, #1d5c8c);
}
.auth-done__icon svg { width: 30px; height: 30px; }
.auth-done__icon--ok { background: #e6f4ec; color: var(--success, #1f7a4d); }
.auth-done__icon--bad { background: #fbeaea; color: var(--danger, #b3261e); }
.auth-done .auth__title, .auth-done .auth__lead { margin-bottom: 0; }
.auth-done__email { font-weight: 700; word-break: break-all; color: var(--navy, #0f2a44); }
.auth-done__actions { display: grid; gap: 10px; width: 100%; margin-top: 8px; }
.auth-count { font-variant-numeric: tabular-nums; }
.auth-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line, #dfe3e8); border-top-color: var(--sea, #1d5c8c);
  animation: auth-spin 700ms linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Apparition douce de l'écran suivant */
.auth-enter { animation: auth-in 220ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)) both; }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .auth-enter { animation: none; }
  .auth-spinner { animation-duration: 1.6s; }
  .auth-role__box, .auth-role__check, .auth-pw__toggle, .auth-pw__toggle svg { transition: none; }
}

/* Messages dans les cartes de compte : texte en colonne, bouton sous le texte */
.auth .alert { flex-direction: column; align-items: flex-start; gap: 10px; }
.auth .alert p { margin: 0; }
.auth-done .alert { text-align: left; width: 100%; }

/* Note « demande enregistrée » : respiration avant le choix du profil */
#from-request-note { margin-bottom: 1.25rem; }
