/* --- RESET & BASICS --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(
      135deg,
      rgba(102, 126, 234, 0.85) 0%,
      rgba(118, 75, 162, 0.85) 100%
    ),
    url("../../images/montagne.avif");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* --- ANIMATION DE FOND --- */
body::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  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%);
  animation: moveBackground 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes moveBackground {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-3%, -3%); }
}

/* --- CARTE DE CONNEXION --- */
.container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  width: 100%;
  max-width: 450px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 30px;
  text-align: center;
  color: white;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.form-content {
  padding: 40px;
}

/* --- FORMULAIRE --- */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.input-group input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
}

/* Password Toggle */
.password-wrapper {
  position: relative;
  width: 100%;
}

.password-toggle {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #666;
  z-index: 10;
}

/* Options & Bouton */
.remember-forgot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  font-size: 14px;
}

.remember-me {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: #666;
  gap: 10px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

/* Divider & Footer */
.divider {
  text-align: center;
  margin: 25px 0;
  color: #999;
  position: relative;
}

.divider::before, .divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e1e8ed;
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.register-link { text-align: center; font-size: 14px; }
.register-link a { color: #667eea; font-weight: 600; text-decoration: none; }

.error-message {
  background-color: #ffe0e0;
  border: 1px solid #b00020;
  color: #b00020;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  display: none; /* JS l'affichera au besoin */
  text-align: center;
}

/* ========================================== */
/* ========== RESPONSIVE DESIGN ============ */
/* ========================================== */

/* --- Tablettes --- */
@media (max-width: 768px) {
  .container {
    max-width: 400px;
  }
}

/* --- Mobiles --- */
@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .form-content {
    padding: 30px 20px;
  }

  .header {
    padding: 30px 20px;
  }

  /* Évite le zoom auto sur iPhone */
  .input-group input {
    font-size: 16px;
  }

  .remember-forgot {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
}

/* --- Mode Paysage (Mobile) --- */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    align-items: flex-start;
    padding: 20px;
  }
}

/* --- FIX CONFLIT ICÔNES (MOBILE) --- */

/* 1. Cache l'œil natif de Microsoft (Edge/IE) */
input::-ms-reveal,
input::-ms-clear {
  display: none !important;
}

/* 2. Cache l'icône "Clé" ou "Contacts" de Chrome/Safari (Webkit) */
input::-webkit-contacts-auto-fill-button,
input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  position: absolute;
  right: 0;
}

/* 3. Ajustement de ton champ de saisie */
/* On laisse de la place à droite pour ton icône, pour pas que le texte passe dessous */
.input-group input[type="password"],
.input-group input[type="text"] { 
  padding-right: 45px !important; 
}

/* 4. On s'assure que TON icône gagne la bataille */
.password-toggle {
  z-index: 100;           /* Passe au-dessus de tout */
  background: transparent; /* Fond transparent */
  right: 15px;            /* Position */
}

/* --- STYLE POUR LA PAGE NOUVEAU MOT DE PASSE --- */

.error-msg {
    background-color: #fee2e2; /* Fond rouge très clair */
    color: #991b1b;           /* Texte rouge foncé */
    border: 1px solid #f87171;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    animation: shake 0.5s ease-in-out; /* Petite animation sympa */
}

/* Petite animation qui secoue la box en cas d'erreur */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

