import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap';
import '../css/app.css';

document.addEventListener('DOMContentLoaded', function () {
    const searchForm = document.getElementById('searchForm');
    const loadingOverlay = document.getElementById('loadingOverlay');

    if (searchForm && loadingOverlay) {
        searchForm.addEventListener('submit', function () {
            loadingOverlay.classList.add('show');
        });
    }

    const downloadForms = document.querySelectorAll('.download-form');
    if (downloadForms.length && loadingOverlay) {
        downloadForms.forEach(downloadForm => {
            downloadForm.addEventListener('submit', function () {
                loadingOverlay.classList.add('show');
                setTimeout(() => loadingOverlay.classList.remove('show'), 5000);
            });
        });
    }

    const selectAll = document.getElementById('selectAll');
    if (selectAll) {
        selectAll.addEventListener('change', function () {
            document.querySelectorAll('.participant-checkbox').forEach(cb => {
                cb.checked = selectAll.checked;
            });
        });
    }
});
