/* ═══════════════════════════════════════════════════════════════
   MEGA MENÚ - ESTILOS COMPLETOS
   Estilo Inducascos: Subcategorías | Marcas | Promo
   ═══════════════════════════════════════════════════════════════ */

/* ── Barra de Categorías (trigger del mega menú) ── */
.header-nav-bar {
    background: #000 !important;
    border-top: none !important;
    border-bottom: none !important;
}

.nav-categories {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
}

.nav-item-has-mega {
    color: #fff;
    text-decoration: none;
    /* Dimensions for Top Icons */
    width: 100px;
    height: 90px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    /* Smooth corners */
}

.nav-item-has-mega:hover,
.nav-item-has-mega.active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    /* Gentle zoom */
}

.nav-item-has-mega::after {
    display: none;
    /* Hide the text arrow */
}

/* ── Contenedor del Mega Menú ── */
.mega-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    z-index: 999;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    border-bottom: 3px solid var(--primary, #ff6b00);
}

.mega-menu.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ── Grid Principal del Mega Menú ── */
.mega-menu-grid {
    display: grid;
    /* Redistributed columns: 1fr (categories), 220px (brands), 500px (promos side-by-side) */
    grid-template-columns: 1fr 220px 500px;
    gap: 2rem;
    padding: 2.5rem 2rem;
    align-items: start;
}

/* Spacer (oculto) */
.mega-menu-spacer {
    display: none;
}

/* ── Secciones / Subcategorías ── */
/* ── Secciones / Subcategorías ── */
.mega-menu-sections {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    /* Volver a 2 columnas */
    gap: 1.5rem;
    align-content: start;
    padding: 0 0 1rem 0;
}

.mega-menu-sections h4 {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gray-900, #1a1a2e);
    margin: 0 0 1rem 0; /* Reset margin top */
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary, #ff6b00);
    grid-column: 1 / -1;
    text-align: center;
    /* Título centrado */
}

.mega-menu-item {
    display: flex;
    flex-direction: row;
    /* Volver a fila para 2 columnas */
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.8rem;
    border-radius: 12px;
    background: #f8fafc;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--gray-700, #4b5563);
    border: 1px solid transparent;
}

.mega-menu-item:hover {
    background: white;
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* 3. Fix Iconos Gigantes (Forzar tamaño - Definición original) */
.mega-menu-icon {
    width: 32px;
    /* Iconos más pequeños y uniformes */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mega-menu-icon img,
.mega-menu-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mega-menu-item span {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
}

.mega-menu-item:hover .mega-menu-icon {
    background: var(--primary, #ff6b00);
}

/* Asegurar que la imagen interna respete el contenedor */
.mega-menu-icon img,
.mega-menu-icon svg {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    max-width: 100%;
    max-height: 100%;
}

.mega-menu-item:hover .mega-menu-icon svg {
    fill: #fff;
}

/* ── Marcas ── */
.mega-menu-brands {
    border-left: 1px solid #eee;
    padding-left: 2rem;
}

.mega-menu-brands h4 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gray-900, #1a1a2e);
    margin: 0 0 1rem 0; /* Reset margin top */
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary, #ff6b00);
}

.brands-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 1.5rem;
}

.brands-grid a {
    color: var(--gray-600, #666);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0;
    transition: color 0.2s ease;
}

.brands-grid a:hover {
    color: var(--primary, #ff6b00);
}

/* ── Promo / Imagen destacada (Contenedor) ── */
.mega-menu-promo {
    display: grid;
    /* Changed from block to grid to allow side-by-side */
    grid-template-columns: 1fr 1fr;
    /* Two columns */
    gap: 3.5rem;
    /* Increased gap to separate images more */
    /* Removed wrapper styling because children (.mega-promo-link) handle it */
    position: relative;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.mega-menu-promo img {
    /* Reset default styling if any */
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

.promo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    text-align: center;
}

.promo-overlay span {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--primary, #ff6b00);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    display: inline-block;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .mega-menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .mega-menu-spacer {
        display: none;
    }

    .mega-menu-promo img {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .nav-categories {
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .nav-item-has-mega {
        white-space: nowrap;
        padding: 0.65rem 1rem;
        font-size: 0.78rem;
    }

    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .mega-menu-brands {
        border-left: none;
        border-top: 1px solid #eee;
        padding-left: 0;
        padding-top: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PATCHES: BLACK LABEL & FIXED ICON SIZES
   ═══════════════════════════════════════════════════════════════ */

/* 1. Compatibilidad con clase JS 'mega-promo-link' */
.mega-promo-link {
    position: relative;
    display: block;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    height: 100%;
    /* Fill the grid cell */
}

.mega-promo-link:hover {
    transform: scale(1.02);
}

.mega-promo-link img {
    width: 100%;
    /* Reduced height for side-by-side layout, or aspect-ratio */
    height: 200px;
    object-fit: cover;
    display: block;
}

/* 2. Etiqueta Negra (Black Label) */
.promo-overlay.black-label {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    text-align: center;
    border-radius: 0;
    z-index: 10;
}

.promo-overlay.black-label span {
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
}

/* 3. Fix Iconos Gigantes (Forzar tamaño) */
.mega-menu-icon {
    width: 50px !important;
    /* Tamaño más balanceado para 2 columnas */
    height: 50px !important;
    background: #fff !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px !important;
    border: 2px solid #edf2f7;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mega-menu-item:hover .mega-menu-icon {
    border-color: var(--primary) !important;
    background: white !important;
}

/* Asegurar que la imagen interna respete el contenedor */
.mega-menu-icon img,
.mega-menu-icon svg {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    max-width: 100%;
    max-height: 100%;
}