<!-- Frontend Navbar -->
<nav class="navbar navbar-expand-lg navbar-light sticky-top bg-white shadow-sm">
    <div class="container">
        <a class="navbar-brand m-0" href="<?= APP_URL ?>">
            <img class="logo-dark" src="<?= APP_URL ?>/assets/images/logo.png" alt="<?= APP_NAME ?>" height="40">
        </a>
        
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarMain" 
                aria-controls="navbarMain" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        
        <div class="collapse navbar-collapse" id="navbarMain">
            <ul class="navbar-nav ms-auto mb-2 mb-lg-0 align-items-center">
                <li class="nav-item">
                    <a class="nav-link" href="<?= APP_URL ?>">Home</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?= APP_URL ?>/items.php">Browse Items</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?= APP_URL ?>/about-us.php">About</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?= APP_URL ?>/contact-us.php">Contact</a>
                </li>
                
                <?php if (Auth::check()): ?>
                    <!-- Logged in user menu -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" 
                           data-bs-toggle="dropdown" aria-expanded="false">
                            <i class="fas fa-user-circle me-1"></i>
                            <?= Security::escapeOutput($_SESSION['first_name'] ?? 'User') ?>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
                            <?php if ($_SESSION['user_type'] === 'admin'): ?>
                                <li><a class="dropdown-item" href="<?= APP_URL ?>/admin/index.php">
                                    <i class="fas fa-tachometer-alt me-2"></i>Admin Dashboard
                                </a></li>
                            <?php elseif ($_SESSION['user_type'] === 'vendor'): ?>
                                <li><a class="dropdown-item" href="<?= APP_URL ?>/vendor/index.php">
                                    <i class="fas fa-tachometer-alt me-2"></i>Vendor Dashboard
                                </a></li>
                            <?php elseif ($_SESSION['user_type'] === 'customer'): ?>
                                <li><a class="dropdown-item" href="<?= APP_URL ?>/customer/index.php">
                                    <i class="fas fa-tachometer-alt me-2"></i>My Dashboard
                                </a></li>
                            <?php endif; ?>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="<?= APP_URL ?>/auth/logout.php">
                                <i class="fas fa-sign-out-alt me-2"></i>Logout
                            </a></li>
                        </ul>
                    </li>
                <?php else: ?>
                    <!-- Guest menu -->
                    <li class="nav-item">
                        <a class="nav-link" href="<?= APP_URL ?>/auth/login.php">
                            <i class="fas fa-sign-in-alt me-1"></i>Sign In
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="btn btn-primary btn-sm ms-2" href="<?= APP_URL ?>/auth/register.php">
                            <i class="fas fa-user-plus me-1"></i>Sign Up
                        </a>
                    </li>
                <?php endif; ?>
            </ul>
        </div>
    </div>
</nav>