jQuery(document).ready(function($) {
    // Показване на детайли
    $('.view-details').click(function() {
        var validation = JSON.parse($(this).data('validation'));
        var failures = JSON.parse($(this).data('failures'));
        
        var details = {
            validation: validation,
            failures: failures
        };
        
        $('#log-details-content').html(JSON.stringify(details, null, 2));
        $('#formshield-log-details').show();
    });
    
    // Затваряне на детайлите
    $(document).mouseup(function(e) {
        var container = $("#formshield-log-details");
        if (!container.is(e.target) && container.has(e.target).length === 0) {
            container.hide();
        }
    });
});
