const themeToggle = document.getElementById('theme-toggle'); const iconSun = document.getElementById('icon-sun'); const iconMoon = document.getElementById('icon-moon'); function updateIcons(isDark) { iconSun.classList.toggle('hidden', !isDark); iconMoon.classList.toggle('hidden', isDark); } updateIcons(document.documentElement.classList.contains('dark')); themeToggle.addEventListener('click', () => { const isDark = document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', isDark ? 'dark' : 'light'); updateIcons(isDark); });