// Mock data for rides const mockRides = [ { id: 1, from: "San Francisco, CA", to: "Los Angeles, CA", date: "2024-01-20", time: "08:00 AM", price: 45, seats: 3, driver: "Sarah M.", driverImage: "http://static.photos/people/200x200/1", rating: 4.8, car: "Tesla Model 3", features: ["AC", "WiFi", "Pets OK"] }, { id: 2, from: "New York, NY", to: "Boston, MA", date: "2024-01-21", time: "09:30 AM", price: 35, seats: 2, driver: "Mike R.", driverImage: "http://static.photos/people/200x200/2", rating: 4.9, car: "Honda Civic", features: ["AC", "Music"] }, { id: 3, from: "Chicago, IL", to: "Detroit, MI", date: "2024-01-22", time: "07:00 AM", price: 40, seats: 4, driver: "Emma L.", driverImage: "http://static.photos/people/200x200/3", rating: 4.7, car: "Toyota Camry", features: ["AC", "Luggage Space"] }, { id: 4, from: "Seattle, WA", to: "Portland, OR", date: "2024-01-20", time: "02:00 PM", price: 25, seats: 3, driver: "John D.", driverImage: "http://static.photos/people/200x200/4", rating: 5.0, car: "Subaru Outback", features: ["Bike Rack", "Pets OK"] }, { id: 5, from: "Austin, TX", to: "Dallas, TX", date: "2024-01-23", time: "10:00 AM", price: 30, seats: 2, driver: "Lisa K.", driverImage: "http://static.photos/people/200x200/5", rating: 4.6, car: "BMW X3", features: ["AC", "WiFi", "Leather Seats"] }, { id: 6, from: "Miami, FL", to: "Orlando, FL", date: "2024-01-21", time: "11:00 AM", price: 28, seats: 3, driver: "Carlos G.", driverImage: "http://static.photos/people/200x200/6", rating: 4.9, car: "Ford Mustang", features: ["Music", "Snacks"] } ]; // Theme toggle functionality function initTheme() { if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark'); } } function toggleTheme() { if (document.documentElement.classList.contains('dark')) { document.documentElement.classList.remove('dark'); localStorage.theme = 'light'; } else { document.documentElement.classList.add('dark'); localStorage.theme = 'dark'; } } // Navigation function showSection(sectionId) { // Hide all sections const sections = ['hero', 'rides', 'how-it-works', 'offer-ride']; sections.forEach(id => { const el = document.getElementById(id); if (el) { if (id === sectionId) { el.classList.remove('hidden'); el.scrollIntoView({ behavior: 'smooth', block: 'start' }); } else { el.classList.add('hidden'); } } }); // Special handling for hero to show it properly if (sectionId === 'hero') { document.getElementById('hero').classList.remove('hidden'); window.scrollTo({ top: 0, behavior: 'smooth' }); } } // Search functionality function searchRides() { const from = document.getElementById('search-from').value; const to = document.getElementById('search-to').value; const date = document.getElementById('search-date').value; // Show loading state const ridesContainer = document.getElementById('rides-container'); ridesContainer.innerHTML = '
No rides found matching your criteria.