var els=document.querySelectorAll("[data-sr]");for(var i=0;i40)},{passive:true});document.getElementById("contactForm").addEventListener("submit",function(e){e.preventDefault();e.stopPropagation();return false});document.querySelector(".submit-btn").addEventListener("click",function(e){e.preventDefault();e.stopPropagation();var valid=true;var fields=["nome","cognome","email","telefono","attivita","citta"];document.querySelectorAll(".form-group").forEach(function(g){g.classList.remove("error")});document.getElementById("privacyError").style.display="none";fields.forEach(function(f){var el=document.getElementById(f);var grp=el.closest(".form-group");if(!el.value.trim()){grp.classList.add("error");valid=false}if(f==="email"&&el.value.trim()&&!/^([^\s@]+)@([^\s@]+)\.([^\s@]+)$/.test(el.value.trim())){grp.classList.add("error");valid=false}});if(!document.getElementById("privacy").checked){document.getElementById("privacyError").style.display="block";valid=false}if(!valid)return;var btn=document.querySelector(".submit-btn");btn.disabled=true;btn.textContent="Invio in corso...";var data={nome:document.getElementById("nome").value.trim(),cognome:document.getElementById("cognome").value.trim(),email:document.getElementById("email").value.trim(),telefono:document.getElementById("telefono").value.trim(),attivita:document.getElementById("attivita").value.trim(),citta:document.getElementById("citta").value.trim(),settore:document.getElementById("settore").value,messaggio:document.getElementById("messaggio").value.trim()};var subject=encodeURIComponent("Richiesta contatto - "+data.attivita+" ("+data.citta+")");var body=encodeURIComponent("Nome: "+data.nome+" "+data.cognome+"\nEmail: "+data.email+"\nTelefono: "+data.telefono+"\nAttivita: "+data.attivita+"\nCitta: "+data.citta+"\nSettore: "+(data.settore||"Non specificato")+"\n\nMessaggio:\n"+data.messaggio+"\n\n---\nInviato da macellonidavide.com\nConsenso privacy: Si");document.getElementById("contactForm").style.display="none";document.querySelector(".package-box").style.display="none";document.getElementById("successMsg").style.display="block";window.location.href="mailto:info@apacha-solutions.com?subject="+subject+"&body="+body})