document.addEventListener('DOMContentLoaded', function() { // Form validation const form = document.querySelector('form'); if (form) { form.addEventListener('submit', function(e) { e.preventDefault(); // Simple validation const requiredFields = ['firstname', 'lastname', 'email', 'position', 'files', 'privacy']; let isValid = true; requiredFields.forEach(field => { const element = document.getElementById(field); if (!element || (element.type === 'checkbox' && !element.checked) || (element.value.trim() === '')) { isValid = false; element.style.borderColor = '#f87171'; } else { element.style.borderColor = '#d1d5db'; } }); if (isValid) { // In a real application, you would submit the form here alert('Vielen Dank für Ihre Bewerbung! Wir werden uns in Kürze bei Ihnen melden.'); form.reset(); } else { alert('Bitte füllen Sie alle erforderlichen Felder aus.'); } }); } // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); });