/* 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;
}

/* Conteneur principal */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
}

/* Les deux formulaires se superposent et un seul visible à la fois */
.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  display: flex;
  flex-direction: column;
  transition: all .6s ease-in-out;
}

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

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

form {
  width: 100%;
  max-width: 448px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  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;
  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-size: 14px;
  font-weight: 600;
  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) 80%, 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;
}

.overlay {
  position: relative;
  left: -100%;
  width: 200%;
  height: 100%;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--main-color) 0%, transparent) 0%,
      color-mix(in srgb, var(--main-color) 60%, 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;
  color: #fff;
}

/* 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 80%, 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;
}

.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 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%;
}

.form-error::before,
.field-error::before {
  content: "\f06a";
  font: var(--fa-font-solid);
  font-size: 14px;
}

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

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

.field-error:empty {
  display: none;
}

.field-error ul {
  list-style: none;
}

/* 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;
  accent-color: var(--main-color);
  cursor: pointer;
}

.consent-text {
  font-size: 13px;
  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;
}

/* Message flash (succès de réinitialisation) */
.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;
  }
}
