   <div class="side-bar">
       <div class="booking-form">
           <h3> Book Your Trip</h3>

           <form id="booking-form" class="contact-form" novalidate>
               <div class="form-group">
                   <input type="text" id="name" class="form-control" placeholder="Enter your name" required>
                   <small id="name-error" class="text-danger error-message"></small>
               </div>

               <div class="form-group">
                   <input type="tel" id="phone" class="form-control" placeholder="Enter phone number" required>
                   <small id="phone-error" class="text-danger error-message"></small>
               </div>

               <div class="form-group">
                   <select id="destination" class="form-select" required>
                       <option value="" selected disabled>Select Destination</option>
                       <option value="kandhaloor.php">Kandhaloor (2D/1N)</option>
                       <option value="Valparai-&-Athirappilly.php">Valparai & Athirappilly (3D/1N)</option>
                       <option value="Topslip-&-Valparai.php">Topslip & Valparai (2D/1N)</option>
                       <option value="munnar-kandhaloor.php">Munnar & Kandhaloor (3D/2N)</option>
                       <option value="valparai-&-kandhaloor-tour-package.php">Valparai & Kandhaloor (3D/2N)</option>
                       <option value="topslip-athirappilly.php">Topslip – Valparai – Athirappilly (2D)</option>
                       <option value="thirumoorthi-falls.php">Thirumoorthi Falls</option>
                       <option value="valparai-&-athirappilly-3-day-tour.php">Valparai & Athirappilly 3-Day</option>
                   </select>
                   <small id="destination-error" class="text-danger error-message"></small>
               </div>

               <div class="form-group mt-3">
                   <select id="package" class="form-select" required>
                       <option value="" selected disabled>Select Package</option>
                       <option value="Standard">Standard</option>
                       <option value="Premium">Premium</option>
                       <option value="Luxury">Luxury</option>
                   </select>
                   <small id="package-error" class="text-danger error-message"></small>
               </div>

               <div class="form-group mt-3">
                   <input type="date" id="trip-date" class="form-control" required>
                   <small id="trip-date-error" class="text-danger error-message"></small>
               </div>

               <div class="form-group">
                   <input type="number" id="persons" class="form-control" placeholder="Enter number of persons" min="1" required>
                   <small id="persons-error" class="text-danger error-message"></small>
               </div>

               <div class="form-group">
                   <textarea id="message" class="form-control" rows="4" placeholder="Your message here..." required></textarea>
                   <small id="message-error" class="text-danger error-message"></small>
               </div>

               <div class="custom-btn">
                   <button type="submit" class="liquid-btn">
                       Book now <i class="bi bi-chevron-double-right"></i>
                   </button>
               </div>
           </form>


       </div>
       <div class="related-packages mt-3">
           <h3>Related Packages</h3>
           <ul>
               <li><a href="kandhaloor.php"><i class="bi bi-caret-right-fill"></i> Kandhaloor (2D/1N)</a></li>
               <li><a href="Valparai-&-Athirappilly.php"><i class="bi bi-caret-right-fill"></i> Valparai & Athirappilly (3D/1N)</a></li>
               <li><a href="Topslip-&-Valparai.php"><i class="bi bi-caret-right-fill"></i> Topslip & Valparai (2D/1N)</a></li>
               <li><a href="munnar-kandhaloor.php"><i class="bi bi-caret-right-fill"></i> Munnar & Kandhaloor (3D/2N)</a></li>
               <li><a href="valparai-&-kandhaloor-tour-package.php"><i class="bi bi-caret-right-fill"></i> Valparai & Kandhaloor (3D/2N)</a></li>
               <li><a href="topslip-athirappilly.php"><i class="bi bi-caret-right-fill"></i> Topslip – Valparai – Athirappilly (2D)</a></li>
               <li><a href="thirumoorthi-falls"><i class="bi bi-caret-right-fill"></i> Thirumoorthi Falls</a></li>
               <li><a href="valparai-&-athirappilly-3-day-tour.php"><i class="bi bi-caret-right-fill"></i> Valparai & Athirappilly 3-Day</a></li>
           </ul>
       </div>
   </div>


   <!-- form validation -->
   <script>
       document.getElementById('booking-form').addEventListener('submit', function(e) {
           e.preventDefault();

           document.querySelectorAll('.error-message').forEach(el => el.textContent = '');
           let isValid = true;

           const name = document.getElementById('name').value.trim();
           const phone = document.getElementById('phone').value.trim();
           const destination = document.getElementById('destination').value;
           const packageType = document.getElementById('package').value;
           const tripDate = document.getElementById('trip-date').value;
           const persons = document.getElementById('persons').value.trim();
           const message = document.getElementById('message').value.trim();

           // Validation
           if (name === '') {
               document.getElementById('name-error').textContent = 'Please enter your name';
               isValid = false;
           }

           if (!/^\d{10,15}$/.test(phone)) {
               document.getElementById('phone-error').textContent = 'Enter a valid phone number';
               isValid = false;
           }

           if (destination === '') {
               document.getElementById('destination-error').textContent = 'Select a destination';
               isValid = false;
           }

           if (packageType === '') {
               document.getElementById('package-error').textContent = 'Select a package';
               isValid = false;
           }

           if (tripDate === '') {
               document.getElementById('trip-date-error').textContent = 'Select your trip date';
               isValid = false;
           }

           if (persons === '' || persons <= 0) {
               document.getElementById('persons-error').textContent = 'Enter a valid number of persons';
               isValid = false;
           }

           if (message === '') {
               document.getElementById('message-error').textContent = 'Please write a message';
               isValid = false;
           }

           if (!isValid) return;

           // Send data to PHP
           const formData = new FormData();
           formData.append('name', name);
           formData.append('phone', phone);
           formData.append('destination', destination);
           formData.append('package', packageType);
           formData.append('trip_date', tripDate);
           formData.append('persons', persons);
           formData.append('message', message);

           fetch('mail.php', {
                   method: 'POST',
                   body: formData
               })
               .then(res => res.json())
               .then(data => {
                   Toastify({
                       text: data.message || 'Form submitted successfully!',
                       duration: 3000,
                       backgroundColor: data.status === 'success' ? 'green' : 'red',
                       close: true
                   }).showToast();

                   if (data.status === 'success') {
                       document.getElementById('booking-form').reset();
                   }
               })
               .catch(() => {
                   Toastify({
                       text: 'Something went wrong. Please try again!',
                       duration: 3000,
                       backgroundColor: 'red'
                   }).showToast();
               });
       });
   </script>