<?php
$currentPage = basename($_SERVER['PHP_SELF']);
$navLinks = [
    ['label' => 'Dashboard',     'file' => 'dashboard.php',     'icon' => '📊'],
    ['label' => 'Enquiries',     'file' => 'leads.php',         'icon' => '📋'],
    ['label' => 'Exhibitors',    'file' => 'exhibitors.php',    'icon' => '🏢'],
    ['label' => 'Gallery',       'file' => 'gallery.php',       'icon' => '🖼️'],
    ['label' => 'Sectors',       'file' => 'sectors.php',       'icon' => '🏭'],
    ['label' => 'FAQ',           'file' => 'faq.php',           'icon' => '❓'],
    ['label' => 'Testimonials',  'file' => 'testimonials.php',  'icon' => '💬'],
    ['label' => 'Settings',      'file' => 'settings.php',      'icon' => '⚙️'],
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo e($pageTitle ?? 'Admin'); ?> | Ethiopia Food Expo</title>
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Roboto+Condensed:wght@400;700&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="<?php echo BASE_URL; ?>/assets/css/admin.css">
</head>
<body>
<!-- Mobile Toggle -->
<button class="sidebar-toggle" id="sidebarToggle" title="Toggle Menu">☰</button>

<!-- Sidebar -->
<aside class="admin-sidebar" id="adminSidebar">
    <div class="sidebar-brand">
        <div style="font-family:var(--font-heading);font-size:1rem;color:#fff;text-transform:uppercase;">Ethiopia Food Expo</div>
        <div style="font-size:0.7rem;color:var(--muted);">Admin Panel</div>
    </div>
    <nav class="sidebar-nav">
        <?php foreach ($navLinks as $link):
            $isActive = $currentPage === $link['file'];
        ?>
        <a href="<?php echo $link['file']; ?>" class="sidebar-link <?php echo $isActive ? 'active' : ''; ?>">
            <span class="sidebar-icon"><?php echo $link['icon']; ?></span>
            <?php echo e($link['label']); ?>
        </a>
        <?php endforeach; ?>
    </nav>
    <div style="margin-top:auto;padding:1rem;">
        <a href="logout.php" class="sidebar-link" style="color:var(--danger);">
            <span class="sidebar-icon">🚪</span>
            Logout
        </a>
    </div>
</aside>

<!-- Main Content -->
<main class="admin-main">
    <?php
    $flash = getFlash();
    if ($flash):
    ?>
    <div class="alert alert-<?php echo $flash['type'] === 'success' ? 'success' : 'danger'; ?> alert-dismissible fade show" role="alert" style="margin-bottom:1.5rem;">
        <?php echo e($flash['msg']); ?>
        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
    </div>
    <?php endif; ?>
