function ensureToast() { let container = document.getElementById('authToastContainer'); if (!container) { container = document.createElement('div'); container.id = 'authToastContainer'; container.className = 'position-fixed bottom-0 end-0 p-3'; container.style.zIndex = '9999'; document.body.appendChild(container); } let toast = document.getElementById('authToast'); if (!toast) { toast = document.createElement('div'); toast.id = 'authToast'; toast.className = 'toast align-items-center text-bg-dark border-0'; toast.role = 'alert'; toast.ariaLive = 'assertive'; toast.ariaAtomic = 'true'; toast.innerHTML = '
-
'; container.appendChild(toast); } return toast; } function showToast(message, type = 'info') { if (!message) return; const toastEl = ensureToast(); const toastMsg = document.getElementById('authToastMessage'); const tone = ['success', 'danger', 'warning', 'info', 'dark'].includes(type) ? type : 'dark'; toastEl.className = `toast align-items-center text-bg-${tone} border-0`; toastMsg.textContent = message; const t = new bootstrap.Toast(toastEl, { delay: 4000 }); t.show(); } document.addEventListener('DOMContentLoaded', function() { });