<?php
declare(strict_types=1);
require_once __DIR__ . '/../db/config.php';
require_once __DIR__ . '/auth.php'; // Ensure session is started and auth helpers are available

$projectTitle = "AFG_CARS - Supreme Automotive";
$projectDescription = "Elite car dealership management system. Premium marketplace, installments, and branch management.";
$current_page = 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><?= htmlspecialchars($projectTitle) ?></title>
    <meta name="description" content="<?= htmlspecialchars($projectDescription) ?>">
    
    <link rel="stylesheet" href="assets/css/style.css?v=<?= time() ?>">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>

<header>
    <div class="logo">AFG_CARS<span>.</span></div>
    <nav>
        <ul>
            <li><a href="index.php" <?= $current_page == 'index.php' ? 'class="active"' : '' ?>>Home</a></li>
            <li><a href="marketplace.php" <?= $current_page == 'marketplace.php' ? 'class="active"' : '' ?>>Marketplace</a></li>
            <li><a href="work.php" <?= $current_page == 'work.php' ? 'class="active"' : '' ?>>Work</a></li>
            <li><a href="about.php" <?= $current_page == 'about.php' ? 'class="active"' : '' ?>>About</a></li>
            <li><a href="contact.php" <?= $current_page == 'contact.php' ? 'class="active"' : '' ?>>Contact Us</a></li>
            <?php if (isLoggedIn()): ?>
                <?php if (isAdmin()): ?>
                    <li><a href="/admin/index.php" class="admin-link"><i class="fas fa-chart-line"></i> Dashboard</a></li>
                <?php endif; ?>
                <li><a href="/logout.php" class="admin-link"><i class="fas fa-sign-out-alt"></i> Logout</a></li>
            <?php else: ?>
                <li><a href="/login.php" class="admin-link"><i class="fas fa-user"></i> Login</a></li>
            <?php endif; ?>
        </ul>
    </nav>
</header>
