<?php
require_once __DIR__ . '/../includes/functions.php';
requireRole('vendor');

$vid = $_SESSION['user_id'];
$hallRes = mysqli_query($conn, "SELECT * FROM halls WHERE vendor_id=$vid LIMIT 1");
$myHall = mysqli_fetch_assoc($hallRes);
$currentPage = basename($_SERVER['PHP_SELF']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $pageTitle ?? 'Vendor Panel - ShadiHall'; ?></title>
    <link rel="stylesheet" href="<?php echo BASE_URL; ?>/assets/css/style.css">
</head>
<body>
<div class="dashboard">
    <aside class="sidebar">
        <div class="brand">
            <h3>❦ ShadiHall</h3>
            <p>Vendor Panel</p>
            <p style="font-size:12px; color:rgba(255,255,255,0.6); margin-top:8px;">
                <?php echo htmlspecialchars($_SESSION['name']); ?>
            </p>
        </div>
        <ul>
            <li><a href="<?php echo BASE_URL; ?>/vendor/dashboard.php" class="<?php echo $currentPage=='dashboard.php'?'active':''; ?>">
                <span>◆</span> Dashboard
            </a></li>
            <li><a href="<?php echo BASE_URL; ?>/vendor/my-hall.php" class="<?php echo $currentPage=='my-hall.php'?'active':''; ?>">
                <span>◆</span> My Hall
            </a></li>
            <?php if ($myHall): ?>
                <li><a href="<?php echo BASE_URL; ?>/vendor/gallery.php" class="<?php echo $currentPage=='gallery.php'?'active':''; ?>">
                    <span>◆</span> Gallery & Video
                </a></li>
                <li><a href="<?php echo BASE_URL; ?>/vendor/dishes.php" class="<?php echo $currentPage=='dishes.php'?'active':''; ?>">
                    <span>◆</span> Dishes & Menu
                </a></li>
                <li><a href="<?php echo BASE_URL; ?>/vendor/dates.php" class="<?php echo $currentPage=='dates.php'?'active':''; ?>">
                    <span>◆</span> Available Dates
                </a></li>
                <li><a href="<?php echo BASE_URL; ?>/vendor/bookings.php" class="<?php echo $currentPage=='bookings.php'?'active':''; ?>">
                    <span>◆</span> My Bookings
                </a></li>
            <?php endif; ?>
            <li style="margin-top:20px; border-top:1px solid rgba(255,255,255,0.15); padding-top:15px;">
                <a href="<?php echo BASE_URL; ?>/index.php"><span>◇</span> View Site</a>
            </li>
            <li><a href="<?php echo BASE_URL; ?>/logout.php"><span>◇</span> Logout</a></li>
        </ul>
    </aside>
    <main class="main-content">
