@import url('global.css');

/* Styles pour l'en-tête */
.header {
  color: white;
  text-align: center;
  height: 60px;
}

.header .logo {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 40px;
  height: 40px;
  background-image: url(../img/logo.png);
  background-size: contain;
  background-repeat: no-repeat;
}

/* Styles pour la barre de navigation */


.navbar {
  background-color:rgba(247, 241, 227,1.0);
  display: flex;
  align-items: center;
  height: 60px;
  position: relative;
}

.nav-links {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0;
  height: 100%;
}

.panier-link {
  position: absolute;
  right: 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panier-link img {
  width: 32px;
  height: 32px;
}

.navbar li {
  display: flex;
  align-items: center;
  height: 100%;
}

.navbar a {
  font-family: "Montserrat", Arial, sans-serif;
  font-weight: bold;
  font-size: 18px;
  color: black;
  margin: 0 10px;
  text-decoration: none;
  display: flex;
  align-items: center;
  position: relative; /* Nécessaire pour le pseudo-élément */
}

.navbar a:not(.panier-link)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: black;
  transition: width 0.3s ease;
}

.navbar a:not(.panier-link):hover::after {
  width: 100%;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Desktop et tablettes larges (au-dessus de 768px) */
@media (min-width: 769px) {
  .navbar {
    display: flex !important;
    align-items: center !important;
    height: 60px;
    position: relative !important;
  }
  
  .nav-links {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    list-style: none;
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin: 0;
    padding: 0;
    height: 100%;
  }
  
  .menu-toggle {
    display: none;
  }
  
  .nav-left {
    display: flex !important;
    position: absolute !important;
    left: 20px !important;
    align-items: center !important;
    justify-content: center !important;
    height: 60px !important;
  }
  
  .nav-left .logo {
    width: 40px !important;
    height: 40px !important;
    background-image: url(../img/logo.png) !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    display: block !important;
  }
  
  .nav-center {
    display: none !important;
  }
  
  .nav-right {
    display: flex !important;
    position: absolute !important;
    right: 20px !important;
    align-items: center !important;
    justify-content: center !important;
    height: 60px !important;
  }
  
  .panier-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 60px !important;
    height: 60px !important;
  }
  
  .panier-link img {
    width: 32px !important;
    height: 32px !important;
    display: block !important;
    margin: 0 auto !important;
  }
}

/* Menu burger pour mobile */
.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 15px;
  position: absolute;
  left: 15px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background: #333;
  margin: 3px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
  position: absolute;
  left: 50%;
  transform-origin: center;
}

.menu-toggle span:nth-child(1) {
  top: 8px;
}

.menu-toggle span:nth-child(2) {
  top: 18px;
}

.menu-toggle span:nth-child(3) {
  top: 28px;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateX(-50%) rotate(45deg);
  top: 18px;
  background: #333;
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-50%) scale(0);
}

.menu-toggle.active span:nth-child(3) {
  transform: translateX(-50%) rotate(-45deg);
  top: 18px;
  background: #333;
}

/* Animation bounce sur clic */
.menu-toggle:active {
  transform: scale(0.9);
  transition: transform 0.1s ease;
}

/* Tablettes (768px et moins) */
@media (max-width: 768px) {
  .header {
    position: relative;
  }
  
  .navbar {
    display: grid !important;
    grid-template-columns: 60px 1fr 60px !important;
    align-items: center !important;
    height: 60px;
    padding: 0 15px !important;
    position: relative !important;
  }
  
  .nav-left {
    justify-self: start !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 60px !important;
  }
  
  .nav-left .logo {
    display: none !important;
  }
  
  .nav-center {
    justify-self: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 60px !important;
  }
  
  .nav-center .logo {
    width: 35px !important;
    height: 35px !important;
    background-image: url('../img/logo.png') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .nav-right {
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 60px !important;
  }
  
  /* Menu burger */
  .menu-toggle {
    display: flex !important;
    flex-direction: column !important;
    cursor: pointer;
    padding: 8px !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    background: none !important;
    z-index: 1001;
    justify-content: center !important;
    align-items: center !important;
    height: 40px !important;
    width: 40px !important;
  }
  
  .menu-toggle span {
    width: 25px;
    height: 3px;
    background: #333 !important;
    margin: 3px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: center;
  }
  
  .menu-toggle span:nth-child(1) {
    top: 8px;
  }
  
  .menu-toggle span:nth-child(2) {
    top: 18px;
  }
  
  .menu-toggle span:nth-child(3) {
    top: 28px;
  }
  
  /* Animation burger vers croix */
  .menu-toggle.active span:nth-child(1) {
    transform: translateX(-50%) rotate(45deg);
    top: 18px;
    background: #333 !important;
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-50%) scale(0);
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: translateX(-50%) rotate(-45deg);
    top: 18px;
    background: #333 !important;
  }
  
  /* Logo */
  .logo {
    width: 35px !important;
    height: 35px !important;
    background-image: url('../img/logo.png') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Panier */
  .panier-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 0 !important;
    position: relative !important;
    height: 40px !important;
    width: 40px !important;
  }
  
  .panier-link img {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
    margin: 0 auto !important;
  }
  
  /* Cacher les liens de navigation normaux sur mobile */
  .nav-links {
    display: none !important;
  }
  
  /* Menu mobile plein écran */
  .nav-links.active {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(247, 241, 227, 0.98);
    backdrop-filter: blur(15px);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding-left: 30px;
    padding-top: 90px;
    z-index: 999;
    animation: slideInFromLeft 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  }
  
  /* Animation de fermeture */
  .nav-links.closing {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(247, 241, 227, 0.98);
    backdrop-filter: blur(15px);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding-left: 30px;
    padding-top: 90px;
    z-index: 999;
    animation: slideOutToLeft 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  }
  
  @keyframes slideInFromLeft {
    0% {
      transform: translateX(-100%);
      opacity: 0;
    }
    100% {
      transform: translateX(0);
      opacity: 1;
    }
  }
  
  @keyframes slideOutToLeft {
    0% {
      transform: translateX(0);
      opacity: 1;
    }
    100% {
      transform: translateX(-100%);
      opacity: 0;
    }
  }
  
  .nav-links.active li {
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
    list-style: none;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: calc(var(--i, 0) * 0.1s);
    width: auto;
    height: 22px !important;
  }
  
  .nav-links.active li:last-child {
    margin-bottom: 0 !important;
  }
  
  .nav-links.active li:nth-child(1) { --i: 1; }
  .nav-links.active li:nth-child(2) { --i: 2; }
  .nav-links.active li:nth-child(3) { --i: 3; }
  .nav-links.active li:nth-child(4) { --i: 4; }
  
  @keyframes fadeInUp {
    0% {
      opacity: 0;
      transform: translateY(30px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .nav-links.active li a {
    color: #333;
    font-size: 18px !important;
    font-weight: bold !important;
    text-decoration: none;
    padding: 0 !important;
    margin: 0 !important;
    display: block;
    transition: all 0.3s ease;
    text-align: left;
    line-height: 22px !important;
    height: 22px !important;
  }
  
  .nav-links.active li a:hover {
    color: #007bff;
    transform: translateX(10px);
  }
}

/* Mobiles (480px et moins) */
@media (max-width: 480px) {
  .header .logo {
    width: 30px;
    height: 30px;
    top: 10px;
    left: 45px;
  }
  
  .navbar {
    height: 45px;
  }
  
  .navbar a {
    font-size: 14px;
    margin: 0 5px;
  }
  
  .panier-link {
    right: 10px;
  }
  
  .panier-link img {
    width: 24px !important;
    height: 24px !important;
  }
  
  /* Ajustements pour le menu mobile sur petits écrans */
  .nav-links.active li a {
    font-size: 16px !important;
  }
  
  .nav-links.active li {
    margin: 0 0 20px 0 !important;
  }
}

/* Très petits écrans (320px et moins) */
@media (max-width: 320px) {
  .header .logo {
    width: 25px;
    height: 25px;
    top: 8px;
    left: 40px;
  }
  
  .navbar {
    height: 40px;
  }
  
  .navbar a {
    font-size: 12px;
    padding: 8px;
  }
  
  .menu-toggle {
    left: 10px;
  }
  
  .menu-toggle span {
    width: 20px;
    height: 2px;
  }
  
  .panier-link img {
    width: 20px !important;
    height: 20px !important;
  }
}

