/* ==========================================
   MENU-DESKTOP.CSS - NOVA IP CAMERA THEME
   Navigation horizontale + Mega menu + Shrink
   ========================================== */

/* ==========================================
   TABLE DES MATIÈRES
   ========================================== */
/*
1. MENU SHRINK (Version réduite au scroll)
2. MENU DESKTOP HORIZONTAL
3. BURGER ICON DESKTOP (Statique)
4. BARRE SOULIGNEMENT ACTIVE
5. MEGA MENU DROPDOWN
6. MEGA MENU - SIDEBAR + DEPTH 2/3
*/

/* ==========================================
   RÈGLE GLOBALE - CACHER MOBILE EN DESKTOP
   ========================================== */

@media (min-width: 992px) {
  .mx-mobile-only {
    display: none !important;
  }
}

/* ==========================================
   1. MENU SHRINK (Version réduite au scroll)
   ========================================== */

/* Menu original - Cacher au shrink */
#header.shrink .mx-header-menu:not(.mx-header-menu-shrink) {
  display: none !important;
}

/* Menu shrink - Afficher au shrink */
.mx-header-menu-shrink {
  display: none;
}

#header.shrink .mx-header-menu-shrink {
  display: block;
  margin-left: var(--space-4);
}

/* Liste horizontale */
.mx-header-menu-shrink .top-menu {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.mx-header-menu-shrink .top-menu > li {
  position: relative;
  color: var(--mx-gray-900);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--fs-base);
  padding: var(--space-2) 0;
  display: flex !important;
  align-items: center !important;
  gap: var(--space-2) !important;
  transition: color 0.2s ease;
}

.mx-header-menu-shrink .top-menu > li > a {
  color: var(--mx-gray-900);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--fs-base);
  padding: var(--space-2) 0;
  display: block;
  transition: color 0.2s ease;
}

.mx-header-menu-shrink .top-menu > li > a:hover {
  color: var(--mx-orange);
}

/* Barre active orange */
.mx-header-menu-shrink .top-menu > li.current > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--mx-orange);
}

/* Burger icon dans menu shrink */
.mx-header-menu-shrink .mx-burger-icon {
  width: 24px !important;
  height: 20px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
  pointer-events: none !important;
  visibility: visible !important;
}

.mx-header-menu-shrink .mx-burger-line {
  display: block !important;
  height: 2px !important;
  background: var(--mx-gray-900) !important;
  border-radius: 2px !important;
  visibility: visible !important;
}

.mx-header-menu-shrink .mx-burger-line-1 {
  width: 100% !important;
}

.mx-header-menu-shrink .mx-burger-line-2 {
  width: 60% !important;
}

/* Burger label caché au shrink */
#header.shrink .mx-burger-label {
  display: none;
}

/* ==========================================
   2. MENU DESKTOP HORIZONTAL
   ========================================== */

#header .mx-header-menu {
  background: white;
  border-top: 1px solid var(--border-color);
  padding: 0;
}

/* Menu visible en desktop uniquement */
@media (min-width: 992px) {
  #header .mx-header-menu #_desktop_top_menu {
    display: block !important;
  }
}

/* Masquer searchbar doublon dans displayTop */
#header .mx-header-menu #search_widget {
  display: none !important;
}

/* Liste horizontale - Override theme.css */
#header .mx-header-menu .top-menu {
  display: flex !important;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Items du menu */
#header .mx-header-menu .top-menu > li {
  position: relative !important;
  display: flex !important;
  align-items: center;
  gap: 0;
}

/* Liens du menu */
#header .mx-header-menu .top-menu > li > a {
  display: inline-flex !important;
  padding: var(--space-4) var(--space-3);
  color: var(--mx-gray-900);
  text-decoration: none;
  font-size: var(--fs-base);
  font-weight: 500;
  transition: color 0.2s ease;
}

#header.shrink .mx-header-menu-shrink .top-menu > li > a {
  font-size: var(--fs-sm);
}

#header .mx-header-menu .top-menu > li > a:hover,
#header.shrink .mx-header-menu-shrink .top-menu > li > a:hover {
  color: var(--mx-orange);
}

/* ==========================================
   3. BURGER ICON DESKTOP (Statique)
   ========================================== */

#header .mx-header-menu .mx-burger-icon {
  width: 24px;
  height: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  pointer-events: none;
}

#header .mx-header-menu .mx-burger-line {
  display: block;
  height: 2px;
  background: #000;
  border-radius: 2px;
}

#header .mx-header-menu .mx-burger-line-1 {
  width: 100%;
}

#header .mx-header-menu .mx-burger-line-2 {
  width: 60%;
}

/* Bloquer toute animation au hover */
#header .mx-header-menu .top-menu > li:hover .mx-burger-line-1,
#header .mx-header-menu .top-menu > li:hover .mx-burger-line-2 {
  transform: none !important;
}

/* Maintenir l'asymétrie au hover */
#header .mx-header-menu .top-menu > li:hover .mx-burger-line-2 {
  margin-left: 8px !important;
}

/* ==========================================
   4. BARRE SOULIGNEMENT ACTIVE
   ========================================== */

#header .mx-header-menu .top-menu > li::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--mx-orange);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}

/* Barre visible sur item actif */
#header .mx-header-menu .top-menu > li.current::after {
  transform: scaleX(1);
}

/* Barre au hover */
#header .mx-header-menu .top-menu > li:hover::after {
  transform: scaleX(1);
}

/* ==========================================
   5. MEGA MENU DROPDOWN
   ========================================== */

/* Base commune - Normal ET Shrink */
#header .mx-header-menu .top-menu > li > .mx-mega-menu-dropdown,
#header.shrink .mx-header-menu-shrink .top-menu > li > .mx-mega-menu-dropdown {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  min-height: 400px;
  background: #ffffff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 1px solid var(--mx-gray-100);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
  display: block !important;
}

/* Header NORMAL - Top 174px */
#header .mx-header-menu .top-menu > li > .mx-mega-menu-dropdown {
  top: var(--header-height-normal);
}

/* Header SHRINK - Top 77px */
#header.shrink .mx-header-menu-shrink .top-menu > li > .mx-mega-menu-dropdown {
  top: var(--header-height-shrink);
}

/* Afficher au hover - Normal ET Shrink */
#header .mx-header-menu .top-menu > li:hover > .mx-mega-menu-dropdown,
#header.shrink .mx-header-menu-shrink .top-menu > li:hover > .mx-mega-menu-dropdown {
  opacity: 1;
  visibility: visible;
}

/* Overlay mega menu (comme Leroy Merlin) */
.mx-mega-menu-overlay-bg {
  position: fixed;
  top: var(--header-height-normal);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
  pointer-events: none;
}

/* État actif (ajouté par JS) */
.mx-mega-menu-overlay-bg.active {
  opacity: 1;
  visibility: visible;
}

/* ==========================================
   6. MEGA MENU - SIDEBAR + DEPTH 2/3
   ========================================== */

/* Layout principal : sidebar + contenu */
.mx-mega-menu-layout-sidebar {
  display: flex;
  gap: var(--space-8);
}

/* Sidebar gauche */
.mx-mega-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  padding-right: var(--space-6);
}

.mx-mega-sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.mx-mega-sidebar-item {
  overflow: hidden;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

#header .mx-mega-sidebar-item a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0;
  color: var(--mx-gray-900) !important;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease, font-weight 0.2s ease;
  font-weight: var(--fw-base);
}

.mx-mega-sidebar-item a:hover,
.mx-mega-sidebar-item.active a {
  background: var(--mx-orange-50) !important;
  font-weight: var(--fw-semibold) !important;
}

/* Wrapper fixe 64x64 */
.mx-sidebar-icon-wrapper {
  display: block;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Image à l'intérieur */
.mx-sidebar-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* Hover scale l'image DANS son wrapper */
a:hover .mx-sidebar-icon {
  transform: scale(1.1);
}

/* Contenu principal à droite */
.mx-mega-content {
  flex: 1;
  min-width: 0;
}

/* Cacher tous les contenus sauf actif */
.mx-mega-category-content {
  display: none;
}

.mx-mega-category-content.active {
  display: block;
}

/* DEPTH 2 - Grid horizontal */
.mx-mega-depth2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, max-content));
  gap: var(--space-8);
  justify-content: start;
}

.mx-mega-depth2-column {
  display: flex;
  flex-direction: column;
  width: 280px;
  flex-shrink: 0;
}

/* Images miniatures depth 2 */
.mx-mega-depth2-image {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  background: var(--mx-gray-50);
}

.mx-mega-depth2-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  transition: transform 0.3s ease;
}

.mx-mega-depth2-image a:hover img {
  transform: scale(1.05);
}

/* Titre depth 2 */
.mx-mega-depth2-title {
  margin: 0 0 var(--space-4) 0;
}

#header .mx-mega-depth2-title a {
  color: var(--mx-gray-900);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-decoration: none;
  transition: color 0.2s ease;
}

.mx-mega-depth2-title a:hover {
  color: var(--mx-orange) !important;
}

/* DEPTH 3 - Liste verticale */
.mx-mega-depth3-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-left: var(--space-4);
}

#header .mx-mega-depth3-list li a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--mx-gray-700);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
}

#header .mx-mega-depth3-list li a:hover {
  background: var(--mx-orange-50);
  color: var(--mx-gray-900);
  font-weight: var(--fw-semibold);
}