<!-- Sidebar -->
<div class="sidebar" id="sidebar">
    <div class="py-4 px-3">
        <div class="d-flex align-items-center mb-4">
            <i class="fas fa-user-circle fa-2x me-3 d-none d-lg-block"></i>
            <div class="d-none d-lg-block">
                <h5 class="text-white mb-0">John Doe</h5>
                <small class="text-light">Administrator</small>
            </div>
        </div>
        
        <ul class="nav flex-column">
            <!-- Dashboard Link -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'dashboard.php' ? 'active' : ''; ?>" 
                   href="dashboard.php">
                    <span class="nav-text">📊 Dashboard</span>
                </a>
            </li>

            <!-- Sites Link -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'manage_sites.php' ? 'active' : ''; ?>" 
                   href="manage_sites.php">
                    <span class="nav-text">🏫 Manage Sites</span>
                </a>
            </li>

            <!-- Admin Management Link -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'manage_admin.php' ? 'active' : ''; ?>" 
                   href="manage_users.php">
                    <span class="nav-text">👮 Manage Users</span>
                </a>
            </li>

            <!-- Command Center -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'manage_admin.php' ? 'active' : ''; ?>" 
                   href="command_center.php">
                    <span class="nav-text">📍 Command Center</span>
                </a>
            </li>
             <!------------------------------------------------------------------------------------------------------------------------------>

            <!-- Attendance Link -->
            <li class="nav-item">

                <a class="nav-link d-flex justify-content-between align-items-center" data-bs-toggle="collapse" href="#attnSubmenu" role="button" aria-expanded="false" aria-controls="attnSubmenu">
                    🕒 Manage Attendance
                    <i class="fas fa-chevron-down small"></i>
                </a>
                <div class="collapse <?= in_array(basename($_SERVER['PHP_SELF']), ['view_attendance.php','edit_attendance.php']) ? 'show' : '' ?>" 
                id="attnSubmenu">
                    <ul class="nav flex-column ms-3 mt-1">
                        <li class="nav-item">
                            <a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'view_attendance.php' ? 'active' : '' ?>" href="view_attendance.php">
                                📝 Attendance record
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'edit_attendance.php' ? 'active' : '' ?>" href="edit_attendance.php">
                                📝 Edit Attendance
                            </a>
                        </li>
                    </ul>
                </div>
            </li>

            <!------------------------------------------------------------------------------------------------------------------------------>
            <!-- Mange Leave -->
            <li class="nav-item">

                <a class="nav-link d-flex justify-content-between align-items-center" data-bs-toggle="collapse" href="#leaveSubmenu" role="button" aria-expanded="false" aria-controls="leaveSubmenu">
                    🧑‍💼 Leave Management
                    <i class="fas fa-chevron-down small"></i>
                </a>
                <div class="collapse <?= in_array(basename($_SERVER['PHP_SELF']), ['manage_leave.php','employment_terms.php','upload_payslips.php','view_leave_requests.php']) ? 'show' : '' ?>" id="leaveSubmenu">
                    <ul class="nav flex-column ms-3 mt-1">
                        <li class="nav-item">
                            <a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'manage_leave.php' ? 'active' : '' ?>" href="manage_leave.php">
                                📝 Manage Leave
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'view_leave_requests.php' ? 'active' : '' ?>" href="view_leave_requests.php">
                                📋 Leave Requests
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'view_officer_leave_balance.php' ? 'active' : '' ?>" href="view_officer_leave_balance.php">
                                📋 Officer leave balance
                            </a>
                        </li>
                    </ul>
                </div>

            </li>
             <!------------------------------------------------------------------------------------------------------------------------------>

            <!-- Employment Link -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'employment_terms.php' ? 'active' : ''; ?>" 
                   href="employment_terms.php">
                    <span class="nav-text">📄 Employment Terms</span>
                </a>
            </li>

            <!-- Payslip Link -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'leave.php' ? 'active' : ''; ?>" 
                   href="upload_payslips.php">
                    <span class="nav-text">💰 Upload Payslips</span>
                </a>
            </li>

            <!-- Incident Link -->
            <li class="nav-item">
                <a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'payroll.php' ? 'active' : ''; ?>" 
                   href="incident_reports.php">
                    <span class="nav-text">🚨 Incidents</span>
                </a>
            </li>
        </ul>
    </div>
</div>