/* ============================================================
   MOTIX EXPRESS — Connexion
   Fond animé + carte pleinement opaque à fort contraste.
   Les éléments décoratifs (glow, lignes) sont des frères de
   .login-wrap, jamais des enfants d'un conteneur flex qui les
   repositionnerait — évite la collision de spécificité déjà
   rencontrée sur la page de création de compte.
   ============================================================ */

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family: var(--font-display);
  background: var(--ink);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------------- Fond animé ---------------- */
.bg-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 900px;
  max-width: 170vw;
  max-height: 170vw;
  background: radial-gradient(
    circle,
    rgba(88, 190, 59, 0.28) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
  animation: loginGlow 7s ease-in-out infinite;
}
@keyframes loginGlow {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.bg-lines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    -20deg,
    rgba(88, 190, 59, 0.12) 0px,
    rgba(88, 190, 59, 0.12) 2px,
    transparent 2px,
    transparent 64px
  );
  background-size: 220% 220%;
  animation: loginDrift 18s linear infinite;
}
@keyframes loginDrift {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: -280px 150px;
  }
}

/* ---------------- Retour au site ---------------- */
.back-to-site {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px 8px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.back-to-site:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.back-to-site i {
  font-size: 12px;
}

/* ---------------- Mise en page ---------------- */
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 60px;
}
.login-inner {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: loginRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes loginRise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------- Badge logotype ---------------- */
.login-badge {
  font-size: 30px;
  font-weight: 900;
  font-style: italic;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 26px;
}
.login-badge span {
  color: var(--green);
}

/* ---------------- Carte ---------------- */
.login-card {
  width: 100%;
  background: var(--white);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.login-card h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
}
.login-card p.intro {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 26px;
}

/* ---------------- Champs ---------------- */
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
}
.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-pale);
}
.field-error {
  display: none;
  color: #c0272d;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}
.field.invalid input {
  border-color: #c0272d;
}
.field.invalid .field-error {
  display: block;
}

.pw-field {
  position: relative;
}
.pw-field input {
  padding-right: 44px;
}
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
}
.pw-toggle:hover {
  color: var(--text);
}

/* ---------------- Ligne se souvenir / mot de passe oublié ---------------- */
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 12.5px;
}
.remember-field {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  cursor: pointer;
}
.remember-field input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
}
.forgot-link {
  color: var(--green-dark);
  font-weight: 700;
}

/* ---------------- Bouton avec état de chargement ---------------- */
.login-submit {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  position: relative;
}
.login-submit .btn-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(11, 26, 6, 0.3);
  border-top-color: #0b1a06;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.login-submit.loading .btn-label {
  visibility: hidden;
}
.login-submit.loading .btn-spinner {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-footer-link {
  text-align: center;
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.login-footer-link a {
  color: var(--green-dark);
  font-weight: 700;
}

.form-error-banner {
  display: none;
  background: #fdebec;
  color: #9c1c22;
  border: 1px solid #f5c1c4;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}
.form-error-banner.visible {
  display: block;
}

/* ---------------- Écran de succès ---------------- */
.login-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.login-success.visible {
  display: flex;
}
.login-success .check {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 18px;
}
.login-success h2 {
  font-size: 21px;
  margin: 0 0 6px;
  color: var(--text);
}
.login-success p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* ---------------- Pied de page ---------------- */
.login-page-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.35);
  padding-bottom: 28px;
  margin-top: -40px;
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 22px;
  }
  .back-to-site {
    top: 16px;
    left: 16px;
  }
}
