/* VINTAGE'ART — Motion de la page de connexion (/login), design clair.
   Palette froide uniquement : gris bleutés, pétrole (#174f56 / #1a6267), bleu acier.
   Aucun mouvement si l'utilisateur a demandé à réduire les animations (voir en bas). */

/* ── Fond : deux halos très doux qui dérivent lentement ─────────────────── */
body.page-auth::after {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(30% 28% at 24% 26%, rgba(26, 98, 103, 0.16), transparent 70%),
    radial-gradient(28% 26% at 78% 70%, rgba(74, 112, 150, 0.14), transparent 70%);
  animation: auth-drift 18s ease-in-out infinite alternate;
}

@keyframes auth-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(4%, -3%, 0) scale(1.05); }
  100% { transform: translate3d(-3%, 3%, 0) scale(1.02); }
}

.auth-section {
  position: relative;
  z-index: 1;
}

/* ── Entrée de la carte ─────────────────────────────────────────────────── */
.auth-section .auth-card {
  position: relative;
  animation: auth-rise 1.1s .15s cubic-bezier(.16, 1, .3, 1) both;
  box-shadow: 0 1px 2px rgba(23, 35, 45, 0.04), 0 18px 40px -24px rgba(23, 79, 86, 0.28);
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(48px) scale(.96); box-shadow: 0 0 0 rgba(23, 79, 86, 0); }
  to   { opacity: 1; transform: none; }
}

/* Filet pétrole qui se dessine en haut de la carte à l'arrivée */
.auth-section .auth-card::after {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(90deg, #174f56, #4a7096);
  transform: scaleX(0);
  transform-origin: left center;
  animation: auth-line 1.3s .7s cubic-bezier(.65, 0, .35, 1) both;
  pointer-events: none;
}

@keyframes auth-line {
  to { transform: scaleX(1); }
}

/* ── Apparition en cascade du contenu ───────────────────────────────────── */
.auth-card > *,
.auth-form > .auth-field,
.auth-form > .auth-btn,
.auth-form > .auth-links {
  animation: auth-in .8s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

.auth-card > :nth-child(1) { animation-delay: .45s; }
.auth-card > :nth-child(2) { animation-delay: .55s; }
.auth-card > :nth-child(3) { animation-delay: .65s; }
.auth-card > :nth-child(4) { animation-delay: .75s; }
.auth-card > :nth-child(5) { animation-delay: .85s; }
.auth-card > :nth-child(6) { animation-delay: 1.45s; }
.auth-card > :nth-child(7) { animation-delay: 1.55s; }
.auth-card > :nth-child(8) { animation-delay: 1.65s; }
.auth-form > :nth-child(3) { animation-delay: .95s; }
.auth-form > :nth-child(4) { animation-delay: 1.05s; }
.auth-form > :nth-child(5) { animation-delay: 1.15s; }
.auth-form > :nth-child(6) { animation-delay: 1.25s; }
.auth-form > :nth-child(7) { animation-delay: 1.35s; }

/* Le formulaire lui-même ne doit pas rejouer l'animation par-dessus ses enfants */
.auth-card > .auth-form { animation: none; }

/* Mot-clé du haut (« Espace privé ») : lettres qui se resserrent */
.auth-context {
  animation: auth-in .8s .45s cubic-bezier(.16, 1, .3, 1) both, auth-track 1.4s .45s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes auth-track {
  from { letter-spacing: .5em; }
  to   { letter-spacing: .13em; }
}

/* ── Champs ─────────────────────────────────────────────────────────────── */
.auth-label {
  transition: color .2s ease;
}

.auth-field:focus-within .auth-label {
  color: #174f56;
}

.auth-input {
  transition: border-color .2s ease, box-shadow .2s ease;
}

.auth-input:hover {
  border-color: #5f7381;
}

.auth-input:focus {
  border-color: #174f56;
  box-shadow: 0 0 0 3px rgba(26, 98, 103, 0.12);
}

/* Trait pétrole qui se dessine sous le champ actif */
.auth-field-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #174f56, #4a7096);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.auth-field-icon:focus-within::after {
  transform: scaleX(1);
}

.auth-pwd-toggle {
  transition: color .2s ease, background .2s ease;
}

.auth-pwd-toggle:hover {
  color: #174f56;
  background: rgba(26, 98, 103, 0.07);
}

.auth-pwd-toggle svg {
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}

.auth-pwd-toggle:active svg {
  transform: scale(.82);
}

/* Champ refusé par le navigateur : petite secousse */
.auth-input.is-shake {
  animation: auth-shake .42s cubic-bezier(.36, .07, .19, .97);
  border-color: #b23a44;
}

@keyframes auth-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* Message d'erreur du serveur : entrée puis secousse */
.auth-alert--error {
  animation: auth-in .45s .25s cubic-bezier(.2, .8, .2, 1) both, auth-shake .5s .75s cubic-bezier(.36, .07, .19, .97);
}

/* ── Bouton ─────────────────────────────────────────────────────────────── */
.auth-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}

.auth-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .75s cubic-bezier(.2, .8, .2, 1);
}

.auth-btn:hover {
  box-shadow: 0 8px 20px -10px rgba(16, 62, 68, 0.6);
}

.auth-btn:hover::before,
.auth-btn:focus-visible::before {
  transform: translateX(120%);
}

.auth-btn:active {
  transform: scale(.99);
}

/* Envoi : petit cercle qui tourne + barre de progression en haut de la carte */
.auth-btn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: auth-spin .7s linear infinite;
  order: -1;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-card.is-sending::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 3px;
  z-index: 1;
  background: linear-gradient(90deg, transparent, #174f56, #4a7096, transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: auth-progress 1.1s ease-in-out infinite;
}

@keyframes auth-progress {
  from { background-position: -45% 0; }
  to   { background-position: 145% 0; }
}

/* ── Liens ──────────────────────────────────────────────────────────────── */
.auth-back svg {
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}

.auth-back:hover svg {
  transform: translateX(-3px);
}

.auth-links a,
.auth-divider a,
.auth-help {
  text-decoration-color: transparent;
  text-decoration-line: underline;
  transition: text-decoration-color .2s ease, color .2s ease;
}

.auth-links a:hover,
.auth-divider a:hover,
.auth-help:hover {
  text-decoration-color: currentColor;
}

/* ── Accessibilité : aucun mouvement si demandé ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body.page-auth::after { display: none; }
  .auth-section *,
  .auth-section *::before,
  .auth-section *::after {
    animation: none !important;
    transition: none !important;
  }
  .auth-section .auth-card::after { transform: scaleX(1); }
}

/* ── Mise en page resserrée (moins d'espace vide) ──────────────────────────
   Préfixe body.page-auth : le style intégré de login.php est chargé après ce fichier. */
body.page-auth .auth-section { min-height: 0; padding: 44px 20px 52px; }
body.page-auth .auth-wrapper { max-width: 420px; }
body.page-auth .auth-card { padding: 28px 30px 22px; }
body.page-auth .auth-context { margin: 0 0 10px; }
body.page-auth .auth-back { min-height: 30px; margin: 0 0 6px; }
body.page-auth .auth-title { font-size: 30px; margin: 0 0 4px; }
body.page-auth .auth-subtitle { margin: 0 0 20px; font-size: 14.5px; }
body.page-auth .auth-alert-stack { margin-bottom: 14px; }
body.page-auth .auth-form { gap: 14px; }
body.page-auth .auth-field { gap: 6px; }
body.page-auth .auth-input { min-height: 46px; padding-top: 10px; padding-bottom: 10px; }
body.page-auth .auth-btn { min-height: 46px; margin-top: 2px; }
body.page-auth .auth-links a { min-height: 32px; }
body.page-auth .auth-links { margin-top: -6px; }
body.page-auth .auth-divider { margin-top: 10px; padding-top: 12px; }
body.page-auth .auth-divider a { min-height: 32px; }
body.page-auth .auth-help { min-height: 30px; margin-top: 0; }

@media (max-width: 640px) {
  body.page-auth .auth-section { padding: 20px 16px 32px; }
  body.page-auth .auth-card { padding: 22px 20px 18px; }
  body.page-auth .auth-title { font-size: 27px; }
}

/* ── Rendu institutionnel ───────────────────────────────────────────────── */
/* La page occupe toute la hauteur : pas de zone vide sous le pied de page */
body.page-auth { display: flex; flex-direction: column; }
body.page-auth .site-main { flex: 1 0 auto; }

/* « Mot de passe oublié ? » aligné à droite, sous le champ mot de passe */
body.page-auth .auth-links { margin-top: -8px; text-align: right; font-size: 13px; }
body.page-auth .auth-links a { min-height: 28px; }

/* Mention de sécurité sous le formulaire */
.auth-secure {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 12px;
  background: #f1f5f6;
  border-left: 2px solid #1a6267;
  color: #45555f;
  font-size: 12.5px;
  line-height: 1.5;
}
.auth-secure svg { flex-shrink: 0; margin-top: 2px; color: #1a6267; }
.auth-secure a { color: #174f56; text-underline-offset: 3px; }

/* Pied de carte : créer un compte à gauche, aide à droite */
body.page-auth .auth-divider--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  margin-top: 16px;
  font-size: 13px;
}
body.page-auth .auth-divider--split .auth-help { margin-top: 0; min-height: 32px; }

/* Pas de bulle de discussion sur la page de connexion */
body.page-auth #va-chat-widget { display: none !important; }

/* Bouton « Accepter » des cookies dans la palette froide du site */
body.page-auth .cookie-primary { background: #174f56; color: #fff; }
body.page-auth .cookie-primary:hover { background: #103e44; }

/* ── Pied de page compact sur la page de connexion ─────────────────────────
   Seule la bande légale reste (copyright, mentions, confidentialité, CGV, cookies). */
body.page-auth .va-ft .va-ft-grid,
body.page-auth .va-ft .va-ft-news { display: none; }
body.page-auth .va-ft .va-ft-inner { padding: 6px 24px; }
body.page-auth .va-ft .va-ft-bottom { padding-top: 0; border-top: 0; }
body.page-auth .va-ft .va-ft-bottom a,
body.page-auth .va-ft .va-ft-cookie-settings { min-height: 40px; padding: 8px 0; }

@media (max-width: 640px) {
  body.page-auth .va-ft .va-ft-inner { padding: 14px 20px 18px; }
  body.page-auth .va-ft .va-ft-bottom { gap: 2px; }
}

/* Mention de sécurité : le cadenas se « ferme » à l'arrivée */
.auth-secure svg { animation: auth-lock .6s 1.6s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes auth-lock { from { transform: translateY(-4px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Pied de carte : « Besoin d'aide ? » reste toujours à droite, sur la même ligne */
body.page-auth .auth-divider--split .auth-help { white-space: nowrap; justify-self: end; }

/* Champ actif : un seul contour net (bordure pétrole + halo), sans le cadre épais par-dessus */
body.page-auth .auth-input:focus,
body.page-auth .auth-input:focus-visible {
  outline: none;
  border-color: #174f56;
  box-shadow: 0 0 0 3px rgba(26, 98, 103, 0.14);
}
