<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Reservations | Scallywags Boardwalk Seafood</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../css/styles.css">
</head>
<body>

    <div id="header"></div>

    <main>
        <section id="reservations-hero" class="py-5">
            <div class="container text-center">
                <h1 class="mb-3">Reservations</h1>
                <p class="lead mb-0">
                    Reserve your spot before you dock.
                </p>
            </div>
        </section>

        <section id="reservations-main" class="py-5">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        <div class="reservation-form-wrapper p-4 p-md-5">
                            <h2 class="mb-3">Book Your Table</h2>
                            <p class="mb-4">
                                Planning for a crew? Reserve your table in advance and let us get your spot ready for a night of seafood, pirate spirit, and boardwalk fun.
                            </p>

                            <!-- ✅ FORM ID ADDED -->
                            <form id="reservationForm">
                                <div class="row g-3">

                                    <div class="col-md-6">
                                        <label for="name" class="form-label">Name</label>
                                        <input type="text" id="name" name="name" class="form-control" required>
                                    </div>

                                    <div class="col-md-6">
                                        <label for="email" class="form-label">Email</label>
                                        <input type="email" id="email" name="email" class="form-control" required>
                                    </div>

                                    <div class="col-md-6">
                                        <label for="phone" class="form-label">Phone</label>
                                        <input type="tel" id="phone" name="phone" class="form-control" required>
                                    </div>

                                    <div class="col-md-6">
                                        <label for="party-size" class="form-label">Party Size</label>
                                        <select id="party-size" name="party-size" class="form-select" required>
                                            <option value="">Select party size</option>
                                            <option>2</option>
                                            <option>4</option>
                                            <option>6</option>
                                            <option>8</option>
                                            <option>10+</option>
                                        </select>
                                    </div>

                                    <div class="col-md-6">
                                        <label for="date" class="form-label">Date</label>
                                        <input type="date" id="date" name="date" class="form-control" required>
                                    </div>

                                    <div class="col-md-6">
                                        <label for="time" class="form-label">Time</label>
                                        <input type="time" id="time" name="time" class="form-control" required>
                                    </div>

                                    <div class="col-12">
                                        <label for="seating" class="form-label">Preferred Seating Area</label>
                                        <select id="seating" name="seating" class="form-select" required>
                                            <option value="">Choose a seating area</option>
                                            <option>Kids Cove</option>
                                            <option>High-Top Bar</option>
                                            <option>Table / Booth</option>
                                        </select>
                                    </div>

                                    <div class="col-12">
                                        <label for="requests" class="form-label">Special Requests</label>
                                        <textarea id="requests" name="requests" rows="4" class="form-control" placeholder="Tell us anything we should know about your visit."></textarea>
                                    </div>

                                    <div class="col-12">
                                        <p class="reservation-note mb-0">
                                            Large parties are encouraged to reserve in advance. Seating requests are not guaranteed, but we’ll do our best to accommodate your crew.
                                        </p>
                                    </div>

                                    <div class="col-12 text-center mt-3">
                                        <button type="submit" class="btn btn-primary px-4">
                                            Reserve Now
                                        </button>
                                    </div>

                                </div>
                            </form>

                            <!-- ✅ FIXED SUCCESS MESSAGE -->
                            <div id="reservationSuccess" class="alert alert-success mt-3" style="display: none;">
                                Your reservation request has been received! We’ll see you soon, captain 🏴‍☠️
                            </div>

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

    <div id="footer"></div>

    <script src="../js/includes.js"></script>

    <!-- ✅ WORKING JS -->
    <script>
    document.getElementById("reservationForm").addEventListener("submit", function(e){
        e.preventDefault();

        const confirmation = Math.floor(Math.random() * 100000);

        document.getElementById("reservationSuccess").innerText =
            "Reservation confirmed! Your booking number is #" + confirmation + " 🏴‍☠️";

        document.getElementById("reservationSuccess").style.display = "block";

        this.reset();
    });
    </script>

</body>
</html>