/**
 * WhatsApp CRM Global App JS Helpers
 */
const App = {
    toast(message, type = 'info') {
        const container = document.getElementById('toast-container');
        if (!container) return;

        const toast = document.createElement('div');
        let icon = '<i class="fa-solid fa-info-circle"></i>';
        let bgClass = 'bg-slate-800 text-slate-100 border-slate-700';

        if (type === 'success') {
            icon = '<i class="fa-solid fa-circle-check text-emerald-400"></i>';
            bgClass = 'bg-slate-900 text-slate-100 border-emerald-500/40 shadow-emerald-500/10';
        } else if (type === 'error') {
            icon = '<i class="fa-solid fa-circle-exclamation text-red-400"></i>';
            bgClass = 'bg-slate-900 text-slate-100 border-red-500/40 shadow-red-500/10';
        } else if (type === 'warning') {
            icon = '<i class="fa-solid fa-triangle-exclamation text-amber-400"></i>';
            bgClass = 'bg-slate-900 text-slate-100 border-amber-500/40 shadow-amber-500/10';
        }

        toast.className = `pointer-events-auto flex items-center space-x-3 px-4 py-3 rounded-2xl border shadow-xl text-xs font-medium animate-fade-in ${bgClass} transition-all`;
        toast.innerHTML = `
            <span>${icon}</span>
            <span>${message}</span>
        `;

        container.appendChild(toast);

        setTimeout(() => {
            toast.style.opacity = '0';
            toast.style.transform = 'translateY(10px)';
            setTimeout(() => toast.remove(), 300);
        }, 3500);
    }
};
