/* sidebar-fix.css - CSS para arreglar la animación del sidebar y reducir altura de subcategorías */

/* CRITICAL FIX: Override global CSS animations for consistent left-to-right sidebar animation */
.productsSidebar, 
.productsSidebar.active, 
.productsSidebar.hide,
.leftNav,
.leftNav.active,
.leftNav.hide {
    animation: none !important;
    transition: transform 0.3s ease-out !important;
}

/* Ensure sidebar starts hidden to the left (not right) */
.productsSidebar,
.leftNav {
    transform: translateX(-100%) !important;
}

/* Sidebar visible state - slides in from left to right */
.productsSidebar.active,
.leftNav.active {
    transform: translateX(0) !important;
}

/* Make sure sidebar has proper transition effects */
.productsSidebar {
    display: block;
    position: fixed;
    z-index: 1000;
    width: 350px !important;
    height: 100%;
    top: 0;
    left: 0;
    background-color: #fff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    transition: transform 0.3s ease-out !important;
}

/* Rotación de flecha para categorías expandidas */
.fa-angle-right.rotated {
    transform: rotate(90deg);
    transition: transform 0.3s ease;
}

/* Transición suave para las flechas */
.fa-angle-right {
    transition: transform 0.3s ease;
}

/* Estilos para submenu visible - con !important para mayor precedencia */
.productsSidebar ul.son.active {
    display: block !important;
    max-height: 1000px !important;
    height: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    transition: all 0.3s ease !important;
}

/* Asegurar que los submenús ocultos están realmente ocultos */
.productsSidebar ul.son:not(.active) {
    display: none !important;
    max-height: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

/* ===== ESTRATEGIA EQUILIBRADA: REDUCIR ALTURA MANTENIENDO LEGIBILIDAD ===== */

/* Categorías principales - ALTURA BALANCEADA */
.productsSidebar dd > ul > li {
    margin-bottom: 2px !important;
    padding-bottom: 0 !important;
    border-bottom: 1px solid rgba(191, 222, 19, 0.25) !important; /* Restaurar líneas verdes */
}

/* Enlaces de categorías principales - ALTURA MODERADA */
.productsSidebar dd > ul > li > a {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 6px 15px !important;
    min-height: 42px !important; /* Aumentado de 37px a 42px (+5px) */
    height: 42px !important;
    line-height: 1.2 !important;
}

/* Subcategorías - ALTURA PARA 2 LÍNEAS */
.productsSidebar dd > ul > li > ul.son > li {
    line-height: 1.2 !important;
    min-height: 35px !important; /* Aumentado de 32px a 35px (+3px) */
    height: auto !important; /* Permitir altura variable */
    max-height: 45px !important; /* Aumentado de 42px a 45px (+3px) */
    padding: 0 !important;
    margin: 1px 0 !important;
    overflow: hidden !important;
    border-bottom: 1px solid rgba(230, 230, 230, 0.3) !important; /* Líneas sutiles entre subcategorías */
}

/* Enlaces de subcategorías - ALTURA PARA 2 LÍNEAS */
.productsSidebar dd > ul > li > ul.son > li > a {
    line-height: 1.2 !important;
    padding: 5px 35px 5px 25px !important;
    min-height: 35px !important; /* Aumentado de 32px a 35px (+3px) */
    height: auto !important; /* Permitir altura variable */
    max-height: 45px !important; /* Aumentado de 42px a 45px (+3px) */
    font-size: 12px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important; /* Permitir wrap de texto */
    word-wrap: break-word !important;
    display: block !important;
    margin: 0 !important;
    border: none !important;
}

/* Contenedor de subcategorías - ALTURA CONTROLADA */
.productsSidebar dd > ul > li > ul.son {
    padding: 3px 0 !important;
    margin: 0 !important;
    max-height: 280px !important; /* Altura máxima controlada */
    overflow-y: auto !important;
    border: none !important;
    border-top: 1px solid rgba(191, 222, 19, 0.2) !important; /* Línea superior verde */
}

/* Cuando las subcategorías están activas - ESPACIADO CONTROLADO */
.productsSidebar dd > ul > li > ul.son.active {
    margin-bottom: 6px !important;
    padding-bottom: 3px !important;
    border-bottom: 1px solid rgba(191, 222, 19, 0.3) !important; /* Línea inferior verde más visible */
}

/* Flecha posicionada correctamente */
.productsSidebar dd > ul > li > a .fa-angle-right {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    font-size: 12px !important;
    position: static !important;
    transform: none !important;
}

.productsSidebar dd > ul > li > a .fa-angle-right.rotated {
    transform: rotate(90deg) !important;
}

/* ===== ESTILOS DE HOVER MEJORADOS - EQUILIBRADOS ===== */

/* Hover para categorías principales */
.productsSidebar dd > ul > li > a:hover {
    background-color: #f8f9fa !important;
    color: #198754 !important;
    transition: all 0.2s ease !important;
    border-left: 3px solid #bfde13 !important;
}

/* Hover para subcategorías - ALTURA ADECUADA PARA 2 LÍNEAS */
.productsSidebar dd > ul > li > ul.son > li > a:hover {
    background-color: #f8f9fa !important;
    color: #198754 !important;
    border-left: 3px solid #bfde13 !important;
    padding-left: 22px !important;
    transition: all 0.2s ease !important;
    height: auto !important;
    max-height: 50px !important; /* Permitir más altura en hover para textos largos */
    white-space: normal !important;
    overflow: visible !important;
    word-wrap: break-word !important;
    z-index: 10 !important;
    position: relative !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
    line-height: 1.2 !important;
}

/* Scrollbar personalizado para subcategorías */
.productsSidebar dd > ul > li > ul.son::-webkit-scrollbar {
    width: 3px;
}

.productsSidebar dd > ul > li > ul.son::-webkit-scrollbar-track {
    background: #f9f9f9;
    border-radius: 1px;
}

.productsSidebar dd > ul > li > ul.son::-webkit-scrollbar-thumb {
    background: #bfde13;
    border-radius: 1px;
}

.productsSidebar dd > ul > li > ul.son::-webkit-scrollbar-thumb:hover {
    background: #9bc211;
}

/* ===== ESPECÍFICO PARA CATEGORÍAS PROBLEMÁTICAS - EQUILIBRADO ===== */

/* Herramientas Alámbricas y Manuales - ALTURA CONTROLADA */
.productsSidebar dd > ul > li:nth-child(2) > ul.son.active,  /* Herramientas Alámbricas */
.productsSidebar dd > ul > li:nth-child(3) > ul.son.active {  /* Herramientas Manuales */
    max-height: 260px !important;
    overflow-y: auto !important;
    margin-bottom: 8px !important;
    padding-bottom: 4px !important;
    border-bottom: 2px solid rgba(191, 222, 19, 0.4) !important; /* Línea más visible */
}

/* Subcategorías específicas - ALTURA EQUILIBRADA */
.productsSidebar dd > ul > li:nth-child(2) > ul.son > li,
.productsSidebar dd > ul > li:nth-child(3) > ul.son > li {
    height: auto !important;
    min-height: 33px !important; /* Aumentado de 30px a 33px (+3px) */
    max-height: 43px !important; /* Aumentado de 40px a 43px (+3px) */
    margin: 1px 0 !important;
}

.productsSidebar dd > ul > li:nth-child(2) > ul.son > li > a,
.productsSidebar dd > ul > li:nth-child(3) > ul.son > li > a {
    height: auto !important;
    min-height: 33px !important; /* Aumentado de 30px a 33px (+3px) */
    max-height: 43px !important; /* Aumentado de 40px a 43px (+3px) */
    padding: 4px 35px 4px 25px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    white-space: normal !important; /* Permitir wrap */
    word-wrap: break-word !important;
}

/* ===== OVERRIDE TODAS LAS REGLAS DE ESPACIADO PREVIAS ===== */
.productsSidebar dd > ul > li.has-active-subcategories,
.productsSidebar dd > ul > li[data-category="herramientas-alambricas"],
.productsSidebar dd > ul > li[data-category="herramientas-manuales"] {
    margin-bottom: 3px !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

/* Eliminar todos los espaciados adicionales */
.productsSidebar dd > ul > li > ul.son.active ~ *,
.productsSidebar dd > ul > li:has(ul.son.active) + li {
    margin-top: 0 !important;
    border-top: none !important;
    padding-top: 0 !important;
}

/* Contenedor principal sin padding adicional */
.productsSidebar dd > ul {
    padding-bottom: 10px !important;
}

/* Focus state para accesibilidad */
.productsSidebar a:focus {
    outline: 1px solid #2d8b2d !important;
    outline-offset: -1px !important;
    background-color: rgba(45, 139, 45, 0.1) !important;
}

/* Botón de cerrar */
.productsSidebar .fa-close:hover {
    background-color: rgba(255, 59, 48, 0.1) !important;
    color: #ff3b30 !important;
    transform: scale(1.1) !important;
    border-radius: 50% !important;
    transition: all 0.2s ease !important;
}

/* ===== BREADCRUMB EN UNA SOLA LÍNEA ===== */

/* Hacer que el breadcrumb ocupe una sola línea */
.position {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    display: block !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    padding: 8px 0 !important;
    margin-bottom: 15px !important;
}

/* En pantallas móviles, hacer el texto aún más pequeño */
@media (max-width: 768px) {
    .position {
        font-size: 12px !important;
        padding: 6px 0 !important;
        margin-bottom: 10px !important;
    }
    
    .position a {
        font-size: inherit !important;
    }
    
    .position i {
        font-size: 11px !important;
        margin-right: 3px !important;
    }
}

/* En pantallas muy pequeñas, hacer el texto incluso más compacto */
@media (max-width: 480px) {
    .position {
        font-size: 11px !important;
        padding: 4px 0 !important;
    }
    
    .position i {
        font-size: 10px !important;
        margin-right: 2px !important;
    }
}

/* Mobile Header Additional Fixes - para complementar los estilos inline en menu.html */
@media (max-width: 768px) {
    /* Asegurar que no haya elementos flotantes que interfieran con flexbox */
    .moblie_head .clear {
        display: none !important;
    }
    
    /* Fix para cualquier margen o padding extra que pueda afectar el centrado */
    .moblie_head * {
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Reaplcar padding solo al contenedor principal */
    .moblie_head {
        padding: 0 15px !important;
    }
    
    /* Asegurar que el logo no tenga espacios extra */
    .moblie_head .lf .logo {
        text-decoration: none !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    
    /* Mejorar el fondo del menú móvil */
    .a_txt {
        background-color: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(2px) !important;
    }
    
    .a_txt.active {
        background-color: rgba(0, 0, 0, 0.7) !important;
    }
}
