/* ==========================================================================
   auth.css — Système de Design des Pages d'Authentification CODALYX
   =========================================================================
   Ce fichier étend style.css sans le modifier.
   Il reprend exactement les variables CSS de la charte graphique CODALYX :
   - Palette Material 3 (light / dark)
   - Typographie Outfit / Inter
   - Radius, shadows, glassmorphism
   - Toggle thème (soleil / lune) identique au site principal
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────────
   LAYOUT GLOBAL
   ────────────────────────────────────────────────────────────────────────── */

.auth-body {
  /* Surcharge le body de style.css qui force height:100vh overflow:hidden */
  height: auto !important;
  min-height: 100vh !important;
  overflow: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--bg-color) !important;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background 0.3s ease, color 0.3s ease;
  padding: 40px 20px;
}

/* Fond animé subtil — bulle gradient */
.auth-body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -20%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: auth-float 12s ease-in-out infinite;
}

.auth-body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: auth-float 16s ease-in-out infinite reverse;
}

@keyframes auth-float {
  0%, 100% { transform: translate(0, 0) scale(1);    }
  33%       { transform: translate(3%, 4%) scale(1.04); }
  66%       { transform: translate(-2%, 2%) scale(0.97); }
}

/* ──────────────────────────────────────────────────────────────────────────
   WRAPPER ET CARTE
   ────────────────────────────────────────────────────────────────────────── */

.auth-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 440px;
}

.auth-card {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 40px 36px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: card-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   LOGO
   ────────────────────────────────────────────────────────────────────────── */

.auth-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-logo-wrap a {
  display: inline-flex;
  transition: opacity 0.2s ease;
}

.auth-logo-wrap a:hover {
  opacity: 0.8;
}

.auth-logo {
  height: 70px;
  width: auto;
  object-fit: contain;
  display: block;
  /* Synchronisation logo clair/sombre */
  transition: opacity 0.3s ease;
}

/* ──────────────────────────────────────────────────────────────────────────
   EN-TÊTE (TITRE + SOUS-TITRE)
   ────────────────────────────────────────────────────────────────────────── */

.auth-header {
  text-align: center;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin: 0;
}

/* ──────────────────────────────────────────────────────────────────────────
   PRÉSENTATION CODALYX (PITCH)
   ────────────────────────────────────────────────────────────────────────── */

.auth-pitch {
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: card-enter 0.5s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-theme="dark"] .auth-pitch {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
}

.auth-pitch::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 3px; height: 100%;
  background: linear-gradient(to bottom, var(--m3-primary), var(--accent));
  border-radius: 3px 0 0 3px;
}

.pitch-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}

.pitch-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.pitch-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.pitch-cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: var(--bg-color);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.pitch-cta .sparkle {
  font-size: 1rem;
  line-height: 1;
}

/* ──────────────────────────────────────────────────────────────────────────
   MESSAGES D'ÉTAT
   ────────────────────────────────────────────────────────────────────────── */

.auth-message {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  font-weight: 500;
  animation: msg-enter 0.25s ease both;
}

@keyframes msg-enter {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.auth-message--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.auth-message--success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.auth-message--info {
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent);
}

/* ──────────────────────────────────────────────────────────────────────────
   FORMULAIRE ET CHAMPS
   ────────────────────────────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  z-index: 2;
  line-height: 1;
}

.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 42px;
  font-size: 0.95rem;
  font-family: 'Outfit', 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  caret-color: var(--accent);
}

.auth-input::placeholder {
  color: var(--m3-outline);
  opacity: 0.7;
}

.auth-input:hover {
  border-color: var(--m3-outline);
}

.auth-input:focus {
  border-color: var(--m3-primary);
  box-shadow: var(--focus-glow);
}

/* Bouton affichage/masquage mot de passe */
.auth-input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  color: var(--m3-outline);
  transition: color 0.2s ease;
  z-index: 2;
}

.auth-input-toggle:hover {
  color: var(--accent);
}

/* Lien "Mot de passe oublié" */
.auth-forgot {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.auth-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.auth-link:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* ──────────────────────────────────────────────────────────────────────────
   JAUGE DE COMPLEXITÉ MOT DE PASSE
   ────────────────────────────────────────────────────────────────────────── */

.pwd-strength {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.pwd-strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.35s ease, background 0.35s ease;
}

.pwd-strength-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.35s ease;
}

/* ──────────────────────────────────────────────────────────────────────────
   BOUTONS D'ACTION
   ────────────────────────────────────────────────────────────────────────── */

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Outfit', 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
}

/* Bouton primaire (action principale) */
.auth-btn--primary {
  background: linear-gradient(135deg, var(--m3-primary) 0%, var(--accent) 100%);
  color: var(--m3-on-primary);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.auth-btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
  filter: brightness(1.06);
}

.auth-btn--primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.auth-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Bouton secondaire (action alternative) */
.auth-btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

.auth-btn--secondary:hover {
  background: var(--m3-surface-container);
  border-color: var(--m3-outline);
  transform: translateY(-1px);
}

/* Flèche animée dans le bouton primaire */
.btn-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}

.auth-btn--primary:hover .btn-arrow {
  transform: translateX(4px);
}

/* ──────────────────────────────────────────────────────────────────────────
   SÉPARATEUR
   ────────────────────────────────────────────────────────────────────────── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 400;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ──────────────────────────────────────────────────────────────────────────
   BOUTON TOGGLE THÈME (Identique au site principal)
   ────────────────────────────────────────────────────────────────────────── */

.auth-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--m3-surface-container);
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-premium);
}

.auth-theme-toggle:hover {
  background: var(--bg-color);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.15);
}

/* ──────────────────────────────────────────────────────────────────────────
   SIGNATURE "made with love" + drapeau
   ────────────────────────────────────────────────────────────────────────── */

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.8;
  animation: card-enter 0.6s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-heart {
  font-size: 1rem;
  animation: heartbeat 1.4s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  30%       { transform: scale(1.18); }
  60%       { transform: scale(1.1); }
}

/* Drapeau tricolore — bandes verticales */
.auth-flag {
  display: inline-flex;
  align-items: center;
  height: 14px;
  width: 22px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
  gap: 0;
}

.flag-band {
  display: block;
  height: 100%;
  flex: 1;
}

.flag-band--blue  { background: #0055A4; }
.flag-band--white { background: #FFFFFF; }
.flag-band--red   { background: #EF4135; }

/* ──────────────────────────────────────────────────────────────────────────
   LOGOUT BUTTON (sur index.html)
   ────────────────────────────────────────────────────────────────────────── */

#logoutBtn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  height: 36px;
  padding: 0 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'Outfit', 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#logoutBtn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* ──────────────────────────────────────────────────────────────────────────
   BADGE UTILISATEUR (sur index.html)
   ────────────────────────────────────────────────────────────────────────── */

#userBadge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 12px;
  background: var(--m3-surface-container);
  border-radius: 20px;
  border: 1px solid var(--border);
  max-width: 200px;
  overflow: hidden;
}

#userBadge .user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* ──────────────────────────────────────────────────────────────────────────
   ÉCRAN DE GARDE (index.html — pendant la vérification de session)
   ────────────────────────────────────────────────────────────────────────── */

#authGuard {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.3s ease;
}

#authGuard.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
    border-radius: var(--radius-sm);
  }

  .auth-title {
    font-size: 1.35rem;
  }

  .auth-input {
    height: 44px;
  }

  .auth-btn {
    height: 46px;
  }
}
