// Shared JavaScript across all pages document.addEventListener('DOMContentLoaded', function() { console.log('Wellness Wave App loaded'); // Time slider functionality const timeSlider = document.getElementById('timeSlider'); const timeValue = document.getElementById('timeValue'); if (timeSlider && timeValue) { timeSlider.addEventListener('input', function() { timeValue.textContent = this.value; }); } // Form submission const retreatForm = document.getElementById('retreatForm'); if (retreatForm) { retreatForm.addEventListener('submit', function(e) { e.preventDefault(); // Get form values const time = timeSlider.value; const areas = Array.from(document.querySelectorAll('input[name="areas"]:checked')).map(cb => cb.value); const difficulty = document.querySelector('input[name="difficulty"]:checked').value; // In a real app, this would send data to a server console.log('Retreat Configuration:', { time, areas, difficulty }); // Show confirmation alert(`Your personalized yoga retreat has been configured!\nDuration: ${time} minutes\nTarget Areas: ${areas.join(', ') || 'None selected'}\nDifficulty: ${difficulty}`); }); } // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); });