<?php
$pageTitle = "ShadiHall - Where Dreams Meet Elegance";
require_once 'includes/header.php';

// Get featured halls
$halls = mysqli_query($conn, "SELECT h.*, u.name as vendor_name FROM halls h 
                              LEFT JOIN users u ON h.vendor_id = u.id 
                              ORDER BY h.id DESC LIMIT 6");
?>

<!-- Hero Section -->
<section class="hero">
    <div class="hero-content">
        <div class="hero-ornament">
            <span class="line"></span>
            <span>❦</span>
            <span class="line"></span>
        </div>
        <p class="hero-subtitle">Begin Your Forever</p>
        <h1>Where Dreams Meet<br><em>Elegance</em></h1>
        <p class="hero-desc">
            Discover Pakistan's finest shadi halls. From royal venues to intimate gatherings, 
            we curate unforgettable wedding experiences with the finest cuisine and timeless beauty.
        </p>
        <div class="hero-buttons">
            <a href="<?php echo BASE_URL; ?>/halls.php" class="btn btn-gold">Explore Venues</a>
            <a href="<?php echo BASE_URL; ?>/register.php" class="btn btn-outline">Become a Vendor</a>
        </div>
    </div>
</section>

<!-- Features Section -->
<section class="section">
    <div class="container">
        <div class="section-header">
            <div class="section-divider">
                <span class="line"></span>
                <span>❖</span>
                <span class="line"></span>
            </div>
            <p class="section-label">Our Promise</p>
            <h2>Why Choose <em>ShadiHall</em></h2>
        </div>
        
        <div class="features-grid">
            <div class="feature-card">
                <div class="feature-icon">💍</div>
                <h3>Curated Venues</h3>
                <p>Handpicked shadi halls across Pakistan, each offering a unique blend of tradition and modern luxury for your special day.</p>
            </div>
            <div class="feature-card">
                <div class="feature-icon">🍽️</div>
                <h3>Exquisite Cuisine</h3>
                <p>Browse customized menus with transparent pricing. From traditional BBQ to continental delights, everything for your guests.</p>
            </div>
            <div class="feature-card">
                <div class="feature-icon">📅</div>
                <h3>Seamless Booking</h3>
                <p>View real-time availability, choose your perfect date, and book directly through our trusted admin team.</p>
            </div>
        </div>
    </div>
</section>

<!-- Featured Halls -->
<section class="section" style="background:linear-gradient(180deg, var(--cream) 0%, var(--cream-dark) 100%);">
    <div class="container">
        <div class="section-header">
            <div class="section-divider">
                <span class="line"></span>
                <span>❖</span>
                <span class="line"></span>
            </div>
            <p class="section-label">Signature Collection</p>
            <h2>Featured <em>Shadi Halls</em></h2>
        </div>
        
        <?php showFlash(); ?>
        
        <div class="halls-grid">
            <?php if (mysqli_num_rows($halls) > 0): ?>
                <?php $i = 0; while ($hall = mysqli_fetch_assoc($halls)): $i++; ?>
                    <div class="hall-card">
                        <div class="hall-card-image">
                            <?php if ($i <= 2): ?>
                                <span class="hall-card-badge">Featured</span>
                            <?php endif; ?>
                            <img src="<?php echo $hall['main_image'] ? BASE_URL.'/assets/uploads/halls/'.$hall['main_image'] : 'https://images.unsplash.com/photo-1519167758481-83f550bb49b3?w=800'; ?>" 
                                 alt="<?php echo htmlspecialchars($hall['hall_name']); ?>">
                        </div>
                        <div class="hall-card-body">
                            <p class="location">✦ <?php echo htmlspecialchars($hall['location']); ?></p>
                            <h3><?php echo htmlspecialchars($hall['hall_name']); ?></h3>
                            <div class="hall-card-meta">
                                <span>Capacity<strong><?php echo $hall['capacity']; ?> guests</strong></span>
                                <span>By<strong><?php echo htmlspecialchars(substr($hall['vendor_name'], 0, 15)); ?></strong></span>
                            </div>
                            <div class="hall-card-price">
                                Rs. <?php echo number_format($hall['price_per_day']); ?> <small>/ day</small>
                            </div>
                            <a href="<?php echo BASE_URL; ?>/hall-details.php?id=<?php echo $hall['id']; ?>" class="btn">View & Book</a>
                        </div>
                    </div>
                <?php endwhile; ?>
            <?php else: ?>
                <div style="grid-column:1/-1; text-align:center; padding:60px 30px; background:white; border-radius:6px; box-shadow:var(--shadow-sm);">
                    <div style="font-size:60px; color:var(--bronze); margin-bottom:20px;">❦</div>
                    <h3 style="color:var(--maroon-dark); margin-bottom:10px;">Coming Soon</h3>
                    <p style="color:#888;">Beautiful halls will be added by our vendors soon. Stay tuned!</p>
                </div>
            <?php endif; ?>
        </div>
        
        <?php if (mysqli_num_rows($halls) > 0): ?>
            <div class="text-center mt-30">
                <a href="<?php echo BASE_URL; ?>/halls.php" class="btn">View All Halls</a>
            </div>
        <?php endif; ?>
    </div>
</section>

<!-- CTA Section -->
<section style="background:linear-gradient(135deg, var(--maroon-dark) 0%, var(--maroon) 100%); padding:100px 30px; text-align:center; color:white; position:relative; overflow:hidden;">
    <div style="max-width:800px; margin:0 auto; position:relative; z-index:1;">
        <div style="color:var(--gold); font-size:40px; margin-bottom:15px;">❦</div>
        <p style="font-family:var(--font-serif); font-style:italic; color:var(--gold); font-size:20px; letter-spacing:2px; text-transform:uppercase; margin-bottom:15px;">Your Journey Begins Here</p>
        <h2 style="color:white; font-size:52px; margin-bottom:20px;">Ready to Plan Your <em style="font-family:var(--font-serif); color:var(--gold);">Dream Wedding</em>?</h2>
        <p style="font-size:17px; color:rgba(255,255,255,0.85); margin-bottom:35px; font-weight:300;">
            Join thousands of happy couples who trusted us with their special day.
        </p>
        <div style="display:flex; gap:20px; justify-content:center; flex-wrap:wrap;">
            <a href="<?php echo BASE_URL; ?>/register.php" class="btn btn-gold">Register Now</a>
            <a href="<?php echo BASE_URL; ?>/halls.php" class="btn btn-outline">Browse Halls</a>
        </div>
    </div>
</section>

<?php require_once 'includes/footer.php'; ?>
