jQuery(document).ready(function($) {
    // Improved copy function with animation
    $(".copy-shortcode").on("click", function() {
        const shortcode = $(this).data("shortcode");
        const tempInput = $("<input>");
        $("body").append(tempInput);
        tempInput.val(shortcode).select();
        document.execCommand("copy");
        tempInput.remove();
        
        // Animation for successful copy
        $(this).addClass("copied");
        setTimeout(() => {
            $(this).removeClass("copied");
        }, 2000);
    });
    
    // Animation for table rows
    $(".pollbolt-shortcodes-table tbody tr").hover(
        function() {
            $(this).css("transform", "translateY(-1px)");
            $(this).css("transition", "transform 0.2s ease");
        },
        function() {
            $(this).css("transform", "translateY(0)");
        }
    );
    
    // Tab switching functionality
    $(".pollbolt-usage-tabs .nav-tab").on("click", function(e) {
        e.preventDefault();
        
        // Get the tab ID
        var tabId = $(this).data("tab");
        
        // Remove active class from all tabs
        $(".pollbolt-usage-tabs .nav-tab").removeClass("nav-tab-active");
        $(this).addClass("nav-tab-active");
        
        // Hide all tab content
        $(".pollbolt-usage-tabs .tab-content").hide();
        
        // Show the selected tab content
        $("#" + tabId + "-content").show();
    });
});
