/* ========================================
   CSS CORREGIDO - Subcategorías en acordeón
   ======================================== */

@media (max-width: 1024px) {
  
  /* ========================================
     OVERLAY (Fondo oscuro)
     ======================================== */
  
  .menu-init:after {
    content: "";
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    background-color: rgba(0, 0, 0, 0);
    z-index: 19999;
    transition: background-color 0.4s ease-in-out;
    pointer-events: none;
  }
  
  .menu-init.js-open:after {
    display: block !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    pointer-events: auto;
  }

  /* ========================================
     PANEL LATERAL
     ======================================== */
  
  .ah-lg-mode {
    position: fixed !important;
    left: -350px !important;
    width: 350px !important;
    max-width: 85vw !important;
    height: 100% !important;
    top: 0 !important;
    background-color: #ffffff !important;
    z-index: 20000 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0);
    -webkit-overflow-scrolling: touch;
  }
  
  .menu-init.js-open .ah-lg-mode {
    left: 0 !important;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3) !important;
  }
  
  /* ========================================
     BOTÓN CLOSE
     ======================================== */
  
  .ah-close {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    padding: 18px 20px !important;
    background: linear-gradient(135deg, #003d82 0%, #0a5dad 100%) !important;
    color: white !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.3s !important;
    border-bottom: 2px solid #002855 !important;
  }
  
  .ah-close:before {
    content: "✕" !important;
    font-size: 18px !important;
    font-weight: bold !important;
    margin-right: 5px !important;
  }
  
  .ah-close:hover {
    background: linear-gradient(135deg, #002855 0%, #003d82 100%) !important;
  }
  
  /* ========================================
     LISTA DE NAVEGACIÓN
     ======================================== */
  
  .ah-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  
  .ah-list > li {
    position: relative !important;
    display: block !important;
  }
  
  /* OCULTAR elementos innecesarios */
  .ah-list > li > .mega-text {
    display: none !important;
  }
  
  .ah-list > li > .js-menu-toggle {
    display: none !important;
  }
  
  /* ========================================
     MEGA MENU - ESTRUCTURA TIPO ACORDEÓN
     ======================================== */
  
  .mega-menu {
    display: block !important;
    padding: 0 !important;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  .mega-menu-wrap {
    display: block !important;
  }
  
  /* ========================================
     LISTA DE CATEGORÍAS - MODO ACORDEÓN
     ======================================== */
  
  .mega-menu-list {
    display: block !important;
    padding: 0 !important;
    background-color: #ffffff !important;
  }
  
  .mega-menu-list > ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  
  .mega-menu-list > ul > li {
    display: block !important;
    border-bottom: 1px solid #f0f0f0 !important;
  }
  
  .mega-menu-list > ul > li:last-child {
    border-bottom: none !important;
  }
  
  /* ========================================
     CATEGORÍA (Acordeón header)
     ======================================== */
  
  .mega-menu-list > ul > li > a {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px 20px !important;
    background: white !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: all 0.3s !important;
    position: relative !important;
    cursor: pointer !important;
  }
  
  /* Flecha indicadora a la derecha */
  .mega-menu-list > ul > li > a:after {
    content: "\f078" !important; /* Font Awesome chevron-down */
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    position: absolute !important;
    right: 20px !important;
    font-size: 12px !important;
    transition: transform 0.3s !important;
  }
  
  .mega-menu-list > ul > li > a:hover {
    background: #f8f9fa !important;
  }
  
  /* Categoría activa (abierta) */
  .mega-menu-list > ul > li.js-active > a {
    background: #e8f0fe !important;
    color: #003d82 !important;
  }
  
  .mega-menu-list > ul > li.js-active > a:after {
    transform: rotate(180deg) !important; /* Flecha hacia arriba */
  }
  
  .mega-menu-list > ul > li > a i {
    font-size: 18px !important;
    width: 24px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
  }
  
  .mega-menu-list > ul > li > a span {
    flex: 1 !important;
  }
  
  /* ========================================
     SUBCATEGORÍAS (Contenido del acordeón)
     ======================================== */
  
  .mega-menu-content {
    display: none !important;
    padding: 0 !important;
    background: #f8f9fa !important;
    border-top: 1px solid #e0e0e0 !important;
    overflow: hidden !important;
  }
  
  .mega-menu-content.js-active {
    display: block !important;
    animation: slideDown 0.3s ease-out !important;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      max-height: 0;
    }
    to {
      opacity: 1;
      max-height: 2000px;
    }
  }
  
  .mega-menu-content .row {
    display: block !important;
    padding: 15px 20px !important;
  }
  
  .mega-menu-content [class*="col-"] {
    margin-bottom: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    display: block !important;
  }
  
  .mega-menu-content [class*="col-"]:last-child {
    margin-bottom: 0 !important;
  }
  
  .mega-menu-content ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  
  .mega-menu-content ul li {
    display: block !important;
  }
  
  /* Título de subcategoría */
  .mega-menu-content .mega-list-title {
    display: block !important;
  }
  
  .mega-menu-content .mega-list-title > a {
    font-weight: 700 !important;
    color: #003d82 !important;
    font-size: 15px !important;
    padding: 10px 0 !important;
    display: block !important;
    text-decoration: none !important;
    border-bottom: 2px solid #003d82 !important;
    margin-bottom: 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  
  /* Links de productos/items */
  .mega-menu-content ul li a {
    display: block !important;
    padding: 8px 0 8px 15px !important;
    color: #555 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    border-left: 2px solid transparent !important;
    transition: all 0.2s !important;
    position: relative !important;
  }
  
  .mega-menu-content ul li a:before {
    content: "›" !important;
    position: absolute !important;
    left: 3px !important;
    opacity: 0.5 !important;
    transition: all 0.2s !important;
    font-size: 16px !important;
  }
  
  .mega-menu-content ul li a:hover {
    color: #003d82 !important;
    padding-left: 20px !important;
    border-left-color: #003d82 !important;
    background: rgba(0, 61, 130, 0.05) !important;
  }
  
  .mega-menu-content ul li a:hover:before {
    opacity: 1 !important;
  }
  
  /* Mensaje cuando no hay categorías */
  .mega-menu-content > h5 {
    font-weight: 600 !important;
    margin: 0 !important;
    font-size: 14px !important;
    color: #666 !important;
    text-align: center !important;
    padding: 30px 20px !important;
    background: #f8f9fa !important;
    display: block !important;
  }
  
  /* ========================================
     SCROLLBAR
     ======================================== */
  
  .ah-lg-mode::-webkit-scrollbar {
    width: 8px !important;
  }
  
  .ah-lg-mode::-webkit-scrollbar-track {
    background: #f0f0f0 !important;
  }
  
  .ah-lg-mode::-webkit-scrollbar-thumb {
    background: #c0c0c0 !important;
    border-radius: 4px !important;
  }
  
  .ah-lg-mode::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0 !important;
  }
  
  /* ========================================
     BLOQUEO DE SCROLL
     ======================================== */
  
  body.menu-open {
    overflow: hidden !important;
  }
}

/* ========================================
   RESPONSIVE - Pantallas pequeñas
   ======================================== */

@media (max-width: 480px) {
  .ah-lg-mode {
    width: 300px !important;
  }
  
  .mega-menu-content .row {
    padding: 12px 15px !important;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .ah-lg-mode {
    width: 340px !important;
  }
}

/* ========================================
   DESKTOP - Ocultar elementos móviles
   ======================================== */

@media (min-width: 1025px) {
  .toggle-button {
    display: none !important;
  }
  
  .ah-close {
    display: none !important;
  }
}