/*---------- Products Tab Switching ----------*/
/* =====  ===== */
$(document).ready(function () {

    var productTabs = document.querySelector('.products .tab-buttons'); // Tabs container

    // Handle tab button clicks
    productTabs.addEventListener('click', function (e) {

        // Check if a non-active tab button was clicked
        if (e.target.classList.contains('button') && !e.target.classList.contains('active')) {

            var target = e.target.getAttribute('data-target'); // Get target section selector

            // Update active tab button
            productTabs.querySelector('.active').classList.remove('active');
            e.target.classList.add('active');

            var productSection = document.querySelector('.products'); // Products container

            // Update active section
            productSection.querySelector('.section-tab.active').classList.remove('active');
            productSection.querySelector(target).classList.add('active');

        }

    });

});