<?php
$authController = new AuthController();
$currentUser = $authController->getCurrentUser();
?>

<nav class="top-navbar">
    <div class="container-fluid">
        <div class="navbar-content">
            <div class="navbar-left">
                <button class="btn btn-link mobile-toggle" id="mobileToggle">
                    <i class="bi bi-list"></i>
                </button>
                <h5 class="page-title mb-0"><?php echo $pageTitle ?? 'Dashboard'; ?></h5>
            </div>
            
            <div class="navbar-right">
                <!-- Notifications -->
                <div class="nav-item dropdown">
                    <a class="nav-link" href="#" id="notificationDropdown" role="button" 
                       data-bs-toggle="dropdown" aria-expanded="false">
                        <i class="bi bi-bell"></i>
                        <span class="badge">0</span>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="notificationDropdown">
                        <li><h6 class="dropdown-header">Notifications</h6></li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item text-muted" href="#">No new notifications</a></li>
                    </ul>
                </div>
                
                <!-- User Menu -->
                <div class="nav-item dropdown">
                    <a class="nav-link user-menu" href="#" id="userDropdown" role="button" 
                       data-bs-toggle="dropdown" aria-expanded="false">
                        <i class="bi bi-person-circle"></i>
                        <span><?php echo htmlspecialchars($currentUser->username ?? 'Admin'); ?></span>
                        <i class="bi bi-chevron-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
                        <li><h6 class="dropdown-header">Signed in as<br><strong><?php echo htmlspecialchars($currentUser->username ?? 'Admin'); ?></strong></h6></li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item" href="#"><i class="bi bi-person"></i> Profile</a></li>
                        <li><a class="dropdown-item" href="#"><i class="bi bi-gear"></i> Settings</a></li>
                        <li><hr class="dropdown-divider"></li>
                        <li>
                            <a class="dropdown-item text-success" href="<?php echo BASE_URL; ?>/api/export-contacts">
                                <i class="bi bi-file-earmark-excel me-1"></i> Export My Contacts
                            </a>
                        </li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item text-danger" href="<?php echo URL_PATH; ?>/admin/logout" onclick="return confirm('Are you sure you want to logout?')">
                            <i class="bi bi-box-arrow-right"></i> Logout
                        </a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
