<?php
// includes/nav_public.php
?>
<!-- Public Navigation -->
<nav class="navbar navbar-expand-lg navbar-light fixed-top shadow-sm rounded-bottom">
    <div class="container">
        <a class="navbar-brand d-flex align-items-center" href="index.php">
            <img src="assets/images/niphlogo.png" alt="NIPH Logo" class="rounded me-2" style="width:72px;height:72px;">
            <div class="lh-sm">
                <span class="d-block fw-bold text-success text-uppercase" style="letter-spacing:0.08em;">NIPH</span>
                <span class="d-block fw-semibold text-success" style="font-size:0.95rem;">Data Sharing Platform</span>
            </div>
        </a>

        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#publicNavbar" aria-controls="publicNavbar" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="publicNavbar">
            <ul class="navbar-nav ms-lg-4 me-auto">
                <li class="nav-item">
                    <a class="nav-link <?= ($page == 'home' ? 'active' : '') ?>" href="index.php?page=home">
                        <i class="fas fa-home text-success me-1"></i>HOME
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link <?= ($page == 'classifications' ? 'active' : '') ?>" href="index.php?page=classifications">
                        <i class="fas fa-layer-group text-success me-1"></i>DATASET
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link <?= ($page == 'announcements' ? 'active' : '') ?>" href="index.php?page=announcements">
                        <i class="fas fa-volume-up text-success me-1"></i>ANNOUNCE
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link <?= ($page == 'about' ? 'active' : '') ?>" href="index.php?page=about">
                        <i class="fa fa-info-circle text-success me-1"></i>ABOUT
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link <?= ($page == 'contact' ? 'active' : '') ?>" href="index.php?page=contact">
                        <i class="fas fa-address-card text-success me-1"></i>CONTACT
                    </a>
                </li>
            </ul>

            <div class="d-flex flex-column flex-lg-row align-items-lg-center gap-2">
                <a class="nav-link <?= ($page == 'faq' ? 'active' : '') ?>" href="index.php?page=faq">
                    <i class="fas fa-question-circle text-success me-1"></i>FAQ
                </a>

                <?php if (!$is_logged_in): ?>
                    <div class="d-flex flex-column flex-sm-row gap-2">
                        <button class="btn btn-outline-success rounded-pill" data-bs-toggle="modal" data-bs-target="#registerModal">
                            <i class="fas fa-user-plus me-2"></i>Register
                        </button>
                        <button class="btn btn-success rounded-pill" data-bs-toggle="modal" data-bs-target="#loginModal">
                            <i class="fas fa-lock me-2"></i>Login
                        </button>
                    </div>
                <?php else: ?>
                    <div class="d-flex flex-column flex-sm-row gap-2">
                        <?php if ($user_role == 'DAC Staff'): ?>
                            <a class="btn btn-outline-success rounded-pill" href="admin/dashboard.php">
                                <i class="fas fa-tachometer-alt me-2"></i>Dashboard
                            </a>
                        <?php elseif ($user_role == 'Data Owner'): ?>
                            <a class="btn btn-outline-success rounded-pill" href="data_owner/dashboard.php">
                                <i class="fas fa-tachometer-alt me-2"></i>Dashboard
                            </a>
                        <?php elseif ($user_role == 'Data User'): ?>
                            <a class="btn btn-outline-success rounded-pill" href="data_user/dashboard.php">
                                <i class="fas fa-tachometer-alt me-2"></i>Dashboard
                            </a>
                        <?php endif; ?>
                        <a class="btn btn-outline-secondary rounded-pill" href="logout.php">
                            <i class="fas fa-sign-out-alt me-2"></i>Logout
                        </a>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
</nav>
