const Alert = { show(message, type = 'success') { const alert = document.createElement('div'); alert.className = `fixed top-4 right-4 p-4 rounded-md text-white ${ type === 'success' ? 'bg-green-500' : 'bg-red-500' } transition-opacity duration-500`; alert.innerHTML = `
${type === 'success' ? ` ` : ` `} ${message}
`; document.body.appendChild(alert); // Fade in setTimeout(() => { alert.style.opacity = '1'; }, 10); // Fade out and remove setTimeout(() => { alert.style.opacity = '0'; setTimeout(() => { document.body.removeChild(alert); }, 500); }, 3000); } };