<!-- Sidebar -->
<aside id="sidebar" class="sidebar glass-effect flex flex-col fixed top-0 left-0 w-64 h-full z-50 transition-transform duration-300 ease-in-out -translate-x-full">
    <!-- Logo Perusahaan -->
    <div class="flex items-center justify-center h-20 border-b border-slate-700/50 flex-shrink-0">
        <a href="<?php echo BASE_URL; ?>/index.php" class="text-xl font-bold text-white tracking-wider flex items-center gap-2">
            <i class="fas fa-wave-square text-sky-400"></i>
            <span>SI Penggajian</span>
        </a>
    </div>
    
    <!-- Menu Navigasi -->
    <nav id="sidebar-nav" class="flex-1 overflow-y-auto p-4 space-y-4">
        <!-- MENU UTAMA -->
        <div>
            <h3 class="px-3 mb-2 text-xs font-semibold tracking-wider text-slate-500 uppercase">Menu Utama</h3>
            <ul class="space-y-1">
                <li><a href="<?php echo BASE_URL; ?>/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-tachometer-alt fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Dashboard</span></a></li>
                <?php if(cek_akses('karyawan', 'view')): ?><li><a href="<?php echo BASE_URL; ?>/modules/karyawan/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-users fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Karyawan</span></a></li><?php endif; ?>
                <?php if($_SESSION['role'] == 'karyawan'): ?><li><a href="<?php echo BASE_URL; ?>/modules/absensi/riwayat.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-calendar-check fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Riwayat Absensi</span></a></li>
                <?php else: ?><li><a href="<?php echo BASE_URL; ?>/modules/absensi/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-calendar-check fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Absensi</span></a></li><?php endif; ?>
                <?php if(cek_akses('absensi', 'scan') && $_SESSION['role'] != 'karyawan'): ?><li><a href="<?php echo BASE_URL; ?>/modules/absensi/scan.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-qrcode fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Scan QR</span></a></li><?php endif; ?>
                <?php if($_SESSION['role'] == 'karyawan'): ?><li><a href="<?php echo BASE_URL; ?>/modules/qrcode/generate_self.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-qrcode fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">QR Code Saya</span></a></li>
                <?php elseif(cek_akses('qrcode', 'view')): ?><li><a href="<?php echo BASE_URL; ?>/modules/qrcode/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-qrcode fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">QR Code</span></a></li><?php endif; ?>
                <?php if($_SESSION['role'] == 'karyawan'): ?><li><a href="<?php echo BASE_URL; ?>/modules/penggajian/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-money-bill-wave fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Gaji Saya</span></a></li>
                <?php elseif(cek_akses('penggajian', 'view')): ?><li><a href="<?php echo BASE_URL; ?>/modules/penggajian/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-money-bill-wave fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Penggajian</span></a></li><?php endif; ?>
                <?php if(cek_akses('absensi', 'report')): ?><li><a href="<?php echo BASE_URL; ?>/modules/absensi/laporan.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-file-alt fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Laporan Absensi</span></a></li><?php endif; ?>
                <?php if(cek_akses('penggajian', 'report')): ?><li><a href="<?php echo BASE_URL; ?>/modules/penggajian/laporan.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-chart-bar fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Laporan Gaji</span></a></li><?php endif; ?>
            </ul>
        </div>
        <!-- PENGATURAN (Admin) -->
        <?php if($_SESSION['role'] == 'admin'): ?>
        <div>
            <h3 class="px-3 mb-2 text-xs font-semibold tracking-wider text-slate-500 uppercase">Pengaturan</h3>
            <ul class="space-y-1">
                <li><a href="<?php echo BASE_URL; ?>/modules/pengaturan/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-cog fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Pengaturan</span></a></li>
                <li><a href="<?php echo BASE_URL; ?>/modules/users/index.php" class="sidebar-link flex items-center p-3 text-slate-300 rounded-lg hover:bg-slate-700/50 border-l-4 border-transparent"><i class="fas fa-user-cog fa-fw w-6 text-slate-400"></i><span class="ml-3 text-sm font-medium">Manajemen User</span></a></li>
            </ul>
        </div>
        <?php endif; ?>
    </nav>
</aside>
