jQuery(document).ready(function($) {
    $('body').on('click', '[id^="pmrcgold-widget4-"] .pmrcgold-metal-price-tabs__btn', function(e) {
        e.preventDefault();
        var $btn = $(this);
        var $container = $btn.closest('[id^="pmrcgold-widget4-"]');
        var targetTab = $btn.data('tab');
        
        $container.find('.pmrcgold-metal-price-tabs__btn').removeClass('active');
        $btn.addClass('active');
        
        $container.find('.pmrcgold-metal-price-tabs__pane').removeClass('active');
        $container.find('.pmrcgold-metal-price-tabs__pane[data-pane="' + targetTab + '"]').addClass('active');
    });
});
