.elementor-kit-7{--e-global-color-primary:#181818;--e-global-color-secondary:#F6F6F6;--e-global-color-text:#181818;--e-global-color-accent:#EF402D;--e-global-typography-primary-font-family:"Roboto";--e-global-typography-primary-font-weight:600;--e-global-typography-secondary-font-family:"Roboto Slab";--e-global-typography-secondary-font-weight:400;--e-global-typography-text-font-family:"Roboto";--e-global-typography-text-font-weight:400;--e-global-typography-accent-font-family:"Roboto";--e-global-typography-accent-font-weight:500;}.elementor-kit-7 e-page-transition{background-color:#FFBC7D;}.elementor-section.elementor-section-boxed > .elementor-container{max-width:1340px;}.e-con{--container-max-width:1340px;}.elementor-widget:not(:last-child){margin-block-end:20px;}.elementor-element{--widgets-spacing:20px 20px;--widgets-spacing-row:20px;--widgets-spacing-column:20px;}{}h1.entry-title{display:var(--page-title-display);}@media(max-width:991px){.elementor-section.elementor-section-boxed > .elementor-container{max-width:1024px;}.e-con{--container-max-width:1024px;}}@media(max-width:575px){.elementor-section.elementor-section-boxed > .elementor-container{max-width:767px;}.e-con{--container-max-width:767px;}}/* Start custom CSS */<script>
document.addEventListener('DOMContentLoaded', function() {
    // ---------- PARTEA 1: Buton produs → Pop-up + hidden field ----------
    var popupId = 25184; // INLOCUIESTE cu ID-ul real al pop-up-ului tau

    jQuery(document).on('click', '.cabi-download-btn', function(e) {
        e.preventDefault();

        var fileSlug = jQuery(this).data('file'); // ex: "cabiwires-silicone-high-temp-sensor-abc722-v1"

        // Deschidem pop-up-ul
        if (typeof elementorProFrontend !== 'undefined' && elementorProFrontend.modules && elementorProFrontend.modules.popup) {
            elementorProFrontend.modules.popup.showPopup({id: popupId});
        }

        // Când pop-up-ul se afișează, setăm valoarea câmpului hidden "file"
        jQuery(document).one('elementor/popup/show', function() {
            jQuery('.elementor-popup-modal form').find('input[name*="form_fields[file]"]').val(fileSlug);
        });
    });

    // ---------- PARTEA 2: Pagina thank-you → setează linkul butonului ----------
    const urlParams = new URLSearchParams(window.location.search);
    const fileParam = urlParams.get('file');

    if (fileParam) {
        const pdfUrl = '/files/' + fileParam + '.pdf';
        const btn = document.getElementById('download-btn');
        if (btn) {
            btn.setAttribute('href', pdfUrl);
            btn.setAttribute('target', '_blank');
            btn.setAttribute('rel', 'noopener');
        }
    }
});
</script>/* End custom CSS */