/* ——— Auth (connexion / inscription) — design autonome, typographie soignée ——— */

:root {
  --auth-blue: #0071e3;
  --auth-blue-hover: #0077ed;
  --auth-blue-ring: rgba(0, 113, 227, 0.22);
  --auth-text: #1d1d1f;
  --auth-muted: #6e6e73;
  --auth-border: rgba(0, 0, 0, 0.1);
  --auth-surface: rgba(255, 255, 255, 0.92);
  --auth-radius: 14px;
  --auth-radius-lg: 22px;
  --auth-shadow: 0 2px 16px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.08);
  --auth-shadow-hover: 0 4px 24px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.1);
  --auth-gradient-bg: linear-gradient(160deg, #e8f4ff 0%, #f5f5f7 35%, #eef0f4 70%, #dce8f9 100%);
  /* fallback si var() manquait avant */
  --gradient-primary: linear-gradient(180deg, #0077ed 0%, var(--auth-blue) 100%);
  --primary-color: var(--auth-blue);
  --secondary-color: #0050b3;
  --border-color: var(--auth-border);
  --light-text: #86868b;
  --box-shadow-soft: var(--auth-shadow);
  --box-shadow-strong: var(--auth-shadow-hover);
}

.auth-page {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--auth-text);
  background: var(--auth-gradient-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 0;
  color-scheme: only light;
}

/* Nav */
.auth-page nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.auth-page .logo a {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.auth-page .logo a:hover {
  opacity: 0.85;
}

.auth-page .logo img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-page .logo h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--auth-text);
}

.auth-page .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 1rem;
}

.auth-page .nav-links a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--auth-muted);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-page .nav-links a:hover {
  color: var(--auth-blue);
  border-bottom-color: rgba(0, 113, 227, 0.35);
}

/* Zone centrale */
.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5.5rem 1.25rem 2.5rem;
  position: relative;
  overflow: hidden;
}

/* Décor léger (sans gros orbes) */
.auth-container::before {
  content: "";
  position: absolute;
  width: min(100vw, 600px);
  height: min(100vw, 600px);
  top: 10%;
  right: -20%;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.08) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* Carte formulaire */
.auth-box {
  background: var(--auth-surface);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--auth-radius-lg);
  box-shadow: var(--auth-shadow);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}

/* Barre d’accent (connexion + inscription) */
.auth-box--card {
  overflow: hidden;
  padding-top: 2.5rem;
}

.auth-box--card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0071e3 0%, #5ac8fa 45%, #ff9500 100%);
  border-radius: var(--auth-radius-lg) var(--auth-radius-lg) 0 0;
}

/* Formulaire long (inscription) */
.auth-box--wide {
  max-width: 560px;
}

.auth-page--register .auth-container {
  padding-bottom: 3rem;
}

/* Sections du formulaire d’inscription */
.auth-form-section {
  margin-bottom: 0.5rem;
}

.auth-form-section + .auth-form-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.auth-form-section__title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-muted);
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-form-section__title i {
  color: var(--auth-blue);
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Type de compte : cases (radios) */
.auth-role-cards {
  margin: 0;
}

.auth-role-cards__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 420px) {
  .auth-role-cards__grid {
    grid-template-columns: 1fr;
  }
}

.auth-role-card {
  position: relative;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.auth-role-card__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-role-card__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.15rem 0.9rem 1.05rem;
  min-height: 7.5rem;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.2s ease;
}

.auth-role-card:hover .auth-role-card__body {
  border-color: rgba(0, 113, 227, 0.35);
  background: rgba(0, 113, 227, 0.03);
}

.auth-role-card:focus-within .auth-role-card__body {
  box-shadow: 0 0 0 4px var(--auth-blue-ring);
  border-color: rgba(0, 113, 227, 0.45);
}

.auth-role-card__input:checked + .auth-role-card__body {
  border-color: var(--auth-blue);
  background: linear-gradient(180deg, rgba(0, 113, 227, 0.08) 0%, rgba(0, 113, 227, 0.02) 100%);
  box-shadow: 0 2px 12px rgba(0, 113, 227, 0.18);
}

.auth-role-card__input:checked + .auth-role-card__body .auth-role-card__name {
  color: var(--auth-blue);
}

.auth-role-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
  color: var(--auth-muted);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-role-card__input:checked + .auth-role-card__body .auth-role-card__icon {
  color: #fff;
  background: var(--auth-blue);
}

.auth-role-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--auth-text);
  margin-bottom: 0.25rem;
  transition: color 0.2s ease;
}

.auth-role-card__desc {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--auth-muted);
}

.auth-box:hover {
  box-shadow: var(--auth-shadow-hover);
}

/* En-tête */
.auth-header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.auth-header h2,
.auth-box > .auth-header h2,
.auth-box .text-center h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--auth-text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-header h2 i,
.text-center h2 i {
  color: var(--auth-blue);
  font-size: 1.1em;
  opacity: 0.9;
}

.auth-subtitle {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--auth-muted);
  margin: 0;
}

/* Alertes */
.auth-page .auth-box .alert {
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-page .alert-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 0.5px solid rgba(220, 38, 38, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.auth-page .alert-success {
  background: #f0fdf4;
  color: #15803d;
  border: 0.5px solid rgba(22, 163, 74, 0.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

/* Champs — scopés à .auth-page pour ne pas polluer le reste du site */
.auth-page .form-floating {
  margin-bottom: 0;
}

.auth-page .form-floating + .form-floating,
.auth-page .form-floating + .form-check,
.auth-page .form-floating + p,
.auth-page p + .form-floating,
.auth-page .row + .form-floating {
  margin-top: 0.85rem;
}

.auth-page .form-floating > label,
.auth-page .form-floating > .form-control ~ label,
.auth-page .form-floating > .form-select ~ label {
  padding-left: 0.9rem;
  color: var(--auth-muted);
  font-weight: 400;
  font-size: 0.9rem;
}

.auth-page .form-floating .form-control,
.auth-page .form-floating .form-select {
  height: 3.25rem;
  min-height: 3.25rem;
  padding: 0.85rem 0.9rem 0.85rem 0.9rem;
  font-size: 0.95rem;
  line-height: 1.4;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  background: #fff;
  color: var(--auth-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-page .form-floating > .form-control:focus,
.auth-page .form-floating > .form-select:focus,
.auth-page .form-floating > .form-control:not(:placeholder-shown) {
  border-color: rgba(0, 113, 227, 0.55);
  box-shadow: 0 0 0 4px var(--auth-blue-ring);
  outline: none;
}

.auth-page .form-floating .form-control::placeholder {
  color: transparent;
}

.auth-page .form-floating > .form-control:focus ~ label,
.auth-page .form-floating > .form-control:not(:placeholder-shown) ~ label,
.auth-page .form-floating > .form-select ~ label,
.auth-page .form-floating > .form-select:focus ~ label {
  color: var(--auth-blue);
  opacity: 0.9;
}

/* Icônes dans les labels (HTML : label contient <i> + texte) */
.auth-page .form-floating > label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--auth-muted);
}

.auth-page .form-floating > label i {
  color: var(--auth-muted);
  width: 1rem;
  text-align: center;
  font-size: 0.9em;
  flex-shrink: 0;
}

/* Select type de compte (plus lisible) */
.auth-page .form-floating > .form-select {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  line-height: 1.3;
  font-size: 0.85rem;
  cursor: pointer;
  background-color: #fff;
}

/* Mot de passe + œil (structure : .password-field > .form-floating + bouton) */
.auth-page .password-field {
  position: relative;
}

.auth-page .password-field .form-floating {
  width: 100%;
}

.auth-page .password-field .form-control {
  padding-right: 2.75rem;
}

.auth-page .password-toggle {
  position: absolute;
  right: 0.55rem;
  top: 1.65rem;
  background: none;
  border: none;
  color: var(--auth-muted);
  cursor: pointer;
  z-index: 6;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  line-height: 1;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-page .password-toggle:hover {
  color: var(--auth-blue);
  background: rgba(0, 113, 227, 0.06);
}

.auth-page .password-toggle:focus-visible {
  outline: 2px solid var(--auth-blue);
  outline-offset: 2px;
}

/* Validation Bootstrap 5 + nos champs */
.auth-page .form-control.is-invalid,
.auth-page .form-select.is-invalid,
.auth-page .was-validated .form-control:invalid,
.auth-page .was-validated .form-select:invalid {
  border-color: #dc2626;
}

.auth-page .invalid-feedback {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  padding-left: 0.15rem;
}

/* Checkbox + CGU */
.auth-page .form-check {
  padding-left: 0;
  margin-top: 1rem;
  margin-bottom: 0;
}

.auth-page .form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  border: 1.5px solid #d1d1d6;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-page .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--auth-blue-ring);
  border-color: var(--auth-blue);
}

.auth-page .form-check-input:checked {
  background-color: var(--auth-blue);
  border-color: var(--auth-blue);
}

.auth-page .form-check-label {
  margin-left: 0.5rem;
  color: var(--auth-muted);
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

/* Bouton principal */
.btn-auth-submit {
  width: 100%;
  margin-top: 1.35rem;
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(180deg, #0077ed 0%, var(--auth-blue) 100%);
  border: none;
  border-radius: 980px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 113, 227, 0.3);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.btn-auth-submit:hover {
  background: linear-gradient(180deg, #0084ff 0%, var(--auth-blue-hover) 100%);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.35);
  transform: translateY(-1px);
}

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

.btn-auth-submit span,
.btn-auth-submit {
  position: relative;
  z-index: 1;
}

/* Liens sous le formulaire */
.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--auth-muted);
}

.auth-links a {
  color: var(--auth-blue);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-links a:hover {
  color: #0050b3;
  border-bottom-color: rgba(0, 80, 179, 0.3);
}

.auth-page .forgot-password {
  color: var(--auth-muted) !important;
  font-size: 0.85rem;
}

.auth-page .forgot-password:hover {
  color: var(--auth-blue) !important;
}

/* Grille prénom / nom */
.auth-page .row {
  --bs-gutter-x: 0.9rem;
}

/* Anciens onglets (si réutilisés) */
.auth-tab {
  flex: 1;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--light-text);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.auth-form h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--auth-text);
}

/* Responsive */
@media (max-width: 576px) {
  .auth-box {
    padding: 1.5rem 1.25rem;
    border-radius: 18px;
  }

  .auth-header h2,
  .text-center h2 {
    font-size: 1.35rem;
    flex-direction: column;
    gap: 0.35rem;
  }

  .auth-page .nav-links {
    width: 100%;
    justify-content: center;
  }

  .auth-page nav {
    padding: 0.65rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-box {
    transition: none;
  }

  .btn-auth-submit:hover {
    transform: none;
  }
}

/* ——— Formulaires hors page auth (ex. profil) ——— */
.form-rich .form-label {
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  color: var(--auth-muted, #6e6e73);
  margin-bottom: 0.4rem;
}

.form-rich .form-control,
.form-rich .form-select {
  border-radius: var(--auth-radius, 14px);
  border: 1px solid var(--auth-border, rgba(0, 0, 0, 0.1));
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

.form-rich .form-control:focus,
.form-rich .form-select:focus {
  border-color: rgba(0, 113, 227, 0.55);
  box-shadow: 0 0 0 4px var(--auth-blue-ring, rgba(0, 113, 227, 0.22));
  outline: none;
}

.form-rich .btn.btn-primary,
.form-rich button.btn-primary {
  border-radius: 980px;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #0077ed 0%, var(--auth-blue, #0071e3) 100%);
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.form-rich .btn.btn-primary:hover {
  background: linear-gradient(180deg, #0084ff 0%, #0077ed 100%);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
}

.form-rich .alert {
  border-radius: 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
}
