<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Contact Mr.Taxi | Get in Touch for Bookings & Support</title>
    
    <!-- head -->
    <?php include('./includes/head.php'); ?>

</head>

<body>

    <div class="body-wrap">
        <!-- header -->
        <?php include('./includes/header.php'); ?>

        <main>
            <!-- sub banner -->
            <section>
                <div class="inner-sub-banner" style="background-image: url('./assets/image/banner/banner-2.png');">
                    <div class="container-fluid">
                        <div class="sub-banner-content text-center">
                            <div class="sub-overlay">
                                <img src="./assets/image/banner/sub-banner-overlay.png" class="img-fluid" alt="">
                            </div>
                            <div class="banner-content-wrap">
                                <h4 class="sub-head">Contact Us</h4>
                                <h2 class="main-head">Get in Touch with Mr.Taxi</h2>
                            </div>
                        </div>
                    </div>
                </div>
            </section>


            <section>
                <div class="card-contact">
                    <div class="container">

                        <div class="row g-4 d-flex justify-content-center align-item-center">
                            <!-- Phone Card -->
                            <div class="col-lg-4 col-md-6 d-flex">
                                <div class="contact-card text-center p-4 rounded ">
                                    <div class="contact-img-overlay">
                                        <img src="./assets/image/icons/phone.png" class="img-fluid" alt="">
                                    </div>
                                    <h4 class="mb-2">Phone</h4>
                                    <a href="tel:+917845830046" class="text-decoration-none text-dark">+91 784 583 0046</a><br>
                                    <a href="tel:+919080830046" class="text-decoration-none text-dark">+91 908 083 0046</a>
                                </div>
                            </div>

                            <!-- Email Card -->
                            <div class="col-lg-4 col-md-6  d-flex">
                                <div class="contact-card text-center p-4 rounded ">
                                    <div class="contact-img-overlay">
                                        <img src="./assets/image/icons/email.png" class="img-fluid" alt="">
                                    </div>
                                    <h4 class="mb-2">Email</h4>
                                    <a href="mailto:Shivamtaxi590@gmail.com" class="text-decoration-none text-dark">Shivamtaxi590@gmail.com</a>
                                </div>
                            </div>

                            <!-- Location Card -->
                            <div class="col-lg-4 col-md-6  d-flex">
                                <div class="contact-card text-center p-4 rounded ">
                                    <div class="contact-img-overlay">
                                        <img src="./assets/image/icons/location.png" class="img-fluid" alt="">
                                    </div>
                                    <h4 class="mb-2">Location</h4>
                                    <a href="https://maps.app.goo.gl/GpNnWefDr7Ff5CST6" target="_blank">
                                        <p class="mb-0">No-120 Coimbatore, NH 83, Pollachi, Tamil Nadu 642002</p>
                                    </a>
                                </div>
                            </div>
                        </div>




                    </div>
                </div>
            </section>


            <!-- form section -->
            <section>
                <div class="inner-form contact-page">
                    <div class="container-fluid">
                        <div class="head-center">
                            <h4 class="sub-head" data-aos="zoom-in" data-aos-delay="250"><span>Get in Touch</span></h4>
                            <h2 class="main-head" data-aos="zoom-in" data-aos-delay="300">Plan Your Ride with Ease — We're Just a Form Away!</h2>
                            <p class="text-center" data-aos="zoom-in" data-aos-delay="350">Book your next trip effortlessly with Mr.Taxi. Whether it’s a quick city ride or a long-distance journey, our team ensures a comfortable, safe, and timely experience. Fill out the form below and let us take care of the rest.</p>
                        </div>

                        <div class="form-wrap">
                            <form id="booking-form" class="booking-form">
                                <div class="row g-3">
                                    <!-- Name -->
                                    <div class="col-lg-6 col-md-6 col-sm-6" data-aos="zoom-in" data-aos-delay="200">
                                        <label class="form-label"><i class="bi bi-person-fill"></i> Full Name</label>
                                        <input type="text" id="name" class="form-control" placeholder="Enter your name">
                                        <small id="name-error" class="text-danger error-message"></small>
                                    </div>

                                    <!-- Phone -->
                                    <div class="col-lg-6 col-md-6 col-sm-6" data-aos="zoom-in" data-aos-delay="250">
                                        <label class="form-label"><i class="bi bi-telephone-fill"></i> Phone Number</label>
                                        <input type="tel" id="phone" class="form-control" placeholder="Enter phone number">
                                        <small id="phone-error" class="text-danger error-message"></small>
                                    </div>

                                    <!-- Destination -->
                                    <div class="col-lg-6 col-md-6 col-sm-6" data-aos="zoom-in" data-aos-delay="300">
                                        <label class="form-label"><i class="bi bi-geo-alt-fill"></i> Trip Destination</label>
                                        <select id="destination" class="form-select">
                                            <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>

                                    <!-- Package -->
                                    <div class="col-lg-6 col-md-6 col-sm-6" data-aos="zoom-in" data-aos-delay="350">
                                        <label class="form-label"><i class="bi bi-box-seam-fill"></i> Select Package</label>
                                        <select id="package" class="form-select">
                                            <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>

                                    <!-- Starting Date -->
                                    <div class="col-lg-6 col-md-6 col-sm-6" data-aos="zoom-in" data-aos-delay="400">
                                        <label class="form-label"><i class="bi bi-calendar-event-fill"></i> Trip Date</label>
                                        <input type="date" id="trip-date" class="form-control">
                                        <small id="trip-date-error" class="text-danger error-message"></small>
                                    </div>

                                    <!-- Number of Persons -->
                                    <div class="col-lg-6 col-md-6 col-sm-6" data-aos="zoom-in" data-aos-delay="450">
                                        <label class="form-label"><i class="bi bi-people-fill"></i> Number of Persons</label>
                                        <input type="number" id="persons" class="form-control" placeholder="Enter number of persons" min="1">
                                        <small id="persons-error" class="text-danger error-message"></small>
                                    </div>

                                    <!-- Message -->
                                    <div class="col-12" data-aos="zoom-in" data-aos-delay="500">
                                        <label class="form-label"><i class="bi bi-chat-dots-fill"></i> Message</label>
                                        <textarea id="message" class="form-control" rows="4" placeholder="Your message here..."></textarea>
                                        <small id="message-error" class="text-danger error-message"></small>
                                    </div>

                                    <!-- Submit Button -->
                                    <div class="col-12 text-center mt-3" data-aos="zoom-in" data-aos-delay="550">
                                        <div class="custom-btn">
                                            <button type="submit" class="liquid-btn">
                                                Book now <i class="bi bi-chevron-double-right"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </form>


                        </div>


                    </div>
                </div>
            </section>


            <!-- map iframe -->
            <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d4650.94451099552!2d77.00609900000002!3d10.666106!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3ba8382bbe0f51d1%3A0xab75ed95e7854b79!2sAiyappan%20Kovil%20St%2C%20Venkatasa%20Colony%2C%20Tamil%20Nadu%20642001!5e1!3m2!1sen!2sin!4v1762433584495!5m2!1sen!2sin" width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>


        </main>

        <!-- Footer -->
        <?php include('./includes/footer.php'); ?>

    </div>

    <!-- Script -->
    <?php include('./includes/script.php'); ?>



    <!-- form validation -->

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

            // Reset previous errors
            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;

            // Form data
            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);

            // Send request
            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'
                    }).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>


</body>

</html>