    </main>
</div> <!-- End admin-layout -->

<!-- Common Admin Scripts can go here -->
<script>
    document.addEventListener("DOMContentLoaded", function() {
        const currentLocation = location.href;
        const menuItems = document.querySelectorAll('.sidebar-nav a');
        
        menuItems.forEach(link => {
            if (link.href === currentLocation) {
                // Add active to current
                link.parentElement.classList.add("active");
                
                // If it's inside a submenu, open the parent
                const parentSubmenu = link.closest('.submenu');
                if (parentSubmenu) {
                    parentSubmenu.closest('.has-submenu').classList.add('open');
                }
            }
        });

        // Submenu Toggle Logic
        const toggles = document.querySelectorAll('.submenu-toggle');
        toggles.forEach(toggle => {
            toggle.addEventListener('click', function(e) {
                e.preventDefault();
                const parentLi = this.parentElement;
                parentLi.classList.toggle('open');
            });
        });

        // Mobile Sidebar Logic
        const menuBtn = document.getElementById('mobile-menu-btn');
        const overlay = document.getElementById('sidebar-overlay');
        const adminLayout = document.querySelector('.admin-layout');

        if(menuBtn && overlay) {
            menuBtn.addEventListener('click', function() {
                adminLayout.classList.toggle('sidebar-active');
            });
            
            overlay.addEventListener('click', function() {
                adminLayout.classList.remove('sidebar-active');
            });
        }
    });
</script>
</body>
</html>
