:root {
  --primary-color: #159455;
  --primary-hover: #0e703e;
  --secondary-color: #5ecc7f;
  --secondary-hover: #4ca36b;
  --error-color: #ff4d4d;
  --text-color: #333;
  --light-text: #555;
  --border-color: #ddd;
  --white: #fff;
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Conteneur principal */
.login-container {
  display: flex;
  height: 100vh;
  animation: fadeIn 0.8s ease-out;
}

/* Logo avec animation */
.logo-container {
  position: fixed;
  top: 10px;
  left: 5%;
  transform: translateX(-50%);
  z-index: 10;
  animation: slideUp 0.6s 0.2s both;
}

.logo {
  width: 120px;
  border-radius: 50%;
  object-fit: cover;
  transition: var(--transition);
  border: 2px solid rgba(0, 0, 0, 0.2); /* Bordure semi-transparente */
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.3), /* Contour noir fin (intérieur) */
    0 10px 15px rgba(0, 0, 0, 0.1); /* Ombre portée extérieure */
  position: relative;
  top: 10px;
  right: 60px;
  z-index: 100; /* Assure qu'il reste au-dessus des autres éléments */
}

.logo:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Section de connexion */
.login-section {
  width: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle, 
      rgba(183, 255, 175, 1) 0%, 
      rgba(255, 255, 255, 1) 50%, 
      rgba(255, 255, 255, 1) 100%);
  padding: 20px;
}

.login-form {
  width: 100%;
  max-width: 400px;
  background-color: white;
  padding: 40px 20px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  text-align: center;
  position: relative;
  animation: scaleIn 0.6s 0.3s both;
  transform-origin: center;
}

/* Section image avec effet de fondu */
.image-section {
  width: 50%;
  background-image: url('bg-connection.jpg');
  background-size: cover;
  background-position: center;
  animation: fadeIn 1s ease-out;
}

/* Formulaire avec animations */
.login-form h2 {
  color: #333;
  margin-bottom: 20px;
  animation: slideUp 0.5s 0.4s both;
}

.login-form label {
  display: block;
  text-align: left;
  margin: 10px 0 5px;
  color: #555;
  animation: fadeIn 0.6s 0.5s both;
}

.login-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: var(--transition);
  animation: slideUp 0.5s 0.6s both;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(21, 148, 85, 0.2);
  transform: translateY(-2px);
}

/* Boutons avec animations */
.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  100% {
    transform: scale(20, 20);
    opacity: 0;
  }
}

.login-btn {
  background-color: var(--primary-color);
  color: white;
  animation: slideUp 0.5s 0.7s both;
}

.login-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(21, 148, 85, 0.4);
}

.signup-btn {
  background-color: var(--secondary-color);
  color: white;
  margin-top: 10px;
  animation: slideUp 0.5s 0.8s both;
}

.signup-btn:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(94, 204, 127, 0.4);
}

/* Pop-up avec animations */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  backdrop-filter: blur(5px);
  z-index: 999;
  animation: fadeIn 0.3s ease-out;
}

.popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 400px;
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  80% {
    transform: translate(-50%, -50%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.popup-content {
  text-align: center;
}

.popup-content h2 {
  color: #333;
  margin-bottom: 20px;
  animation: fadeIn 0.5s 0.2s both;
}

.popup-content label {
  display: block;
  text-align: left;
  margin: 10px 0 5px;
  color: #555;
  animation: fadeIn 0.5s 0.3s both;
}

.popup-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: var(--transition);
  animation: slideUp 0.5s 0.4s both;
}

.popup-content input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(21, 148, 85, 0.2);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  background: none;
  border: none;
  transition: var(--transition);
}

.close-btn:hover {
  color: #333;
  transform: rotate(90deg) scale(1.1);
}

#password-error {
  color: var(--error-color);
  font-size: 14px;
  margin-bottom: 15px;
  display: none;
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.popup .signup-btn {
  background-color: var(--secondary-color);
  color: white;
  margin-top: 10px;
  animation: slideUp 0.5s 0.5s both;
}

.popup .signup-btn:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-3px);
}

/* Responsive */
@media screen and (max-width: 768px) {
  .login-container {
      flex-direction: column;
      animation: none;
  }
  
  .login-section, 
  .image-section {
      width: 100%;
      height: 50vh;
  }
  
  .logo-container {
      position: absolute;
      top: 10px;
      left: 50%;
      transform: translateX(-50%);
      animation: none;
  }
  
  .login-form {
      animation: slideUp 0.6s ease-out;
  }
  
  .popup {
      width: 95%;
      padding: 20px;
  }
}

/* Animations de base */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from { 
    opacity: 0;
    transform: scale(0.95);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-15px); }
  60% { transform: translateY(-7px); }
}

@media screen and (max-width: 576px) {
  .logo-container {
    display: none;
  }
}
