/* ============================
   Variables & Reset
============================ */
:root {
  --primary-color: #1A2027;
  --secondary-color: #FF6B00;
  --accent-color: #00B4C9;
  --primary-green: #00B86B;
  --text-color: #1A2027;
  --light-gray: #F5F6F7;
  --medium-gray: #E5E7E9;
  --dark-gray: #757575;
  --white: #FFFFFF;
  --header-height: 80px;
  --categories-height: 48px;
  --top-bar-height: 36px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
  --radius-sm: 4px;
  --radius-md: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--light-gray);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================
   Top Bar
============================ */
.top-bar {
  background-color: var(--primary-color);
  color: var(--white);
  height: var(--top-bar-height);
  font-size: 14px;
}

.top-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.top-bar-left,
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.language-selector,
.currency-selector {
  position: relative;
}

.language-selector select,
.currency-selector select {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--white);
  padding: 5px 20px 5px 5px;
  cursor: pointer;
  font-size: 14px;
}

.language-selector::after,
.currency-selector::after {
  content: '▼';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 10px;
}

.top-bar-right a {
  color: var(--white);
  text-decoration: none;
}

.top-bar-right a:hover {
  color: var(--accent-color);
}

/* ============================
   Main Header
============================ */
.main-header {
  position: relative;
  z-index: 1000;
}

.main-bar {
  background: var(--white);
  height: var(--header-height);
  box-shadow: var(--shadow-sm);
  position: fixed; /* Fixe la barre principale */
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 10px;
}

.main-bar-content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 40px;
  align-items: center;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 12px;
}

.logo {
  height: 50px;
}

.brand-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  margin-left: 12px;
  white-space: nowrap;
}

.search-bar {
  width: 100%;
  max-width: 600px;
}

.search-input-wrapper {
  display: flex;
  height: 44px;
  position: relative;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0 44px 0 16px;
  border: 2px solid var(--medium-gray);
  border-radius: var(--radius-md);
  font-size: 16px;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.search-input-wrapper button {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--dark-gray);
}

/* Conteneur pour panier et hamburger */
.cart-menu-container {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: flex-end; /* Aligne les éléments à droite */
  width: 100%;
  margin-left: auto;
}

.cart {
  position: relative;
}

.cart-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.cart-link:hover {
  background-color: var(--light-gray);
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--secondary-color);
  color: var(--white);
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
  min-width: 20px;
  text-align: center;
}

.menu-toggle {
  display: none;
  cursor: pointer;
  width: 25px;
  height: 20px;
  position: relative;
  margin-left: 15px;
}

.menu-toggle span {
  height: 3px;
  background: black;
  width: 100%;
  border-radius: 2px;
  position: absolute;
  transition: all 0.3s ease;
}

.menu-toggle span:nth-child(1) {
  top: 0;
}

.menu-toggle span:nth-child(2) {
  top: 8px;
}

.menu-toggle span:nth-child(3) {
  top: 16px;
}

/* Animation pour la croix */
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg);
  top: 8px;
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg);
  top: 8px;
}

/* ============================
   Menu Catégories Responsive
============================ */
.categories-nav {
  background-color: var(--white);
  border-bottom: 1px solid var(--medium-gray);
  box-shadow: var(--shadow-sm);
  position: fixed; /* Fixe la barre de catégories */
  top: var(--header-height); /* Positionnée juste en dessous de la barre principale */
  left: 0;
  right: 0;
  z-index: 999;
}

/* Ajout d'un espace pour compenser les barres fixes */
main {
  padding-top: calc(var(--header-height) + var(--categories-height));
}

.categories-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  height: var(--categories-height);
  overflow-x: auto; /* Permet le défilement horizontal si nécessaire */
}

.categories-list::-webkit-scrollbar {
  display: none; /* Cache la barre de défilement sur WebKit */
}

.categories-list li {
  display: flex;
}

.category-link {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.category-link i {
  margin-right: 8px;
}

.category-link:hover,
.category-link.active {
  background-color: var(--light-gray);
  color: var(--accent-color);
}

/* Nom du site pour le menu mobile */
.mobile-nav-header {
  display: none;
  padding: 15px 20px;
  border-bottom: 1px solid var(--medium-gray);
  background-color: var(--primary-color);
  color: var(--white);
}

.mobile-brand-name {
  font-size: 20px;
  font-weight: 600;
}

/* Overlay pour mobile */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.overlay.active {
  display: block;
}

/* ============================
   Responsive
============================ */
@media screen and (max-width: 1024px) {
  .main-bar-content {
    gap: 20px;
  }
}

@media screen and (max-width: 768px) {
  .top-bar {
    display: none;
  }

  .main-bar-content {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .logo-container {
    gap: 5px; /* Réduction de l'espace entre le logo et le nom */
  }
  
  .brand-name {
    font-size: 20px;
    margin-left: 5px; /* Réduction de la marge à gauche */
  }

  .cart-menu-container {
    gap: 5px; /* Réduire l'espace entre panier et hamburger sur mobile */
  }

  .search-bar {
    order: 4;
    grid-column: 1 / -1;
    max-width: 100%;
    padding-bottom: 10px;
  }

  .search-bar.active {
    display: block;
  }
  
  /* Ajustement du padding pour mobile */
  main {
    padding-top: var(--header-height);
  }

  /* Affichage du nom du site en haut du menu */
  .mobile-nav-header {
    display: block;
  }

  .categories-nav {
    position: fixed;
    right: -280px;
    top: 0;
    bottom: 0;
    left: auto; /* Supprime la fixation sur le côté gauche */
    width: 280px;
    z-index: 1001;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
    height: 100%;
  }

  .categories-nav.active {
    right: 0;
  }

  .categories-list {
    flex-direction: column;
    height: auto;
    padding-top: 10px;
    overflow-x: visible;
  }

  .categories-list li {
    border-bottom: 1px solid var(--medium-gray);
  }

  .category-link {
    padding: 12px 16px;
    font-size: 16px;
    width: 100%;
  }

  .menu-toggle {
    display: block;
    z-index: 1002;
  }
  
    .cart-label {
    display: none;
  }
}

@media screen and (max-width: 480px) {
  .cart-label {
    display: none;
  }

  .logo {
    height: 40px;
  }

  .search-input-wrapper {
    height: 40px;
  }
  
  .cart-menu-container {
    gap: 2px; /* Encore moins d'espace sur très petit écran */
  }
  
  .cart-link {
    padding: 5px; /* Réduire le padding du lien du panier */
  }
}

/* ============================
   Footer
============================ */
.main-footer {
  background: var(--primary-color);
  color: var(--white);
  padding: 50px 0 20px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr 0.75fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

.footer-section h3 {
  font-size: 18px;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 10px;
}

.footer-section h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 2px;
  background: var(--primary-green);
}

.footer-section p,
.footer-section ul li,
.footer-bottom p {
  font-size: 14px;
  color: var(--medium-gray);
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 12px;
}

.footer-section a {
  text-decoration: none;
  color: var(--medium-gray);
}

.footer-section a:hover {
  color: var(--primary-green);
}

.social-links {
  display: flex;
  gap: 15px;
}

.social-links a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.social-links a:hover {
  background: var(--primary-green);
  transform: translateY(-3px);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media screen and (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-section h3::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .social-links {
    justify-content: center;
  }
}

.cart-menu-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    margin-left: 10px;
}

.user-info .user-name {
    color: #333;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.user-info .user-name:hover {
    color: #007bff;
}

/* Ajustement pour mobile */
@media (max-width: 768px) {
    .user-info {
        margin-right: 10px;
    }
}