        }
            }
        });
    }

    // Add responsive handling
    window.addEventListener('resize', handleMobileResize);
    window.addEventListener('load', handleMobileResize);
    
    // Modal Tree View Functions
    let modalCurrentView = 'tree';
    let modalTreeData = null;
    
    function switchModalView(view) {
        modalCurrentView = view;
        
        const listViewBtn = document.getElementById('modalListViewBtn');
        const treeViewBtn = document.getElementById('modalTree