@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.page-wrapper {
  display: flex;
  max-width: 1100px;
  width: 100%;
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  min-height: 520px;
}

/* Messages généraux */
.message {
  display: none; /* caché par défaut */
  padding: 12px 20px;
  margin-bottom: 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s ease forwards;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Liens à l'intérieur des messages */
.message a {
  color: #2a7fff; /* bleu un peu pastel */
  text-decoration: underline;
  font-weight: 700;
  transition: color 0.2s ease;
}

.message a:hover {
  color: #1a5dcc; /* bleu plus foncé au hover */
}

/* Message de succès */
.success {
  background-color: #e6ffed;       /* vert très clair */
  border-left: 5px solid #2d7a37;  /* bordure verte */
  color: #2d7a37;                   /* texte vert foncé */
}

/* Message d'erreur */
.error {
  background-color: #ffe6e6;       /* rose très clair */
  border-left: 5px solid #e74c3c;  /* bordure rouge vif */
  color: #b71c1c;                   /* rouge foncé */
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
}

/* Icônes pour messages */
/* Exemple : tu peux remplacer le background-image par un SVG ou PNG inline */
.success::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url('https://img.icons8.com/fluency/24/2d7a37/checkmark.png');
  background-size: contain;
  background-repeat: no-repeat;
}

.error::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url('https://img.icons8.com/fluency/24/e74c3c/error.png');
  background-size: contain;
  background-repeat: no-repeat;
}

/* Animation fadeIn */
@keyframes fadeIn {
  from {opacity: 0; transform: translateY(-10px);}
  to {opacity: 1; transform: translateY(0);}
}

/* Conteneur général */
.errorsandsuccess {
  display: flex;          /* flex pour aligner correctement les messages */
  flex-direction: column; /* empile les messages si plusieurs */
  gap: 12px;              /* espace entre les messages */
  margin-bottom: 20px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease forwards;
}

/* Message de succès */
.errorsandsuccess .success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 6px;
  background-color: #e6ffed;       /* vert très clair */
  border-left: 5px solid #2d7a37;  /* bordure verte */
  color: #2d7a37;                   /* texte vert foncé */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.errorsandsuccess .success::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url('https://img.icons8.com/fluency/24/2d7a37/checkmark.png');
  background-size: contain;
  background-repeat: no-repeat;
}

/* Message d'erreur */
.errorsandsuccess .error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 6px;
  background-color: #ffe6e6;       /* rose très clair */
  border-left: 5px solid #e74c3c;  /* bordure rouge vif */
  color: #b71c1c;                   /* rouge foncé */
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
}

.errorsandsuccess .error::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url('https://img.icons8.com/fluency/24/e74c3c/error.png');
  background-size: contain;
  background-repeat: no-repeat;
}

/* Liens à l'intérieur des messages */
.errorsandsuccess a {
  color: #2a7fff;       /* bleu pastel */
  text-decoration: underline;
  font-weight: 700;
  transition: color 0.2s ease;
}

.errorsandsuccess a:hover {
  color: #1a5dcc;       /* bleu foncé au hover */
}

/* Animation fade-in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section accueil à gauche */
.welcome-section {
  flex: 1.3;
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 4rem;
}

.welcome-content h1 {
  font-weight: 700;
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.welcome-content p {
  font-size: 1.2rem;
  line-height: 1.5;
  max-width: 320px;
  margin-bottom: 3rem;
  user-select: none;
}

/* Image illustration */
.welcome-illustration {
  max-width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

/* Section login à droite */
.login-section {
  flex: 1;
  background: #fff;
  padding: 3rem 3rem 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.logo img {
  width: 110px;
  margin-bottom: 2rem;
  user-select: none;
}

.login-title {
  font-weight: 700;
  font-size: 1.8rem;
  margin-bottom: 2rem;
  color: #111827;
  user-select: none;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  text-align: left;
}

.login-form label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #4b5563;
  user-select: none;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.3);
  outline: none;
}

.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px; /* espace pour l’œil */
  box-sizing: border-box;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #888;
  transition: color 0.2s ease;
  font-size: 1.1rem;
}

.toggle-password:hover {
  color: #000;
}

.form-options {
  display: block; /* passe de flex à block */
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}

.checkbox-label {
  display: block;
  cursor: pointer;
  color: #4b5563;
  user-select: none;
  margin-bottom: 1em;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
}

.forgot-link {
  color: #2563eb;
  text-decoration: none;
  user-select: none;
}

.forgot-link:hover,
.forgot-link:focus {
  text-decoration: underline;
}

.btn-primary {
  background-color: #2563eb;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 14px 0;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
  user-select: none;
  width: 100%;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #1e40af;
  box-shadow: 0 0 20px rgba(30, 64, 175, 0.7);
  outline: none;
}

/* Separator */
.separator {
  margin: 2rem 0 1.5rem;
  position: relative;
  font-weight: 600;
  color: #6b7280;
  font-size: 1rem;
  user-select: none;
  text-align: center;
}

.separator::before,
.separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1.5px;
  background-color: #e5e7eb;
  transform: translateY(-50%);
  border-radius: 5px;
}

.separator::before {
  left: 0;
}

.separator::after {
  right: 0;
}

.separator span {
  background: #fff;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

.social-login-wrapper {
  position: relative;
  width: 260px; /* largeur juste suffisante pour 3 icônes + espace */
  margin: 0 auto 30px;
  padding: 20px 0;
}

.social-login {
  display: flex;
  align-items: center;
  justify-content: space-between; /* espace entre les 3 logos */
  gap: 0; /* on gère avec space-between */
  position: relative;
  z-index: 2; /* au-dessus de la barre */
}

.social-login-wrapper::before {
  content: "";
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  background-color: #ccc;
  z-index: 1; /* sous les icônes */
}

.btn-social {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.btn-social img {
  width: 24px !important;
  height: 24px !important;
  user-select: none;
  pointer-events: none;
  display: block;
  transition: transform 0.3s ease;
}

.btn-social:hover img {
  transform: scale(1.2);
}

/* Signup text */
.signup-text {
  margin-top: 2.5rem;
  font-size: 0.9rem;
  color: #6b7280;
  user-select: none;
  text-align: center;
}

.signup-text a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.signup-text a:hover,
.signup-text a:focus {
  text-decoration: underline;
}

/* Footer */
.login-footer {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: #9ca3af;
  user-select: none;
  text-align: center;
}

.login-footer a {
  color: #9ca3af;
  text-decoration: none;
}

.login-footer a:hover,
.login-footer a:focus {
  text-decoration: underline;
  color: #2563eb;
}

/* Loading Spinner */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 1000;
}

#loading-overlay {
  display: none; /* caché par défaut */
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 900px) {
  .page-wrapper {
    flex-direction: column;
    min-height: auto;
    box-shadow: none;
    border-radius: 0;
  }

  .welcome-section {
    padding: 2rem;
    flex: none;
    order: 2;
    text-align: center;
  }

  .welcome-content h1 {
    font-size: 2rem;
  }

  .welcome-content p {
    max-width: 100%;
    margin-bottom: 1.5rem;
  }

  .welcome-illustration {
    max-width: 220px;
    margin: 0 auto;
  }

  .login-section {
    flex: none;
    padding: 2rem;
    order: 1;
    display: flex;
    justify-content: center;
  }

  .login-box {
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .page-wrapper {
    flex-direction: column;
    min-height: auto;
    box-shadow: none;
    border-radius: 0;
  }

  .welcome-section {
    padding: 2rem;
    flex: none;
    order: 2;
    text-align: center;
  }

  .welcome-content h1 {
    font-size: 2rem;
  }

  .welcome-content p {
    max-width: 100%;
    margin-bottom: 1.5rem;
  }

  .welcome-illustration {
    max-width: 220px;
    margin: 0 auto;
  }

  .login-section {
    flex: none;
    padding: 2rem;
    order: 1;
    display: flex;
    justify-content: center;
  }

  .login-box {
    max-width: 100%;
  }
}