/* ==========================================================================
   ESM — Page de connexion
   Feuille de style autonome (la page login n'étend pas base/base.html).
   Palette : accent turquoise Gentelella (#1ABB9C). Thème sombre par défaut
   (défini via data-theme="dark" sur <html>), thème clair disponible.
   Polices auto-hébergées : Montserrat (display) + Open Sans (body).
   ========================================================================== */

/* ===== Polices auto-hébergées (variables, sous-ensemble latin) ===== */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/login/open-sans.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/login/montserrat.woff2') format('woff2');
}

/* ===== Variables de thème ===== */
:root {
  --accent: #1ABB9C;
  --accent-dark: #169F85;
  --accent-soft: rgba(26, 187, 156, 0.1);
  --navy: #2A3F54;
  --text: #2A3F54;
  --text-muted: #73879C;
  --bg: #F7F7F7;
  --card: #FFFFFF;
  --border: #E6E9ED;
  --border-input: #CCD0D7;
  --danger: #E74C3C;
  --shadow: 0 10px 40px rgba(42, 63, 84, 0.08);
  --shadow-lg: 0 20px 60px rgba(42, 63, 84, 0.12);
  --font-body: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-display: 'Montserrat', 'Open Sans', sans-serif;
}

[data-theme="dark"] {
  --text: #ECF0F1;
  --text-muted: #95A5A6;
  --bg: #1B2836;
  --card: #243444;
  --border: #334B63;
  --border-input: #3C576F;
  --navy: #ECF0F1;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.stage {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ========== PANNEAU GAUCHE (formulaire) ========== */
.panel-form {
  flex: 0 0 480px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  padding: 48px 56px 28px;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(-8px);
  animation: fadeSlideIn 0.7s 0.1s ease-out forwards;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
  color: var(--navy);
}

.form-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}

.form-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
  letter-spacing: -0.2px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideIn 0.6s 0.25s ease-out forwards;
}

.form-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 32px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideIn 0.6s 0.35s ease-out forwards;
}

/* Alerte d'erreur (identifiants invalides, verrouillage axes, etc.) */
.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--danger);
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 22px;
  opacity: 0;
  animation: fadeSlideIn 0.5s ease-out forwards;
}
.form-alert .fa { margin-top: 2px; }
.form-alert ul { margin: 0; padding-left: 16px; }

.form-group-custom {
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideIn 0.6s ease-out forwards;
}
.form-group-custom:nth-of-type(1) { animation-delay: 0.45s; }
.form-group-custom:nth-of-type(2) { animation-delay: 0.55s; }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--border-input);
  border-radius: 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-shell.focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-shell.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
  animation: shake 0.35s ease;
}
.input-shell .input-icon {
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 14px;
}
.input-shell.focused .input-icon { color: var(--accent); }
.input-shell input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 12px 0;
  font-size: 14px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  min-width: 0;
}
.input-shell input::placeholder { color: var(--text-muted); opacity: 0.7; }

.toggle-eye {
  background: none;
  border: 0;
  padding: 0 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s ease;
}
.toggle-eye:hover { color: var(--accent); }

.field-error {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 6px;
}

.form-extras {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideIn 0.6s 0.65s ease-out forwards;
}

.checkbox-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.checkbox-custom input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-input);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  margin: 0;
}
.checkbox-custom input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-custom input:checked::after {
  content: '\2713';
  position: absolute;
  top: -2px;
  left: 2px;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.help-link .contact { color: var(--accent); font-weight: 600; }

.btn-submit {
  width: 100%;
  padding: 13px 16px;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 14px rgba(26, 187, 156, 0.35);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideIn 0.6s 0.75s ease-out forwards;
}
.btn-submit:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 187, 156, 0.45);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit.loading { pointer-events: none; opacity: 0.85; }
.btn-submit .spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .btn-label { display: none; }

.divider {
  text-align: center;
  margin: 28px 0 18px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  opacity: 0;
  animation: fadeSlideIn 0.6s 0.85s ease-out forwards;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.help-link {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0;
  animation: fadeSlideIn 0.6s 0.95s ease-out forwards;
}
.help-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.help-link a:hover { text-decoration: underline; }

.footer-copyright {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 20px;
  letter-spacing: 0.3px;
  opacity: 0;
  animation: fadeSlideIn 0.6s 1.1s ease-out forwards;
}

/* ========== PANNEAU DROIT (visuel) ========== */
.panel-visual {
  flex: 1;
  background: linear-gradient(135deg, #2A3F54 0%, #1F2F40 60%, #172432 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 72px;
  color: white;
}
[data-theme="dark"] .panel-visual {
  background: linear-gradient(135deg, #0F1A24 0%, #0A1118 100%);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
}

.bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 187, 156, 0.2) 0%, transparent 70%);
  top: -150px;
  right: -150px;
  filter: blur(40px);
  animation: drift 14s ease-in-out infinite alternate;
}
.bg-glow.g2 {
  top: auto;
  bottom: -200px;
  right: auto;
  left: -150px;
  background: radial-gradient(circle, rgba(26, 187, 156, 0.12) 0%, transparent 70%);
  animation-duration: 18s;
}

.visual-content { position: relative; z-index: 2; max-width: 620px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(26, 187, 156, 0.15);
  border: 1px solid rgba(26, 187, 156, 0.35);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideIn 0.8s 0.5s ease-out forwards;
}
.tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 18px;
  letter-spacing: -1px;
  opacity: 0;
  transform: translateY(14px);
  animation: fadeSlideIn 0.9s 0.65s ease-out forwards;
}
.hero-title .accent-word { color: var(--accent); }

.hero-sub {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.7);
  max-width: 480px;
  margin: 0 0 42px;
  opacity: 0;
  animation: fadeSlideIn 0.8s 0.8s ease-out forwards;
}

/* Atouts produit (remplacent les cartes de métriques) */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeSlideIn 0.7s ease-out forwards;
}
.feature-item:nth-child(1) { animation-delay: 0.95s; }
.feature-item:nth-child(2) { animation-delay: 1.05s; }
.feature-item:nth-child(3) { animation-delay: 1.15s; }

.feature-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(26, 187, 156, 0.15);
  border: 1px solid rgba(26, 187, 156, 0.3);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.feature-text h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: white;
  margin: 0 0 3px;
}
.feature-text p {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.footer-visual {
  position: absolute;
  bottom: 32px;
  left: 72px;
  right: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  z-index: 2;
  opacity: 0;
  animation: fadeSlideIn 0.8s 1.3s ease-out forwards;
}
.footer-visual .dot-sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
  margin: 0 10px;
  vertical-align: middle;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeSlideIn { to { opacity: 1; transform: translateY(0); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.6; }
}
@keyframes drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-40px, 30px); }
}

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .brand, .form-title, .form-subtitle, .form-group-custom, .form-extras,
  .btn-submit, .divider, .help-link, .footer-copyright, .tag, .hero-title,
  .hero-sub, .feature-item, .footer-visual, .form-alert {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 960px) {
  html, body { overflow: auto; }
  .stage { flex-direction: column; overflow: auto; height: auto; min-height: 100vh; }
  .panel-form { flex: none; width: 100%; padding: 32px 28px; }
  .brand { margin-bottom: 28px; }
  .form-wrap { justify-content: flex-start; }
  .panel-visual { min-height: 440px; padding: 48px 32px 80px; }
  .footer-visual { left: 32px; right: 32px; bottom: 20px; }
  .hero-title { font-size: 32px; }
}
