/* Toast Notification System */

const Toast = {
    container: '#toast-container',
    
    show: function(message, type = 'success', duration = 3000) {
        const id = 'toast-' + Math.floor(Math.random() * 1000);
        let icon = 'fas fa-check-circle';
        
        switch (type) {
            case 'danger': icon = 'fas fa-exclamation-circle'; break;
            case 'warning': icon = 'fas fa-exclamation-triangle'; break;
            case 'info': icon = 'fas fa-info-circle'; break;
        }
        
        const html = `
            <div id="${id}" class="toast toast-${type}">
                <i class="${icon}"></i>
                <span>${message}</span>
            </div>
        `;
        
        $(this.container).append(html);
        
        // Auto-remove
        setTimeout(() => {
            $(`#${id}`).fadeOut(300, function() {
                $(this).remove();
            });
        }, duration);
    },
    
    success: function(msg) { this.show(msg, 'success'); },
    danger: function(msg) { this.show(msg, 'danger'); },
    warning: function(msg) { this.show(msg, 'warning'); },
    info: function(msg) { this.show(msg, 'info'); }
};
