function initTabs() {
  const tabHeaders = document.querySelectorAll('.tab-header');
  const tabContents = document.querySelectorAll('.tab-content');

  tabHeaders.forEach(header => {
    header.addEventListener('click', () => {
      const targetId = header.dataset.tabTarget;

      tabHeaders.forEach(h => h.classList.remove('active'));
      tabContents.forEach(content => content.classList.remove('active'));

      header.classList.add('active');
      document.querySelector(targetId).classList.add('active');
    });
  });

  // Activate the first tab by default
  if (tabHeaders.length > 0) {
    tabHeaders[0].click();
  }
}

export default initTabs;
