/* Contenu centré verticalement et horizontalement. */
body {
  min-height: 100vh;
  background: var(--black-color);
  color: var(--white-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0; /* plein écran : aucune marge autour du conteneur */
}

/* Conteneur principal */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh; /* plein écran : occupe toute la hauteur de la fenêtre */
  background: color-mix(in srgb, var(--black-color) 50%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

/* Les deux formulaires se superposent et un seul visible à la fois */
.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  display: flex;            /* centre le formulaire verticalement via ses marges auto */
  flex-direction: column;
  overflow-y: auto; /* défilement interne si le formulaire dépasse la hauteur du conteneur */
  transition: all .6s ease-in-out;
}

/* L'inscription est plus haute : le centrage par marges auto (form) la remonte en haut
   automatiquement quand elle dépasse la hauteur de l'écran, avec défilement possible. */

.sign-up-container {
  left: 0;
  opacity: 0;
  z-index: 1;
}

.sign-in-container {
  left: 0;
  z-index: 2;
}

form {
  width: 100%;
  max-width: 448px; /* 24px de padding de chaque côté => inputs de 400px, reste adapté */
  margin: auto; /* centre le formulaire dans sa moitié (vertical + horizontal), sans rogner au défilement */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px; /* respiration verticale quand le formulaire touche les bords */
  text-align: center;
}

/* Logo dans les formulaires */
.form-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.form-logo img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

form h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--white-color);
}

form .subtitle {
  font-size: 13px;
  color: var(--grey-color);
  margin-bottom: 24px;
}

/* Sélecteur de rôle */
.role-toggle {
  display: flex;
  width: 100%;
  background: color-mix(in srgb, var(--white-color) 4%, var(--black-color));
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.role-toggle input {
  display: none;
}

.role-toggle label {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-color);
  cursor: pointer;
  transition: .3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.role-toggle label i {
  font-size: 13px;
}

.role-toggle input:checked + label {
  background: color-mix(in srgb, var(--main-color) 15%, transparent);
  color: var(--main-color);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--main-color) 30%, transparent);
}

/* Champs */
.field {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
}

.field .fld-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--grey-color);
  transition: .3s;
}

.field input {
  width: 100%;
  background: color-mix(in srgb, var(--white-color) 4%, var(--black-color));
  border: 2px solid color-mix(in srgb, var(--white-color) 8%, transparent);
  border-radius: 8px;
  height: 48px;
  padding: 0 16px 0 44px;
  font-size: 14px;
  font-family: inherit;
  color: var(--white-color);
  transition: .3s;
}

.field input::placeholder {
  color: var(--grey-color);
}

.field input:focus {
  outline: none;
  border-color: var(--main-color);
  background: color-mix(in srgb, var(--white-color) 8%, var(--black-color));
}

.field:focus-within .fld-icon {
  color: var(--main-color);
}

/* Bouton afficher / cacher le mot de passe */
.field.has-toggle input {
  padding-right: 44px;
}

.toggle-pass {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--grey-color);
  cursor: pointer;
  padding: 8px;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .3s;
}

.toggle-pass:hover {
  color: var(--main-color);
}

.forgot {
  align-self: flex-end;
  font-size: 12px;
  color: var(--grey-color);
  text-decoration: none;
  margin: -4px 0 20px;
}

.forgot:hover {
  color: var(--main-color);
}

/* Bouton principal */
button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .4px;
  cursor: pointer;
  border: none;
}

.btn-primary {
  width: 100%;
  height: 48px;
  color: var(--black-color);
  padding: 0 16px;
  border-radius: 8px;
  background: var(--main-color);
  box-shadow: 0 0 16px color-mix(in srgb, var(--main-color) 50%, transparent);
  transition: .3s;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: scale(1.04);
  box-shadow: 0 0 28px color-mix(in srgb, var(--main-color) 75%, transparent);
}

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

/* Bascule mobile */
.mobile-switch {
  display: none;
  font-size: 13px;
  color: var(--grey-color);
  margin-top: 20px;
}

.mobile-switch a {
  color: var(--main-color);
  font-weight: 600;
  text-decoration: none;
}

/* Overlay coulissant */
.overlay-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: all .6s ease-in-out;
  z-index: 100;
}

/* Panneau intérieur à 200% de large, décalé de -100% : en le translatant, on
   révèle l'un ou l'autre message tout en donnant l'effet de volet qui glisse. */
.overlay {
  position: relative;
  left: -100%;
  width: 200%;
  height: 100%;
  /* Une seule image, dimensionnée sur toute la largeur de l'overlay (= plein écran) :
     chaque panneau (50%) en révèle donc la moitié gauche ou droite. */
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--main-color) 0%, transparent) 0%,
      color-mix(in srgb, var(--main-color) 80%, var(--black-color)) 100%),
    url("../images/auth-dev-jy0TXbF.png") center / cover no-repeat;
  color: var(--white-color);
  transition: all .6s ease-in-out;
}

.overlay-panel {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 50%;
  padding: 0 44px;
  text-align: center;
  overflow: hidden; /* rogne l'image de fond */
  color: #fff; /* texte lisible sur la photo + dégradé bleu */
}

/* Contenu (icône, titre, texte, bouton) au-dessus de la photo */
.overlay-panel > * {
  position: relative;
  z-index: 1;
}

.overlay-panel .o-icon {
  font-size: 32px;
  margin-bottom: 16px;
  color: #fff;
  opacity: .9;
}

.overlay-panel h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
}

.overlay-panel p {
  font-size: 14px;
  line-height: 1.6;
  opacity: .85;
  margin-bottom: 24px;
  font-weight: 500;
  max-width: 340px; /* évite une ligne de texte étirée sur toute la moitié */
}

/* Bouton fantôme (dans les panneaux de l'overlay) */
.btn-ghost {
  background: transparent;
  color: #fff;
  border: 2px solid color-mix(in srgb, #fff 75%, transparent);
  height: 48px;
  padding: 0 40px;
  border-radius: 8px;
  transition: .3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost:hover {
  background: color-mix(in srgb, #fff 15%, transparent);
}

.overlay-left {
  left: 0;
}

.overlay-right {
  right: 0;
}

/* Animation active (classe .right-panel-active ajoutée par le JS) */
.container.right-panel-active .sign-in-container {
  transform: translateX(100%);
  opacity: 0;
  z-index: 1;
}

.container.right-panel-active .sign-up-container {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
  animation: show .6s;
}

.container.right-panel-active .overlay-container {
  transform: translateX(-100%);
}

.container.right-panel-active .overlay {
  transform: translateX(50%);
}

/* show : retarde l'apparition de l'inscription à mi-parcours pour éviter que
   les deux formulaires se chevauchent pendant le glissement */
@keyframes show {
  0%, 49% { opacity: 0; z-index: 1; }
  50%, 100% { opacity: 1; z-index: 5; }
}

/* Messages d'erreur de formulaire */
.form-error,
.field-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--danger-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger-color) 30%, transparent);
  color: var(--danger-color);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: left;
  width: 100%;
}

/* Icône d'alerte */
.form-error::before,
.field-error::before {
  content: "\f06a"; /* fa-circle-exclamation */
  font: var(--fa-font-solid); /* famille + graisse fournies par Font Awesome */
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  flex-shrink: 0;
}

.form-error {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.field-error {
  font-size: 12px;
  margin: -4px 0 12px;
}

/* Pas de boîte vide quand il n'y a aucune erreur */
.field-error:empty {
  display: none;
}

/* La liste rendue par form_errors reste sans puce ni marge */
.field-error ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Consentements (cases CGU + politique de confidentialité) */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
  text-align: left;
}

.consent input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--main-color);
  cursor: pointer;
  flex-shrink: 0;
}

.consent-text {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--grey-color);
}

.consent-text label {
  cursor: pointer;
}

.legal-link {
  color: var(--main-color);
  font-weight: 600;
  text-decoration: none;
}

.legal-link:hover {
  text-decoration: underline;
}

/* Modale légale : CSS pur, affichée uniquement quand son ancre est ciblée */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal:target {
  display: flex;
}

/* Fond cliquable pour fermer */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--black-color) 75%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Boîte centrale défilable */
.modal-box {
  position: relative;
  z-index: 1;
  width: 640px;
  max-width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--black-color);
  border: 1px solid color-mix(in srgb, var(--main-color) 30%, transparent);
  border-radius: 8px;
  box-shadow: 0 0 88px color-mix(in srgb, var(--black-color) 90%, transparent);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--white-color) 15%, transparent);
}

.modal-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white-color);
}

.modal-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--main-color);
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: .3s;
}

.modal-close:hover {
  background-color: color-mix(in srgb, var(--main-color) 15%, transparent);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  text-align: left;
  color: var(--white-color);
  scrollbar-width: thin;
  scrollbar-color: var(--main-color) transparent;
}

.modal-body h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--main-color);
  margin: 20px 0 4px;
}

.modal-body h3:first-of-type {
  margin-top: 0;
}

.modal-body p {
  font-size: 13px;
  line-height: 1.7;
  color: color-mix(in srgb, var(--white-color) 80%, transparent);
  margin-bottom: 8px;
}

.modal-body .legal-updated {
  font-size: 12px;
  color: var(--grey-color);
  margin-bottom: 16px;
}

/* Message flash (succès de réinitialisation) affiché dans le panneau de connexion : pleine largeur. */
.sign-in-container .flash {
  width: 100%;
  margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    min-height: 100vh;
  }

  .overlay-container {
    display: none;
  }

  .form-container {
    width: 100%;
  }

  .sign-up-container {
    opacity: 0;
    pointer-events: none;
  }

  .container.right-panel-active .sign-in-container {
    transform: none;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
  }

  .container.right-panel-active .sign-up-container {
    transform: none;
    opacity: 1;
    pointer-events: auto;
    z-index: 5;
  }

  .sign-in-container {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-switch {
    display: block;
  }

  form {
    padding: 0 24px;
  }
}
