<?php
$pageTitle = "All Venues - ShadiHall";
require_once 'includes/header.php';
$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");
?>

<!-- Page Hero -->
<section style="background:linear-gradient(135deg, var(--maroon-dark) 0%, var(--maroon) 100%); padding:100px 20px 80px; text-align:center; color:white; position:relative;">
    <div style="color:var(--gold); font-size:30px; margin-bottom:10px;">❦</div>
    <p style="font-family:var(--font-serif); font-style:italic; color:var(--gold); font-size:18px; letter-spacing:3px; text-transform:uppercase; margin-bottom:10px;">Our Collection</p>
    <h1 style="color:white; font-size:56px;">All <em style="font-family:var(--font-serif); color:var(--gold);">Shadi Halls</em></h1>
    <p style="color:rgba(255,255,255,0.85); margin-top:15px; font-size:17px; font-weight:300;">Find the perfect venue that matches your vision</p>
</section>

<div class="container" style="padding:60px 30px;">
    <?php showFlash(); ?>
    
    <div class="halls-grid">
        <?php if (mysqli_num_rows($halls) > 0): ?>
            <?php while ($hall = mysqli_fetch_assoc($halls)): ?>
                <div class="hall-card">
                    <div class="hall-card-image">
                        <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 Details</a>
                    </div>
                </div>
            <?php endwhile; ?>
        <?php else: ?>
            <div style="grid-column:1/-1; text-align:center; padding:80px 30px; background:white; border-radius:6px;">
                <div style="font-size:70px; color:var(--bronze); margin-bottom:20px;">❦</div>
                <h3 style="color:var(--maroon-dark);">No Halls Listed Yet</h3>
                <p style="color:#888; margin-top:10px;">Be the first to list your venue with us!</p>
                <a href="<?php echo BASE_URL; ?>/register.php" class="btn mt-30">Become a Vendor</a>
            </div>
        <?php endif; ?>
    </div>
</div>

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