// dark-mode.js
const toggleButton = document.getElementById('dark-mode-toggle');
const body = document.body;

// Vérifie si le mode sombre est déjà activé
if (localStorage.getItem('darkMode') === 'enabled') {
    body.classList.add('dark-mode');
    toggleButton.textContent = 'Désactiver le mode sombre';
}

// Bascule entre mode sombre et clair
toggleButton.addEventListener('click', () => {
    body.classList.toggle('dark-mode');

    if (body.classList.contains('dark-mode')) {
        localStorage.setItem('darkMode', 'enabled');
        toggleButton.textContent = 'Désactiver le mode sombre';
    } else {
        localStorage.setItem('darkMode', 'disabled');
        toggleButton.textContent = 'Activer le mode sombre';
    }
});
