       
            if (data.success) {
                showSuccess('Database optimization completed successfully!');
                setTimeout(() => {
                    window.location.reload();
                }, 2000);
            } else {
                showError('Error optimizing database: ' + (data.error || 'Unknown error'));
            }
        } catch (error) {
            hideLoading();
            showError('Error optimizing database: ' + error.message);
        }
    }

    async function c