/*
 * --------------------------------------------------------------------------
 * ESTILOS ENCAPSULADOS: TOPBAR PÚBLICO (Paleta Corporativa ROSVER)
 * --------------------------------------------------------------------------
 * #FF0000 → Rojo Intenso (Acentos, Hover, Activo)
 * #000000 → Negro Puro   (Texto principal, Menú)
 * #FFFFFF → Blanco        (Fondo base)
 */

.rosver-header {
    background-color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 900;
}

/* =============================================
   MEGA-MENÚ DE CATEGORÍAS — Estilo PC Factory + Paleta Rosver
   ============================================= */

/* Trigger nav item */
.mega-menu-trigger { position: static; }

/* Flecha chevron del nav link */
.mega-chevron {
    font-size: 0.65rem;
    margin-left: 4px;
    transition: transform 0.25s ease;
    vertical-align: middle;
}
body.mega-open .mega-chevron { transform: rotate(180deg); }

/* Overlay (oculto para actuar como dropdown simple) */
.mega-overlay {
    display: none;
}

/* Contenedor fijo */
.rosver-mega-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    z-index: 9990;
    pointer-events: none;
    visibility: hidden;
}
.rosver-mega-menu.open {
    visibility: visible;
}

/* Panel principal */
.mega-panel {
    position: fixed;
    top: 90px; /* Fallback, JS lo ajusta */
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: min(1060px, 96vw);
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #cbd5e1;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9995;
    max-height: 78vh;
    background-color: #ffffff;
    pointer-events: auto; /* Permitir clicks en su contenido */
}
.rosver-mega-menu.open .mega-panel {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── SIDEBAR IZQUIERDA ─── */
.mega-sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: #ffffff;
    border-right: 1px solid #e8ecf0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
}
.mega-sidebar::-webkit-scrollbar { display: none; }

/* Header del sidebar */
.mega-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e8ecf0;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.2px;
    flex-shrink: 0;
    text-transform: uppercase;
}
.mega-sidebar-header i:first-child {
    color: #e30613;
    font-size: 1rem;
}

/* Lista de categorías */
.mega-cat-list {
    list-style: none;
    padding: 6px 0;
    margin: 0;
    flex: 1;
}

.mega-cat-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 11px 18px;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 400;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-left: 3px solid transparent;
}
.mega-cat-item:hover,
.mega-cat-item.active {
    background-color: #fff5f5;
    color: #e30613;
    border-left-color: #e30613;
    font-weight: 500;
}
.mega-cat-item.active {
    background-color: #fff5f5;
}

.cat-nombre { flex: 1; }

.cat-arrow {
    font-size: 0.7rem;
    color: #94a3b8;
    transition: transform 0.15s ease;
}
.mega-cat-item:hover .cat-arrow,
.mega-cat-item.active .cat-arrow {
    color: #e30613;
    transform: translateX(2px);
}

/* ─── PANEL DERECHO: Subcategorías ─── */
.mega-content {
    flex: 1;
    background-color: #ffffff;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.mega-subcat-panel {
    display: none;
    padding: 20px 28px 28px;
    animation: fadeInPanel 0.18s ease;
}
.mega-subcat-panel.active { display: block; }

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateX(6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Header del panel (nombre cat + "Ver categoría") */
.subcat-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e30613; /* Línea roja Rosver */
}
.subcat-cat-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    flex: 1;
}
.btn-ver-categoria {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #e30613;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: gap 0.15s ease;
}
.btn-ver-categoria:hover { gap: 8px; }
.btn-ver-categoria i { font-size: 0.75rem; }

/* Grid de grupos de sub-categorías */
.subcat-grupos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px 30px;
}

/* Cada grupo */
.subcat-grupo {
    margin-bottom: 10px;
}
.subcat-grupo-titulo {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 8px 0;
    padding-bottom: 4px;
}

.subcat-grupo-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Link de sub-categoría */
.subcat-grupo-link {
    display: block;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    padding: 4px 0;
    transition: color 0.15s ease;
    line-height: 1.4;
}
.subcat-grupo-link:hover {
    color: #e30613;
}
/* Link destacado = "Ver todo X" en rojo */
.subcat-grupo-link.destacado {
    color: #e30613;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 4px;
}
.subcat-grupo-link.destacado:hover {
    text-decoration: underline;
}

/* Ocultar en móvil */
@media (max-width: 991px) {
    .rosver-mega-menu { display: none; }
    .mega-chevron     { display: none; }
}


/* =============================================
   FILA SUPERIOR
   ============================================= */
.rosver-top-bar {
    background-color: #FFFFFF;
    border-bottom: 1px solid #f0f0f0;
}

/* Redes sociales */
.rosver-social-icons .social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #FFFFFF;
    font-size: 15px;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Colores oficiales de cada red */
.social-icon.facebook  { color: #1877F2; }
.social-icon.tiktok    { color: #000000; }
.social-icon.instagram { color: #E1306C; }
.social-icon.whatsapp  { color: #25D366; }

.rosver-social-icons .social-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* Buscador */
.rosver-search-container {
    width: 300px;
}

.rosver-search-input {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    font-size: 14px;
    padding: 8px 16px;
    padding-right: 40px;
    color: #000000;
    box-shadow: none;
    transition: all 0.25s ease;
}

.rosver-search-input:focus {
    background-color: #FFFFFF;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
    outline: none;
}

.rosver-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    font-size: 14px;
}

/* =============================================
   FILA PRINCIPAL
   ============================================= */
.rosver-main-nav {
    background-color: #FFFFFF;
}

.brand-logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

/* Menú principal */
.rosver-nav-menu {
    gap: 36px;
}

.rosver-nav-link {
    color: #000000;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 6px 0;
    position: relative;
    transition: color 0.2s ease;
    white-space: nowrap;
}

/* Línea inferior decorativa */
.rosver-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #FF0000;
    transition: width 0.25s ease;
}

/* Hover y estado activo → Rojo */
.rosver-nav-link:hover,
.rosver-nav-link.activo {
    color: #FF0000;
}

.rosver-nav-link:hover::after,
.rosver-nav-link.activo::after {
    width: 100%;
}

/* Acciones */
.rosver-nav-actions {
    flex-shrink: 0;
}

/* Botón Hamburguesa */
.rosver-menu-toggle {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #000000;
    padding: 2px 4px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.rosver-menu-toggle:hover {
    color: #FF0000;
}

/* =============================================
   RESPONSIVIDAD - CELULARES
   ============================================= */
@media (max-width: 991px) {
    .brand-logo-img {
        height: 40px;
    }

    .rosver-menu-wrapper {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #FFFFFF;
        padding: 20px 16px 24px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
        border-top: 2px solid #FF0000;
        z-index: 999;
        max-height: calc(100vh - 120px); /* Altura máxima dinámica restando el header */
        overflow-y: auto; /* Permitir scroll dentro del menú móvil */
    }

    .rosver-menu-wrapper.active {
        display: block;
    }

    .rosver-nav-menu {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0 !important;
    }

    .rosver-nav-menu li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .rosver-nav-link {
        display: block;
        padding: 14px 4px;
        font-size: 15px;
        width: 100%;
    }

    .rosver-nav-link::after {
        display: none;
    }

    /* --- MENÚ DE CATEGORÍAS ACORDEÓN PARA MÓVIL --- */
    .mobile-categories-dropdown {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        width: 100%;
        background-color: #f8fafc;
    }
    .mobile-categories-dropdown.open {
        max-height: 2000px; /* altura suficiente para todas las categorías */
    }

    .mobile-cat-list {
        margin-bottom: 0;
    }

    .mobile-cat-item {
        border-bottom: 1px solid #f1f5f9;
        width: 100% !important;
    }
    
    .mobile-cat-header {
        cursor: pointer;
        font-size: 0.92rem;
        font-weight: 600;
        color: #334155;
        transition: background-color 0.2s, color 0.2s;
        user-select: none;
    }
    
    .mobile-cat-chevron {
        font-size: 0.75rem;
        transition: transform 0.25s ease;
        color: #64748b;
    }
    .mobile-cat-item.open > .mobile-cat-header > .mobile-cat-chevron {
        transform: rotate(180deg);
        color: #e30613;
    }
    .mobile-cat-item.open > .mobile-cat-header {
        background-color: #fff5f5;
        color: #e30613;
    }

    .mobile-subcat-wrapper {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: #ffffff;
    }
    .mobile-cat-item.open > .mobile-subcat-wrapper {
        max-height: 1200px;
    }

    .mobile-subcat-link {
        color: #475569;
        font-size: 0.86rem;
        text-decoration: none;
        transition: color 0.15s;
        padding-left: 8px;
        border-left: 2px solid transparent;
    }
    .mobile-subcat-link:hover,
    .mobile-subcat-link.text-danger {
        border-left-color: #e30613;
    }
}
