                        // Refresh the page after a short delay
                            setTimeout(() => {
                                window.location.reload();
                            }, 2000);
                        } else if (response.error) {
                            // Show error message
                            errorMessage.textContent = response.error;
                            errorAlert.style.display = 'block';
                            showToast("Import failed: " + response.