<?php
// Database connection include karein
require_once __DIR__ . '/db_config.php';
/** @var mysqli $conn */

// URL se product ya package ki ID pakadna (e.g., product-details.php?id=1)
$package_id = isset($_GET['id']) ? intval($_GET['id']) : 1;

// Database se us ID ka data nikalna
$query = "SELECT * FROM packages WHERE id = $package_id LIMIT 1";
$result = mysqli_query($conn, $query);

if ($result && mysqli_num_rows($result) > 0) {
    $package = mysqli_fetch_assoc($result);
} else {
    // Agar package na mile toh default ya error dikhayein
    echo "<h2>Package not found!</h2>";
    exit;
}

// Header file include karein jo aapki baaki website mein hai
include 'header.php';
?>

<!-- Product Details Section -->
<div class="package-details-container" style="padding: 40px 5%;">
    
    <!-- Package Title & Overview -->
    <h1 style="color: #333;"><?php echo htmlspecialchars($package['title']); ?>[cite: 17]</h1>
    <p class="package-duration"><strong>Duration:</strong> <?php echo htmlspecialchars($package['duration']); ?>[cite: 17]</p>
    <p class="package-route"><strong>Route:</strong> Dehradun - Yamunotri – Gangotri – Kedarnath – Badrinath[cite: 17]</p>
    
    <div class="package-description" style="margin: 20px 0;">
        <h3>Overview</h3>
        <p><?php echo nl2br(htmlspecialchars($package['description'])); ?></p>
    </div>

    <!-- Trip Highlights -->
    <div class="highlights-section" style="background: #f9f9f9; padding: 20px; border-radius: 8px; margin-bottom: 20px;">
        <h3>Trip Highlights</h3>
        <ul>
            <li>Embark on the Grand Chardham pilgrimage, commencing with a comprehensive briefing in Dehradun[cite: 17].</li>
            <li>Visit Goddess Yamuna's humble abode, Yamunotri Dham, in a Palki[cite: 17].</li>
            <li>Relish the serene Apple Valley of Harsil during your visit to Gangotri Dham[cite: 17].</li>
            <li>Fly to sacred Shri Kedarnath Ji Dham - One of the 12 Jyotirlingas[cite: 17].</li>
            <li>VIP Darshans & Local Sightseeing[cite: 17].</li>
        </ul>
    </div>

    <!-- Package Inclusions -->
    <div class="inclusions-section" style="margin-bottom: 20px;">
        <h3>Tour Inclusions</h3>
        <ul>
            <li>Helicopter flying from Dehradun to the Chardham shrines, & back[cite: 17].</li>
            <li>Accommodation for 5 nights: Dehradun on MAP Basis, and 01 night at each Dham with all meals[cite: 17].</li>
            <li>Local Sightseeing with Himalayan Heli guides at all four destinations[cite: 17].</li>
            <li>VIP Darshans and Airport & hotel transfers at Dehradun[cite: 17].</li>
            <li>Palki or Pony at Yamunotri and Shri Kedarnath Ji helicopter shuttle services[cite: 17].</li>
        </ul>
    </div>

    <!-- Itinerary Section (Day Wise) -->
    <div class="itinerary-section" style="margin-bottom: 30px;">
        <h3>Day Wise Itinerary</h3>
        <div class="day-box">
            <h4>Day 01: Dehradun</h4>
            <p>Reporting day at Dehradun. Evening tour briefing and distribution of duffel bags (Max 5 kg/person permitted)[cite: 17].</p>
        </div>
        <div class="day-box">
            <h4>Day 02: Yamunotri Dham</h4>
            <p>ETD from Sahastradhara Helidrome to Kharsali Helipad, followed by Yamunotri temple darshan[cite: 17].</p>
        </div>
        <div class="day-box">
            <h4>Day 03: Gangotri Dham</h4>
            <p>Fly from Kharsali to Jhalla/Harsil helipad, check-in to hotel, and proceed for Gangotri Dham darshan[cite: 17].</p>
        </div>
        <div class="day-box">
            <h4>Day 04: Kedarnath Dham</h4>
            <p>Fly to Sersi Heli-Base and take the shuttle service flight to Kedarnath Dham for darshan[cite: 17].</p>
        </div>
        <div class="day-box">
            <h4>Day 05: Badrinath Dham</h4>
            <p>Fly from Sersi to Badrinath, hotel check-in, breakfast, and proceed for Badrinath darshan and Mana Village sightseeing[cite: 17].</p>
        </div>
        <div class="day-box">
            <h4>Day 06: Return to Dehradun</h4>
            <p>Fly back from Badrinath to Sahastradhara, collect luggage from Dehradun hotel, and depart[cite: 17].</p>
        </div>
    </div>

    <!-- Booking / Enquiry Button -->
    <div class="booking-action">
        <a href="enquiry.php?package_id=<?php echo $package['id']; ?>" class="btn-primary" style="background: #ff5722; color: #fff; padding: 12px 25px; text-decoration: none; border-radius: 5px; display: inline-block;">Book This Tour Now</a>
    </div>

</div>

<?php 
// Footer file include karein
include 'footer.php'; 
?>