// assets/js/script.js
document.addEventListener('DOMContentLoaded', () => {
    console.log('WCS Admin loaded');

    // Hamburger Menu Logic
    const hamburger = document.querySelector(".hamburger");
    const navMenu = document.querySelector(".nav-menu");

    if (hamburger) {
        hamburger.addEventListener("click", () => {
            hamburger.classList.toggle("active");
            navMenu.classList.toggle("active");
        });
    }

    // Mobile Dropdown Toggle (Tap to open)
    const dropdowns = document.querySelectorAll(".dropdown");
    dropdowns.forEach(drop => {
        drop.addEventListener("click", (e) => {
            // Only on mobile where hover doesn't work well
            if (window.innerWidth <= 768) {
                // Prevent navigating if clicking the parent link
                // If the click target is the link itself (Attendance), toggle active
                // But if it's a child link, let it go.
                if (e.target.classList.contains('dropbtn') || e.target.parentElement.classList.contains('dropbtn')) {
                    e.preventDefault();
                    drop.classList.toggle("active");
                }
            }
        });
    });
});
