indow.location.search).get('period') || '30days';
    const url = `/analytics/export?format=${format}&period=${period}`;
    
    // Create temporary download link
    const link = document.createElement('a');
    link.href = url;
    link.download = `analytics-${period}.${format}`;
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}

// Interactive metric card details
function showMetricDetails(card, index) {
    const metricTypes = ['Revenue', 'Equipment', 'Custom