// Notification and confirmation dialog functions function showNotification(message, type = 'success') { const container = document.getElementById('notifications'); if (!container) return; const notification = document.createElement('div'); let bgColor = 'bg-green-500'; if (type === 'error') bgColor = 'bg-red-500'; else if (type === 'warning') bgColor = 'bg-yellow-500'; else if (type === 'info') bgColor = 'bg-blue-500'; notification.classList.add( 'p-4', 'rounded-lg', 'shadow-lg', 'text-white', bgColor, 'transition-all', 'duration-300', 'opacity-0', 'transform', 'translate-y-4' ); notification.textContent = message; container.appendChild(notification); setTimeout(() => { notification.classList.remove('opacity-0', 'translate-y-4'); notification.classList.add('opacity-100', 'translate-y-0'); }, 10); setTimeout(() => { notification.classList.remove('opacity-100', 'translate-y-0'); notification.classList.add('opacity-0', 'translate-y-4'); setTimeout(() => { notification.remove(); }, 300); }, 3000); } function showConfirm(message, callback) { const messageEl = document.getElementById('confirm-message'); const yesBtn = document.getElementById('confirm-yes'); const noBtn = document.getElementById('confirm-no'); const modal = document.getElementById('confirmModal'); if (!messageEl || !yesBtn || !noBtn || !modal) return; messageEl.textContent = message; modal.showModal(); const yesHandler = () => { callback(); modal.close(); yesBtn.removeEventListener('click', yesHandler); noBtn.removeEventListener('click', noHandler); }; const noHandler = () => { modal.close(); yesBtn.removeEventListener('click', yesHandler); noBtn.removeEventListener('click', noHandler); }; yesBtn.addEventListener('click', yesHandler); noBtn.addEventListener('click', noHandler); } window.showNotification = showNotification; window.showConfirm = showConfirm;