
/* Estilos del menú lateral (niveles 1-2) */
.lateral-menu {
    > ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
        
        > li.menu-item {
            border-bottom: 1px solid var(--border-light);
            
            &:last-child {
                border-bottom: none;
            }
            
            .menu-label {
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 12px 0;
                color: var(--text-color);
                text-decoration: none;
                font-weight: 500;
                font-size: 16px;
                cursor: pointer;
                transition: color 0.3s;
                
                &:hover {
                    color: var(--primary-color);
                }
                
                .menu-arrow {
                    font-size: 18px;
                    transition: transform 0.3s ease;
                    display: none;
                }
                
                &.menu-clickable .menu-arrow {
                    display: inline-block;
                }
            }
            
            .menu-submenu {
                list-style-type: none;
                border-left: 2px solid var(--border-light);
                max-height: 0;
                overflow: hidden;
                transition: all 0.5s ease;
                opacity: 0;
                padding: 0;
                
                > li.menu-item {
                    border-bottom: none;                    
                    .menu-label {
                        padding: 8px 0 8px 12px;
                        font-size: 16px;
                        font-weight: 300;
                        
                        .menu-arrow {
                            display: none;
                        }
                        
                        &.menu-clickable .menu-arrow {
                            display: inline-block;
                        }
                    }
                }
            }
            
            &.open .menu-submenu {
                opacity: 1;
                max-height: 1000px;
                padding: 8px 0 8px 0;
            }
        }
    }
}

.recursive-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}


@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

.recursive-menu {
    list-style-type: none;
    margin: 0;
    padding: 0;
    
    ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }
    
    li.menu-item {
        border-bottom: 1px solid var(--border-light);
        
        &:last-child {
            border-bottom: none;
        }
        
        .menu-label {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 0;
            color: var(--text-color);
            text-decoration: none;
            font-weight: 500;
            font-size: 16px;
            cursor: pointer;
            transition: color 0.3s;
            
            &:hover {
                color: var(--primary-color);
            }
            
            a {
                display: flex;
                align-items: center;
                justify-content: space-between;
                width: 100%;
                color: inherit;
                text-decoration: none;
            }
            
            .menu-arrow {
                font-size: 18px;
                transition: transform 0.3s ease;
                display: none;
            }
            
            &.menu-clickable .menu-arrow {
                display: inline-block;
            }
        }
        
        .submenu-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
            opacity: 0;
            padding: 0;
            border-left: 2px solid var(--border-light);
        }
        
        &.open > .submenu-content {
            max-height: 2000px;
            opacity: 1;
            padding: 8px 0 8px 12px;
        }
    }
}

/* Rotación de flecha al abrirse - Solo para el label directo */
.lateral-menu > ul > li.menu-item.open > .menu-label .menu-arrow {
    transform: rotate(180deg);
}

.lateral-menu .menu-submenu > li.menu-item.open > .menu-label .menu-arrow {
    transform: rotate(180deg);
}

.recursive-menu li.menu-item.open > .menu-label .menu-arrow {
    transform: rotate(180deg);
}


#menu-principal {
    position: fixed;
    top: 0;
    left: calc(-100% - 100dvw);
    transition: all 0.3s ease-in-out;
    width: 100%;
    height: 100vh;
    z-index: 1000;
    .fixed-menu {
        width: 20dvw;
        min-width: 400px;
        height: 100vh;
        background-color: var(--white);
        box-shadow: 0px 0px 15px 5px var(--shadow-dark);
        padding: 25px;        
        overflow-x: hidden;
        overflow-y: scroll;
        display: flex;
        flex-direction: column;
        z-index: 1000;
        gap: 20px;
        display: inline-block;
        #menu-wrapper {
            flex: 1;
        }
    }
}


#menu-header {
    i {
        font-size: 30px;
        cursor: pointer;
        line-height: 14px;
        display: block;
        &.close {
            display: none;
            font-size: 25px;
            position: fixed;
            left: calc(20dvw + 35px);
            color: var(--black);
            background: var(--white);
            line-height: 55px;
            width: 55px;
            border-radius: 50%;
            text-align: center;
            top: 20px;
            box-shadow: 0px 0px 10px 5px var(--shadow-dark);
            transition: background-color 0.3s, color 0.3s, transform 0.5s, scale 0.3s;
            &:hover {
                background-color: var(--secondary-color);
                transform: rotate(90deg) scale(1.1);
                color: var(--white);
            }
        }
        &.ri-home-line {
            font-size: 22px;
            line-height: 25px;
        }
    }
}

/* Botón de atrás para menú recursivo */
.menu-back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    flex-direction: row;
    flex-wrap: wrap;
    
    i {
        font-size: 18px;
    }
    
    &:hover {
        color: var(--secondary-color);
        transform: translateX(-4px);
    }
}

/* Wrapper para menú recursivo */
.recursive-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#menu-wrapper {
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.3s ease;
    
    &.slide-out-left {
        opacity: 0;
        transform: translateX(-100%);
    }
    
    &.slide-out-right {
        opacity: 0;
        transform: translateX(100%);
    }
    
    &.slide-in-right {
        animation: slideInRight 0.3s ease forwards;
    }
}

/* Estilos para resultados de búsqueda profunda */
.search-results-list {
    .menu-label {
        justify-content: flex-start !important;
    }
}