document.addEventListener('DOMContentLoaded', function() {
    var burgerBtn = document.getElementById('burgerBtnPanel');
    var navMenu = document.getElementById('navMenuPanel');
    var body = document.body;

    if (burgerBtn && navMenu) {
        burgerBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            burgerBtn.classList.toggle('active');
            navMenu.classList.toggle('open');
            body.classList.toggle('panel-menu-open');
        });

        // Fermeture automatique en cliquant n'importe où à l'extérieur
        document.addEventListener('click', function(e) {
            if (!navMenu.contains(e.target) && !burgerBtn.contains(e.target)) {
                burgerBtn.classList.remove('active');
                navMenu.classList.remove('open');
                body.classList.remove('panel-menu-open');
            }
        });
    }
});