/**
 * Pages auth autonomes (connexion, réinitialisation MDP, activation compte)
 * — même base visuelle : formulaire à gauche, panneau IAMI à droite.
 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}

/* Section gauche - Formulaire */
.login-form-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--bg-primary);
  overflow-y: auto;
  position: relative;
  z-index: 2;
}

.login-form-container {
  width: 100%;
  max-width: 420px;
  animation: fadeInLeft 0.6s ease-out;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.login-form-header {
  margin-bottom: 2.5rem;
}

.login-form-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.login-form-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Bloc utilisateur (reset / activation) */
.auth-user-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-user-info strong {
  color: var(--text-primary);
  font-size: 1.05rem;
  display: block;
}

.auth-user-info .auth-user-email {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.35rem;
  display: block;
}

/* Messages flash */
.flash-messages {
  margin-bottom: 1.5rem;
}

.flash-message {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.flash-error,
.flash-danger {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
  color: var(--danger-color);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.flash-success {
  background: linear-gradient(135deg, rgba(75, 181, 67, 0.1) 0%, rgba(75, 181, 67, 0.05) 100%);
  color: var(--success-color);
  border: 1px solid rgba(75, 181, 67, 0.2);
}

.flash-info {
  background: linear-gradient(135deg, rgba(23, 162, 184, 0.1) 0%, rgba(23, 162, 184, 0.05) 100%);
  color: var(--info-color);
  border: 1px solid rgba(23, 162, 184, 0.2);
}

.flash-warning {
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.12) 0%, rgba(243, 156, 18, 0.05) 100%);
  color: var(--warning-color);
  border: 1px solid rgba(243, 156, 18, 0.25);
}

/* Encadré règles MDP — aligné sur .flash-info */
.auth-info-box {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(23, 162, 184, 0.1) 0%, rgba(23, 162, 184, 0.05) 100%);
  color: var(--info-color);
  border: 1px solid rgba(23, 162, 184, 0.2);
}

.auth-info-box i {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.form-group .field-error {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.35rem;
}

/* Formulaire */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group label i {
  color: var(--primary-color);
  font-size: 0.9rem;
}

.input-wrapper {
  position: relative;
}

.input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 1;
  transition: color 0.3s ease;
}

.form-group input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: 2px solid var(--input-border);
  border-radius: 12px;
  font-size: 1rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.form-group input:focus ~ i,
.form-group input:not(:placeholder-shown) ~ i {
  color: var(--primary-color);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* Bouton principal */
.btn-login {
  width: 100%;
  padding: 1rem 1.5rem;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-login:hover::before {
  left: 100%;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login i {
  font-size: 1.1rem;
}

/* Section droite - Visuel */
.login-visual-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
  padding: 3rem;
}

.login-visual-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.login-visual-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
  animation: fadeInRight 0.6s ease-out;
  max-width: 500px;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.logo-container {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
}

.logo-container img {
  max-height: 150px;
  max-width: 350px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
}

.logo-container img:hover {
  transform: scale(1.05);
}

.visual-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.visual-logo img {
  height: 2.5rem;
  width: auto;
  display: block;
  object-fit: contain;
}

.visual-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  color: white;
  letter-spacing: -0.5px;
}

.visual-subtitle {
  font-size: 1.25rem;
  font-weight: 400;
  opacity: 0.95;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.client-name {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: inline-block;
  backdrop-filter: blur(10px);
}

.visual-features {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, background 0.3s ease;
}

.feature-item:hover {
  transform: translateX(5px);
  background: rgba(255, 255, 255, 0.15);
}

.feature-item i {
  font-size: 1.5rem;
  width: 40px;
  text-align: center;
}

.feature-item span {
  font-size: 1rem;
  font-weight: 500;
}

@media (max-width: 968px) {
  body {
    flex-direction: column;
  }

  .login-form-section {
    flex: none;
    min-height: auto;
    padding: 2rem 1.5rem;
  }

  .login-visual-section {
    flex: none;
    min-height: 40vh;
    padding: 2rem 1.5rem;
  }

  .visual-logo img {
    height: 2rem;
  }

  .visual-title {
    font-size: 2rem;
  }

  .visual-subtitle {
    font-size: 1.1rem;
  }

  .logo-container img {
    max-height: 100px;
    max-width: 250px;
  }

  .visual-features {
    margin-top: 2rem;
    gap: 1rem;
  }

  .feature-item {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 480px) {
  .login-form-header h1 {
    font-size: 1.75rem;
  }

  .visual-logo img {
    height: 1.75rem;
  }

  .visual-title {
    font-size: 1.75rem;
  }

  .visual-subtitle {
    font-size: 1rem;
  }
}

.btn-login.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-login.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

[data-theme="dark"] .login-visual-section {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
