/* ===== VARIABLES DE COULEUR ===== */
:root {
  --primary-color-start: #6a11cb;
  --primary-color-end: #2575fc;
  --background-light: #f8f9fa;
  --text-dark: #333;
  --text-light: #fff;
  --input-bg: #edf2f7;
  --shadow-color: rgba(0, 0, 0, 0.15);
}

/* ===== BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}

body {
  background: var(--background-light);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px; /* Marge pour la vue de bureau */
}

/* ===== CONTAINER PRINCIPAL ===== */
.container {
  width: 100%;
  max-width: 900px;
  background: var(--text-light);
  border-radius: 10px;
  box-shadow: 0 14px 28px var(--shadow-color), 0 10px 10px var(--shadow-color);
  position: relative;
  overflow: hidden;
  min-height: 600px;
}

/* ===== FORM CONTAINERS ===== */
.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  transition: all 0.6s ease-in-out;
  padding: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 50%;
  text-align: center;
}

form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sign-in {
  left: 0;
  width: 50%;
  z-index: 2;
}

.sign-up {
  left: 0;
  width: 50%;
  opacity: 0;
  z-index: 1;
}

.logo {
  margin-bottom: 30px;
}

.logo img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--background-light);
}

h2 {
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-dark);
}

input {
  width: 100%;
  padding: 12px 15px;
  margin: 8px 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background-color: var(--input-bg);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus {
    border-color: var(--primary-color-end);
    box-shadow: 0 0 0 2px rgba(37, 117, 252, 0.25);
}

a.Singinbtn, a.loginbtn, button.hidden {
  background-image: linear-gradient(to right, var(--primary-color-start) 0%, var(--primary-color-end) 51%, var(--primary-color-start) 100%);
  background-size: 200% auto;
  color: var(--text-light);
  padding: 12px 45px;
  border: none;
  border-radius: 25px;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 20px;
  cursor: pointer;
  transition: all 0.4s ease;
  display: inline-block;
  text-align: center;
}

a.Singinbtn:hover, a.loginbtn:hover, button.hidden:hover {
  background-position: right center; /* change the direction of the change here */
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

a.Singinbtn:active, a.loginbtn:active, button.hidden:active {
  transform: scale(0.95);
}

/* ===== TOGGLE CONTAINER (SUPERPOSITION) ===== */
.toggle-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: all 0.6s ease-in-out;
  z-index: 10;
}

.toggle {
  position: relative;
  width: 200%;
  height: 100%;
  left: -100%;
  transition: all 0.6s ease-in-out;
  background: linear-gradient(to right, var(--primary-color-start), var(--primary-color-end));
  color: var(--text-light);
}

.toggle-panel {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.toggle-left {
  transform: translateX(-200%);
}

.toggle-right {
  right: 0;
  transform: translateX(0);
}

button.hidden {
  background: transparent;
  border: 2px solid var(--text-light);
}

button.hidden:hover {
    background-color: var(--text-light);
    color: var(--primary-color-end);
    border-color: var(--text-light);
}


p {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.5px;
    margin: 20px 0 30px;
}

/* ===== ANIMATIONS (ACTIVATION JS) ===== */
.container.active .sign-in {
  transform: translateX(100%);
}

.container.active .sign-up {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
  animation: show 0.6s;
}

@keyframes show {
  0%, 49.99% {
    opacity: 0;
    z-index: 1;
  }
  
  50%, 100% {
    opacity: 1;
    z-index: 5;
  }
}

.container.active .toggle-container {
  transform: translateX(-100%);
}

.container.active .toggle {
  transform: translateX(50%);
}

.container.active .toggle-left {
  transform: translateX(0);
}

.container.active .toggle-right {
  transform: translateX(200%);
}


/* =================================== */
/* ===== DESIGN RESPONSIVE (MOBILE) ===== */
/* =================================== */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .container {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .toggle-container {
        display: none;
    }
    
    .form-container {
        width: 100%;
        position: static;
        height: auto;
        padding: 40px 20px;
        background-color: var(--text-light);
    }

    .sign-up {
        display: none;
    }
    
    .toggle-panel {
        display: flex;
        position: static;
        transform: none !important;
        height: auto;
        padding: 30px 20px;
        color: var(--text-dark);
        background: var(--background-light);
    }
    
    .toggle-panel p {
        color: #666;
    }

    .toggle-panel button.hidden {
        /* On réutilise le style du bouton principal mais en version "outline" */
        background-image: none;
        background-color: transparent;
        border: 2px solid var(--primary-color-end);
        color: var(--primary-color-end);
        font-weight: bold;
    }
    
    .toggle-panel button.hidden:hover {
        background-color: var(--primary-color-end);
        color: var(--text-light);
    }

    /* --- LOGIQUE D'AFFICHAGE MOBILE AVEC LA CLASSE '.active' --- */
    
    .sign-in { display: flex; }
    .sign-up { display: none; }
    .toggle-left { display: none; }
    .toggle-right { display: flex; }

    .container.active .sign-in { display: none; }
    .container.active .sign-up { display: flex; }
    .container.active .toggle-left { display: flex; }
    .container.active .toggle-right { display: none; }
}

@media (max-width: 480px) {
  .form-container {
    padding: 20px 15px;
  }

  h2 {
    font-size: 1.5rem;
  }

  a.Singinbtn, a.loginbtn, button.hidden {
    padding: 12px 30px;
    font-size: 0.8rem;
    border-radius: 20px;
  }
}
