/* 📑 1. VARIABLES & DESIGN TOKENS */
:root {
  --color-navy:        #163B66;
  --color-navy-deep:   #0D2644;
  --color-navy-soft:   #2A6BB0;
  --color-navy-tint:   #EAF1FA;
  --color-orange:      #FF7A00;
  --color-orange-deep: #CC6200;
  --color-orange-tint: #FFF3E6;
  --color-off-white:   #F8FAFC;
  --color-white:       #FFFFFF;
  --color-gray-soft:   #64748B;
  --color-gray-light:  #CBD5E1;
  --border-default:    #E2E8F0;
  --bg-page:           #F1F5F9;
  --bg-surface:        #FFFFFF;
  --text-primary:      #0D2644;
  --text-muted:        #64748B;
  
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --radius-md:  10px;
  --radius-xl:  16px;
  --radius-full: 9999px; /* 👑 Sécurité : Ajout du token manquant */
  --font-brand: 'Sora', sans-serif;
  --font-ui:    'Poppins', sans-serif;
}

/* 📑 2. RESET BASE HTML */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 📑 3. HEADER MINIMALISTE */
.register-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--border-default);
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 64px;
}

.btn-back {
  position: absolute;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.2s ease;
}

.btn-back:hover {
  color: var(--color-navy);
  transform: translateX(-2px);
}

.btn-back .material-icons-round {
  font-size: 20px;
}
.brand-logo-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}
.brand-logo-img { height: 28px; width: auto; }
.brand-name { font-family: var(--font-brand); font-weight: 700; font-size: 18px; color: var(--text-primary); }
.brand-name span { color: var(--color-orange); }

/* 📑 4. CONTENEUR PRINCIPAL & CARTE */
.register-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px var(--space-4);
}
.register-card {
  background: var(--bg-surface);
  width: 100%;
  max-width: 440px;
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: 0 20px 40px rgba(13, 38, 68, 0.06);
}

.card-title {
  font-family: var(--font-brand); font-size: 24px; font-weight: 700;
  margin-bottom: var(--space-2); text-align: center;
}
.card-subtitle {
  color: var(--text-muted); font-size: 14px; text-align: center; margin-bottom: var(--space-8);
}

/* 📑 5. STRUCTURE DU FORMULAIRE */
.form-group { margin-bottom: var(--space-4); }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: var(--space-2); color: var(--text-primary); }

.form-control {
  width: 100%; padding: 12px 16px; font-family: var(--font-ui); font-size: 14px;
  background: var(--color-off-white); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); color: var(--text-primary); transition: all 0.2s ease-in-out; outline: none;
}
.form-control:focus { border-color: var(--color-orange); background: var(--color-white); box-shadow: 0 0 0 3px var(--color-orange-tint); }

/* 🔐 COMPOSANT DE SÉCURITÉ : ENVELOPPE SÉCURISÉE DES INPUTS MOT DE PASSE */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper .form-control {
  padding-right: 44px; /* Laisse de la place à droite pour bloquer les superpositions */
}

/* 👁️ SÉCURITÉ MAXIMUM RENDU UNIQUE DE L'ŒIL (FUSIONNÉ & NETTOYÉ) */
.toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Material Icons Round' !important;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  user-select: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease;
  
  /* Coupe radicalement le texte brut "visibility_off" avant le rendu final */
  width: 20px;
  height: 20px;
  overflow: hidden;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'liga';
  z-index: 2;
}

.toggle-password:hover {
  color: var(--color-orange);
}

.btn-submit {
  width: 100%; padding: 14px; background: var(--color-orange); color: var(--color-white);
  border: none; border-radius: var(--radius-md); font-family: var(--font-ui);
  font-weight: 600; font-size: 15px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: var(--space-2); margin-top: var(--space-6); transition: background 0.2s ease;
}
.btn-submit:hover { background: var(--color-orange-deep); }

.card-footer-link { text-align: center; margin-top: var(--space-6); font-size: 13px; color: var(--text-muted); }
.card-footer-link a { color: var(--color-navy-soft); font-weight: 600; text-decoration: none; }
.card-footer-link a:hover { text-decoration: underline; }

/* ── STYLES COMPOSANT : ONGLETS (TABS) ── */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-gray-light);
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding-bottom: var(--space-3);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: color 0.2s ease;
}

.tab-btn:hover {
  color: var(--color-navy);
}

.tab-btn.active {
  color: var(--color-navy);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-orange);
  border-radius: var(--radius-full);
}

/* Gestion de l'affichage des formulaires */
.auth-form-content {
  display: none;
}

.auth-form-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── STYLES COMPOSANT : MODAL OVERLAY (MOT DE PASSE OUBLIÉ) ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(13, 38, 68, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-out;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  width: 90%;
  max-width: 400px;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s ease-out;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--color-off-white);
  border: none;
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.modal-header-icon {
  width: 48px; height: 48px;
  background: var(--color-orange-tint);
  color: var(--color-orange);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-4) auto;
}

/* Customisation Icône de la modale de récupération */
#forgotModal .modal-header-icon {
  background: rgba(22, 59, 102, 0.1) !important;
  color: var(--color-navy) !important;
}

.modal-title { font-family: var(--font-brand); font-size: 20px; font-weight: 700; text-align: center; margin-bottom: var(--space-2); }
.modal-desc { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: var(--space-6); line-height: 1.5; }

/* Petit texte explicatif d'aide sous l'input Email */
.form-helper-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
  font-weight: 400;
}

/* ── STYLES COMPOSANT : ALERTES D'ERREUR ── */
.alert-error {
  background: #FEF2F2;
  color: #DC2626;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: var(--space-4);
  border: 1px solid #FCA5A5;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* 📑 6. RESPONSIVE MEDIA QUERIES */
@media (max-width: 480px) {
  .register-container { padding: var(--space-4) var(--space-2); }
  .register-card { border: none; box-shadow: none; background: transparent; }
  .btn-back span { display: none; }
  .register-header { padding: 16px; }
  .btn-back { left: 16px; }
  .form-helper-text { font-size: 10.5px; }
}