<style>
    .active {
        background-color: #ff0000 !important;
    }
</style>

<nav class="z-10 flex justify-between items-center px-6 py-4 bg-gray-700 text-white shadow-lg">
    <?php if (isset($_SESSION['email'])) { ?>
        <div class="flex items-center">
            <img src="../images/Approval.png" alt="Logo" class="h-16 w-auto rounded shadow-md">
        </div>
    <?php } else { ?>
        <div class="flex items-center">
            <img src="images/Approval.png" alt="Logo" class="h-16 w-auto rounded shadow-md">
        </div>
    <?php } ?>

    <div class="flex-1">
        <ul class="flex justify-center gap-4 text-sm font-semibold">
            <?php if (isset($_SESSION['email']) && $_SESSION['mpid'] = 2 ) { ?>
                <!-- Permanent Members -->
                <?php
                $navLinks = [
                    'index.php' => 'Home',
                    'notification.php' => 'Notification',
                    'saving.php' => 'Saving',
                    'loan.php' => 'Loans',
                    'balance.php' => 'Amount',
                    'contact.php' => 'Contact',
                    'about.php' => 'About',
					
                ];
				
                ?>
            <?php } elseif (isset($_SESSION['email']) && $_SESSION['Mpid'] == 1) { ?>
                <!-- Temporary Members -->
                <?php
                $navLinks = [
                    'index.php' => 'Home',
                    'notification.php' => 'Notification',
                    'membership.php' => 'Membership',
                    'contact.php' => 'Contact',
                    'about.php' => 'About',
                ];
                ?>
            <?php } elseif (isset($_SESSION['email']) && $_SESSION['mpid'] == 1) { ?>
                <!-- Technician -->
                <?php
                $navLinks = [
                    'index.php' => 'Home',
                    'notification.php' => 'Notification',
                    'Work.php' => 'Work',
                    'Payment.php' => 'Payment',
                    'contact.php' => 'Contact',
                    'about.php' => 'About',
                ];
                ?>
            <?php } ?>

            <?php if (isset($navLinks)) {
                foreach ($navLinks as $file => $label) {
                    $activeClass = (basename($_SERVER['PHP_SELF']) == $file) ? 'active' : '';
                    echo "<li><a href='$file' class='px-4 py-2 rounded hover:bg-gray-900 hover:text-white transition $activeClass'>$label</a></li>";
                }
            } ?>
        </ul>
    </div>

    <div class="ml-4">
        <ul>
            <?php if (!isset($_SESSION['email'])) { ?>
                <li><a href="#" onclick="login()" class="px-4 py-2 bg-blue-500 rounded hover:bg-blue-700 transition">Login</a></li>
            <?php } else { ?>
                <li><a href="logout.php" class="px-4 py-2 bg-red-500 rounded hover:bg-red-700 transition">Logout</a></li>
            <?php } ?>
        </ul>
    </div>
</nav>
