export function initializeSignup() { const getStartedButtons = document.querySelectorAll('.cta-button, .secondary-button'); getStartedButtons.forEach(button => { button.addEventListener('click', function(e) { e.preventDefault(); const buttonText = this.textContent.trim(); if (buttonText === 'Get Started' || buttonText === 'Start Free Trial') { showSignupModal(); } else if (buttonText === 'View Documentation') { document.querySelector('#documentation').scrollIntoView({ behavior: 'smooth' }); } else if (buttonText === 'Contact Sales') { document.querySelector('#contact').scrollIntoView({ behavior: 'smooth' }); } }); }); } function showSignupModal() { const modal = document.createElement('div'); modal.className = 'signup-modal'; modal.innerHTML = ` `; document.body.appendChild(modal); document.body.style.overflow = 'hidden'; modal.querySelector('.close-modal').addEventListener('click', () => closeModal(modal)); modal.addEventListener('click', (e) => e.target === modal && closeModal(modal)); const signupForm = modal.querySelector('#signup-form'); signupForm.addEventListener('submit', handleSignupSubmit); modal.querySelector('#switch-to-login').addEventListener('click', (e) => { e.preventDefault(); closeModal(modal); showLoginModal(); }); } function handleSignupSubmit(e) { e.preventDefault(); const formData = { name: document.getElementById('signup-name').value, email: document.getElementById('signup-email').value, password: document.getElementById('signup-password').value, plan: document.getElementById('signup-plan').value }; console.log('Signup form submitted:', formData); alert('Account created successfully! Redirecting to dashboard...'); closeModal(document.querySelector('.signup-modal')); } function closeModal(modal) { if (modal) { document.body.removeChild(modal); document.body.style.overflow = 'auto'; } }