// Toast util sin dependencias (compatible con Tailwind) (function(global){ function ensureContainer(){ const id = 'toast-container'; let el = document.getElementById(id); if (!el) { el = document.createElement('div'); el.id = id; el.className = 'fixed bottom-4 right-4 z-50 space-y-2'; document.body.appendChild(el); } return el; } function getStyles(type){ // Mapear tipo -> clases Tailwind switch ((type||'').toLowerCase()) { case 'success': return 'bg-emerald-600 text-white'; case 'danger': case 'error': return 'bg-red-600 text-white'; case 'warning': return 'bg-amber-500 text-white'; default: return 'bg-gray-900 text-white'; // info } } function mostrarToast(mensaje, options){ try { const container = ensureContainer(); const delay = (options && options.delay) || 4000; const type = (options && options.type) || (options && options.variant) || 'info'; const cls = getStyles(type); const toastEl = document.createElement('div'); toastEl.className = 'pointer-events-auto shadow-lg rounded px-4 py-3 text-sm flex items-start gap-3 transition transform translate-y-2 opacity-0 ' + cls; toastEl.setAttribute('role', 'status'); toastEl.innerHTML = `