// Theme toggle functionality function initTheme() { const themeToggle = document.getElementById('themeToggle'); const moonIcon = themeToggle.querySelector('i'); // Check for saved theme or prefer-color-scheme const savedTheme = localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'); if (savedTheme === 'dark') { document.documentElement.classList.add('dark'); moonIcon.setAttribute('data-feather', 'sun'); } else { document.documentElement.classList.remove('dark'); moonIcon.setAttribute('data-feather', 'moon'); } // Toggle theme on button click themeToggle.addEventListener('click', () => { if (document.documentElement.classList.contains('dark')) { document.documentElement.classList.remove('dark'); localStorage.setItem('theme', 'light'); moonIcon.setAttribute('data-feather', 'moon'); } else { document.documentElement.classList.add('dark'); localStorage.setItem('theme', 'dark'); moonIcon.setAttribute('data-feather', 'sun'); } feather.replace(); }); } document.addEventListener('DOMContentLoaded', function() { initTheme(); // Form submission handler // Update the form container class for dark mode const authContainer = document.querySelector('.bg-white'); if (authContainer) { authContainer.classList.add('auth-container', 'transition-colors', 'duration-300'); } const loginForm = document.querySelector('form'); if (loginForm) { loginForm.addEventListener('submit', function(e) { e.preventDefault(); // Get form values const email = this.querySelector('input[type="email"]').value; const password = this.querySelector('input[type="password"]').value; // Simple validation if (!email || !password) { alert('Please fill in all fields'); return; } // In a real app, you would send this to your backend console.log('Login attempt with:', { email, password }); // Show loading state const submitBtn = this.querySelector('button[type="submit"]'); const originalBtnText = submitBtn.innerHTML; submitBtn.innerHTML = ` Signing in... `; submitBtn.disabled = true; // Simulate API call setTimeout(() => { submitBtn.innerHTML = originalBtnText; submitBtn.disabled = false; // For demo purposes, just show a success message alert('Login successful! (This is a demo)'); }, 2000); }); } // Social login button handlers document.querySelectorAll('.social-login button').forEach(btn => { btn.addEventListener('click', function() { const platform = this.querySelector('i').getAttribute('data-feather'); alert(`Sign in with ${platform.charAt(0).toUpperCase() + platform.slice(1)} clicked`); }); }); });