/* =================================================================
    RESPONSIVE STYLES & MOBILE HAMBURGER MENU - SUFEH
    ================================================================ */

/* Botón de hamburguesa oculto por defecto en escritorio */
.menu-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--orange, #f39c12);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

/* Overlay general para cuando se abra cualquier menú lateral */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1050;
}
.sidebar-overlay.active {
    display: block;
}

/* Para Tablets y dispositivos medianos (Max-width: 1024px) */
@media (max-width: 1024px) {
    .navbar {
        gap: 30px !important;
        padding: 8px 10px !important;
    }
}

/* Para Celulares y dispositivos móviles (Max-width: 900px) */
@media (max-width: 900px) {
    /* POSICIÓN FIJA Y EXACTA DEL BOTÓN DE MENÚ EN LA ESQUINA SUPERIOR IZQUIERDA */
    .menu-toggle-btn {
        display: block !important;
        position: absolute !important;
        top: 25px !important;
        left: 35px !important;
        z-index: 1020 !important;
        background: transparent !important;
        border: none !important;
        color: var(--orange, #f39c12) !important;
        font-size: 20px !important;
        cursor: pointer !important;
        padding: 0 !important;
    }

    /* UBICAR LA BARRA SUPERIOR Y DAR ESPACIO AL BOTÓN */
    .top-bar {
        position: relative !important;
      
        padding-right: 12px !important;
        justify-content: center !important;
    }

    .top-bar > div:first-child {
        justify-content: center !important;
        width: 100%;
    }

    .logo {
        text-align: center;
        width: 100%;
    }

    /* Layouts generales de catálogos, tiendas y detalles */
    .catalogo-layout, 
    .catalog-container,
    .detalle-container { 
        flex-direction: column; 
        padding: 10px; 
    }

    /* Centrar textos en páginas de detalle para móviles */
    .detalle-info, 
    .detalle-info h1, 
    .detalle-info p {
        text-align: center !important;
        align-items: center !important;
    }
    .tag-categoria, 
    .empaque-caja {
        margin-left: auto;
        margin-right: auto;
    }

    /* SECCIÓN DE MARCAS: Forzar una debajo de la otra en teléfonos */
    .marcas-container,
    .marcas-grid,
    .section-marcas,
    .grid-marcas,
    div[class*="marca"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 15px !important;
        width: 100% !important;
    }

    /* Ajustar los contenedores hijos o enlaces de las marcas para que no se extiendan de más y luzcan ordenados */
    .marcas-container > *,
    .marcas-grid > *,
    .section-marcas > *,
    .grid-marcas > * {
        width: 100% !important;
        max-width: 320px !important;
        box-sizing: border-box !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Botón flotante de categorías móvil (se mantiene por si acaso, aunque en catálogos ahora usemos el menú hamburguesa integrado) */
    .mobile-category-toggle { 
        display: none !important; 
    }

    .desktop-title { 
        display: none !important; 
    }

    /* Ocultamos la barra lateral clásica en móvil ya que el desplegable está en el menú hamburguesa */
    .sidebar-filtros, 
    .catalog-sidebar { 
        display: none !important; 
    }

    .productos-area, 
    .catalog-content { 
        width: 100% !important; 
    }

    /* OCULTAR el navbar horizontal clásico en móviles */
    .navbar { 
        display: none !important; 
    }

    /* Menú de navegación lateral deslizante (Hamburguesa) con categorías desplegables */
    .mobile-nav-drawer {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        background: #111;
        z-index: 1200;
        box-shadow: 4px 0 15px rgba(0,0,0,0.5);
        transition: left 0.3s ease-in-out;
        display: flex;
        flex-direction: column;
        padding-top: 60px;
        box-sizing: border-box;
        overflow-y: auto;
    }
    .mobile-nav-drawer.active {
        left: 0;
    }
    .mobile-nav-drawer .close-drawer-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
    }
    .mobile-nav-drawer a {
        padding: 15px 20px;
        color: #fff;
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        border-bottom: 1px solid #222;
        transition: background 0.2s, color 0.2s;
    }
    .mobile-nav-drawer a:hover,
    .mobile-nav-drawer a.active {
        background: var(--orange, #f39c12);
        color: #000;
    }

    /* Estilos para el desplegable de categorías dentro del menú hamburguesa en móvil */
    .mobile-categories-section {
        padding: 0 20px;
        border-bottom: 1px solid #222;
    }
    .mobile-categories-title {
        color: var(--orange, #f39c12);
        font-size: 14px;
        font-weight: bold;
        padding: 15px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
    }
    .mobile-categories-list {
        display: none;
        padding-left: 10px;
        list-style: none;
        margin: 0 0 10px 0;
    }
    .mobile-categories-list.open {
        display: block;
    }
    .mobile-categories-list li a {
        padding: 10px;
        font-size: 13px;
        color: #ccc;
        border-bottom: none;
        background: transparent;
    }
    .mobile-categories-list li a:hover, 
    .mobile-categories-list li a.active {
        color: var(--orange, #f39c12);
        background: transparent;
        font-weight: bold;
    }

    /* Footer adaptado para móviles */
    .footer-layout {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .footer-links {
        padding-left: 0 !important;
        align-items: center !important;
        text-align: center !important;
    }

    .footer-logo {
        text-align: center !important;
        padding-left: 0 !important;
    }
}

/* Pantallas muy pequeñas (Celulares compactos < 480px) */
@media (max-width: 480px) {
    .catalogo-grid-custom,
    .products-grid,
    .recomendados-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .top-bar {
        padding: 8px 10px;
    }
}