document.addEventListener('DOMContentLoaded', function () { console.log('BetPredict Pro loaded'); const themeToggler = document.getElementById('theme-toggler'); const htmlElement = document.documentElement; const sunIcon = 'bi-sun-fill'; const moonIcon = 'bi-moon-fill'; const savedTheme = localStorage.getItem('theme') || 'light'; htmlElement.setAttribute('data-bs-theme', savedTheme); updateIcon(savedTheme); themeToggler.addEventListener('click', () => { const currentTheme = htmlElement.getAttribute('data-bs-theme'); const newTheme = currentTheme === 'light' ? 'dark' : 'light'; htmlElement.setAttribute('data-bs-theme', newTheme); localStorage.setItem('theme', newTheme); updateIcon(newTheme); }); function updateIcon(theme) { const icon = themeToggler.querySelector('i'); if (theme === 'light') { icon.classList.remove(moonIcon); icon.classList.add(sunIcon); } else { icon.classList.remove(sunIcon); icon.classList.add(moonIcon); } } });