// Initialize any interactive components or animations document.addEventListener('DOMContentLoaded', function() { // Tooltips for table headers const tableHeaders = document.querySelectorAll('th'); tableHeaders.forEach(header => { header.addEventListener('mouseenter', function() { const description = this.getAttribute('data-tooltip'); if (description) { // Create and show tooltip const tooltip = document.createElement('div'); tooltip.className = 'absolute z-10 bg-black text-white text-xs rounded py-1 px-2'; tooltip.textContent = description; const rect = this.getBoundingClientRect(); tooltip.style.top = `${rect.bottom + window.scrollY}px`; tooltip.style.left = `${rect.left + window.scrollX}px`; document.body.appendChild(tooltip); this._tooltip = tooltip; } }); header.addEventListener('mouseleave', function() { if (this._tooltip) { document.body.removeChild(this._tooltip); delete this._tooltip; } }); }); // Calculate and update dynamic metrics function updateMetrics() { const production = 6700; const limit = 1920; const efficiency = ((limit / production) * 100).toFixed(2); const savings = 4780 * 5; document.querySelector('[data-efficiency]').textContent = `${100 - efficiency}%`; document.querySelector('[data-savings]').textContent = `₹${savings.toLocaleString()}`; } updateMetrics(); });