document.addEventListener('DOMContentLoaded', function () { const loginForm = document.getElementById('loginForm'); if (loginForm) { loginForm.addEventListener('submit', function (e) { e.preventDefault(); const email = document.getElementById('email').value; const password = document.getElementById('password').value; // Basic validation if (!email || !password) { showToast('Error', 'Please fill in all fields.', 'danger'); return; } // Simulate API call showToast('Info', 'Attempting to log in...', 'info'); setTimeout(() => { // Replace with actual authentication logic if (email === 'admin@example.com' && password === 'password') { showToast('Success', 'Login successful! Redirecting...', 'success'); } else { showToast('Error', 'Invalid credentials. Please try again.', 'danger'); } }, 1500); }); } }); function showToast(title, message, type) { const toastContainer = document.getElementById('toast-container'); if (!toastContainer) return; const toastId = 'toast-' + Date.now(); const toastHTML = `