/* ===== MEGA MENU - VERSION PROFESSIONNELLE ===== */

/* Reset et variables CSS */
:root {
  --menu-primary-color: #2c3e50;
  --menu-secondary-color: #3498db;
  --menu-text-color: #ffffff;
  --menu-hover-color: #2980b9;
  --menu-background: #ffffff;
  --menu-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --menu-border-radius: 8px;
  --menu-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --menu-spacing: 1rem;
}

/* Structure principale du menu */
.topMenuBlock {
  position: relative;
  width: 100%;
  z-index: 1000;
}

.topmenu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--menu-spacing);
}

/* Items du menu */
.item_menu {
  position: relative;
  display: flex;
  align-items: center;
}

.item_menu_link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  color: var(--menu-text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border-radius: var(--menu-border-radius);
  transition: var(--menu-transition);
  cursor: pointer;
  background: transparent;
  border: 2px solid transparent;
  white-space: nowrap;
}

.item_menu_link:hover,
.item_menu_link:focus {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--menu-text-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.item_menu_link[aria-expanded="true"] {
  background-color: var(--menu-secondary-color);
  border-color: var(--menu-secondary-color);
}

/* Flèche du menu */
.menu-arrow {
  font-size: 0.7rem;
  transition: transform var(--menu-transition);
  display: inline-block;
  margin-left: 0.25rem;
}

.item_menu:hover .menu-arrow,
.item_menu_link[aria-expanded="true"] .menu-arrow {
  transform: rotate(180deg);
}

/* Sous-menu (Mega Menu) */
.subcat_menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--menu-background);
  border-radius: var(--menu-border-radius);
  box-shadow: var(--menu-shadow);
  padding: 2rem;
  min-width: 600px;
  max-width: 90vw;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-10px);
  transition: var(--menu-transition);
  z-index: 1001;
  border: 1px solid rgba(0,0,0,0.08);
}

.item_menu:hover .subcat_menu,
.item_menu:focus-within .subcat_menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Descriptions dans le menu */
.menu-description {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--menu-border-radius);
  border-left: 4px solid var(--menu-secondary-color);
}

.menu-description-before {
  margin-bottom: 1.5rem;
}

.menu-description-after {
  margin-top: 1.5rem;
}

/* Colonnes du menu */
.menu-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin: 1rem 0;
}

.subcat_menu_table {
  width: 100%;
  border-collapse: collapse;
}

.column_item {
  padding: 1rem;
  vertical-align: top;
  border-right: 1px solid #e9ecef;
}

.column_item:last-child {
  border-right: none;
}

/* Groupes dans les colonnes */
.group_item {
  margin-bottom: 1.5rem;
}

.title_group {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--menu-primary-color);
  margin-bottom: 0.75rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.title_group::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: var(--menu-secondary-color);
  border-radius: 1px;
}

/* Liens dans le menu */
.links_menu,
.category-tree-top ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.links_menu li,
.category-tree-top li {
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
  transition: var(--menu-transition);
}

.links_menu a,
.category-tree-top a {
  color: #6c757d;
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--menu-transition);
  display: block;
  padding: 0.25rem 0;
  border-radius: 4px;
}

.links_menu a:hover,
.category-tree-top a:hover {
  color: var(--menu-secondary-color);
  background-color: rgba(52, 152, 219, 0.05);
  padding-left: 0.5rem;
}

/* Images dans le menu */
.imageBlock {
  text-align: center;
  margin: 1rem 0;
}

.imageBlock img {
  max-width: 100%;
  height: auto;
  border-radius: var(--menu-border-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: var(--menu-transition);
}

.imageBlock img:hover {
  transform: scale(1.05);
}

/* Produits dans le menu */
.productsBlock {
  margin: 1rem 0;
}

.productsBlock .thumbnail-container {
  text-align: center;
  margin: 0.5rem 0;
}

.product-price-and-shipping {
  color: var(--menu-secondary-color);
  font-weight: 600;
  text-align: center;
  font-size: 1.2rem;
  margin: 0.5rem 0;
}

.regular-price {
  color: #9ca3af;
  text-decoration: line-through;
  font-size: 0.9rem;
  font-weight: 400;
  margin-right: 0.5rem;
}

/* Menu mobile */
@media (max-width: 768px) {
  .topMenuBlock.desktop {
    display: none;
  }

  .topMenuBlock.mobile {
    display: block !important;
    position: relative;
  }

  .topmenu_mobile {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    position: relative;
  }

  .hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--menu-text-color);
    border-radius: 2px;
    transition: var(--menu-transition);
    transform-origin: center;
  }

  .topmenu_mobile.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }

  .topmenu_mobile.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .topmenu_mobile.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }

  .topMenuBlock.mobile .topmenu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--menu-background);
    box-shadow: var(--menu-shadow);
    border-radius: var(--menu-border-radius);
    margin-top: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--menu-transition);
    max-height: 0;
    overflow: hidden;
  }

  .topMenuBlock.mobile .topmenu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 500px;
  }

  .topMenuBlock.mobile .item_menu {
    width: 100%;
    border-bottom: 1px solid #e9ecef;
  }

  .topMenuBlock.mobile .item_menu:last-child {
    border-bottom: none;
  }

  .topMenuBlock.mobile .item_menu_link {
    width: 100%;
    justify-content: space-between;
    padding: 1rem 1.5rem;
  }

  .topMenuBlock.mobile .subcat_menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    padding: 1rem 0;
    margin: 0;
    border-radius: 0;
    border-top: 1px solid #e9ecef;
  }

  .menu-columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Accessibilité et focus */
.item_menu_link:focus {
  outline: 2px solid var(--menu-secondary-color);
  outline-offset: 2px;
}

.subcat_menu:focus-within {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Animations avancées */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.item_menu:hover .subcat_menu {
  animation: slideDown 0.3s ease-out;
}

/* Performance optimizations */
.topMenuBlock * {
  box-sizing: border-box;
}

.subcat_menu {
  will-change: opacity, transform;
}

.item_menu_link {
  will-change: transform;
}

/* Support navigateurs anciens */
@supports not (display: grid) {
  .menu-columns {
    display: flex;
    flex-wrap: wrap;
  }

  .column_item {
    flex: 1 1 250px;
  }
}