<?php // Session déjà démarrée dans config.php ?>
<header class="navbar" id="navbar">
    <div class="nav-container">
        <a href="index.php" class="nav-logo">First Car<span>.</span></a>
        <nav role="navigation" aria-label="Navigation principale">
            <ul class="nav-links">
                <li><a href="index.php">Accueil</a></li>
                <?php if (isset($_SESSION['user_id'])): ?>
                    <li><a href="dashboard.php">Nos véhicules</a></li>
                    <li><a href="my_reservations.php">Mes réservations</a></li>
                    <li><a href="contact.php">Contact</a></li>
                    <li><a href="profile.php">Mon profil</a></li>
                    <?php if (!empty($_SESSION['is_admin'])): ?>
                    <li><a href="admin/index.php" style="color:var(--orange);">⚙ Admin</a></li>
                    <?php endif; ?>
                    <li><a href="logout.php">Déconnexion&nbsp;<span style="opacity:.55;font-weight:400;">(<?= htmlspecialchars($_SESSION['user_name']) ?>)</span></a></li>
                <?php else: ?>
                    <li><a href="contact.php">Contact</a></li>
                    <li><a href="login.php">Connexion</a></li>
                    <li><a href="register.php" style="color:var(--orange);">Inscription</a></li>
                <?php endif; ?>
            </ul>
        </nav>
        <button class="burger" id="burger" aria-label="Menu" aria-expanded="false">
            <span></span><span></span><span></span>
        </button>
    </div>
</header>

<?php if (isset($_SESSION['flash'])): ?>
    <div class="flash success" role="alert"><?= htmlspecialchars($_SESSION['flash']) ?></div>
    <?php unset($_SESSION['flash']); ?>
<?php endif; ?>
<?php if (isset($_SESSION['error'])): ?>
    <div class="flash error" role="alert"><?= htmlspecialchars($_SESSION['error']) ?></div>
    <?php unset($_SESSION['error']); ?>
<?php endif; ?>
