<?php 
// Christo Lochenberg Developments | info@christodev.co.za | +27 61 523 9126
$current_url = isset($_GET['url']) ? rtrim($_GET['url'], '/') : 'pages/index'; 

// Identify if the user is in the Client Matrix or Adding a Client
$isClientMatrixActive = ($current_url == 'admin/clients' || ($current_url == 'admin/addUser' && isset($_GET['role']) && $_GET['role'] === 'client'));
?>
<div id="sidebar-overlay" class="absolute inset-0 bg-gray-900 bg-opacity-50 z-30 hidden transition-opacity md:hidden"></div>

<aside id="main-sidebar" class="w-64 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700/70 flex-shrink-0 flex flex-col z-40 absolute inset-y-0 left-0 transform -translate-x-full md:relative md:translate-x-0 transition-transform duration-300 ease-in-out">
    
    <div class="p-4 flex justify-between items-center md:hidden border-b border-gray-200 dark:border-gray-700/70">
        <span class="font-bold text-gray-800 dark:text-white uppercase tracking-wider text-xs">Menu</span>
        <button id="close-sidebar-btn" class="text-gray-500 hover:text-red-500 focus:outline-none p-1 rounded-lg focus:ring-2 focus:ring-red-500 transition-colors">
            <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
        </button>
    </div>

    <div class="p-4 flex-grow overflow-y-auto">
        
        <!-- Mobile Global Search -->
        <form action="<?php echo URLROOT; ?>/search/index" method="GET" class="block lg:hidden relative mb-5">
            <input type="text" name="q" placeholder="Global search..." class="w-full pl-10 pr-4 py-2.5 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50 text-sm focus:outline-none focus:ring-2 focus:ring-primary dark:text-white transition-all shadow-inner" required>
            <svg class="w-4 h-4 absolute left-4 top-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
        </form>

        <nav class="space-y-6">

            <?php if(isAdmin()) : ?>
                <!-- ADMIN: WORKSPACE -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Workspace</h3>
                    <div class="space-y-1">
                        <a href="<?php echo URLROOT; ?>/admin/index" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/index') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/index') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
                            Admin Dashboard
                        </a>
                        <a href="<?php echo URLROOT; ?>/admin/jobcards" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/jobcards' || strpos($current_url, 'admin/viewJobcard') !== false || strpos($current_url, 'admin/createJobcard') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/jobcards' || strpos($current_url, 'admin/viewJobcard') !== false || strpos($current_url, 'admin/createJobcard') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"></path></svg>
                            Jobcard Manager
                        </a>
                        <a href="<?php echo URLROOT; ?>/admin/partners" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo (strpos($current_url, 'admin/partner') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo (strpos($current_url, 'admin/partner') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path></svg>
                            Partner Agencies
                        </a>
                    </div>
                </div>

                <!-- ADMIN: ACCESS CONTROL -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Access Control</h3>
                    <div class="space-y-1">
                        
                        <!-- CLIENT ACCOUNTS LINK -->
                        <a href="<?php echo URLROOT; ?>/admin/clients" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo $isClientMatrixActive ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo $isClientMatrixActive ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path></svg>
                            Client Accounts
                        </a>
                        
                        <a href="<?php echo URLROOT; ?>/admin/users" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/users' || strpos($current_url, 'admin/editUser') !== false || (strpos($current_url, 'admin/addUser') !== false && !isset($_GET['role'])) || strpos($current_url, 'admin/viewUser') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/users' || strpos($current_url, 'admin/editUser') !== false || (strpos($current_url, 'admin/addUser') !== false && !isset($_GET['role'])) || strpos($current_url, 'admin/viewUser') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>
                            Internal User Matrix
                        </a>

                        <a href="<?php echo URLROOT; ?>/admin/roles" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo (strpos($current_url, 'admin/role') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo (strpos($current_url, 'admin/role') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2"></path></svg>
                            Staff Roles
                        </a>
                    </div>
                </div>

                <!-- ADMIN: SYSTEM OPERATIONS -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">System Operations</h3>
                    <div class="space-y-1">
                        <a href="<?php echo URLROOT; ?>/admin/cron" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/cron' || $current_url == 'admin/emailqueue') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/cron' || $current_url == 'admin/emailqueue') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                            Cron & Queue
                        </a>
                        <a href="<?php echo URLROOT; ?>/admin/logs" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/logs') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/logs') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
                            System Logs
                        </a>
                        <a href="<?php echo URLROOT; ?>/admin/backups" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/backups') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/backups') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"></path></svg>
                            Database Backups
                        </a>
                    </div>
                </div>

                <!-- ADMIN: CONFIGURATION -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Configuration</h3>
                    <div class="space-y-1">
                        <a href="<?php echo URLROOT; ?>/admin/settings" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'admin/settings') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'admin/settings') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
                            App Settings
                        </a>
                        <a href="<?php echo URLROOT; ?>/updates/index" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo (strpos($current_url, 'updates') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo (strpos($current_url, 'updates') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path></svg>
                            License & Updates
                        </a>
                        <a href="<?php echo URLROOT; ?>/support/index" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'support/index') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?> mt-2 border border-transparent dark:border-gray-700/70 border-dashed">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'support/index') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>
                            Developer Support
                        </a>
                    </div>
                </div>

            <?php elseif (isStaff()) : ?>
                <!-- STAFF: WORKSPACE -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Workspace</h3>
                    <div class="space-y-1">
                        <a href="<?php echo URLROOT; ?>/dashboard/index" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'dashboard/index') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'dashboard/index') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
                            Staff Dashboard
                        </a>
                        <a href="<?php echo URLROOT; ?>/staff/jobcards" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'staff/jobcards' || strpos($current_url, 'staff/viewJobcard') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'staff/jobcards' || strpos($current_url, 'staff/viewJobcard') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"></path></svg>
                            Active Jobcards
                        </a>
                        <a href="<?php echo URLROOT; ?>/staff/history" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'staff/history') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'staff/history') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                            My History
                        </a>
                    </div>
                </div>

            <?php elseif (isPartner()) : ?>
                <!-- PARTNER: PORTAL -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Agency Portal</h3>
                    <div class="space-y-1">
                        <a href="<?php echo URLROOT; ?>/partnerDashboard/index" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'partnerDashboard/index' || strpos($current_url, 'partnerDashboard/') !== false) ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'partnerDashboard/index' || strpos($current_url, 'partnerDashboard/') !== false) ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 002 2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path></svg>
                            Agency Dashboard
                        </a>
                    </div>
                </div>

            <?php else : ?>
                <!-- CLIENT: PORTAL -->
                <div>
                    <h3 class="px-4 text-[10px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Client Portal</h3>
                    <div class="space-y-1">
                        <a href="<?php echo URLROOT; ?>/clientdashboard/index" 
                            class="flex items-center px-4 py-2.5 text-sm font-medium rounded-lg transition-colors <?php echo ($current_url == 'clientdashboard/index') ? 'bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary font-bold' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'; ?>">
                            <svg class="w-5 h-5 mr-3 <?php echo ($current_url == 'clientdashboard/index') ? 'text-primary' : 'text-gray-400 dark:text-gray-500'; ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 002 2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path></svg>
                            My Dashboard
                        </a>
                    </div>
                </div>
            <?php endif; ?>

        </nav>
    </div>

    <div class="px-4 py-0 border-t border-gray-200 dark:border-gray-700/70 bg-gray-50 dark:bg-gray-800 mt-auto md:h-[84px] flex items-center">
        <div class="flex items-center w-full">
            <div class="w-10 h-10 rounded-full bg-primary flex items-center justify-center text-white font-extrabold text-lg shadow-sm flex-shrink-0">
                <?php echo strtoupper(substr($_SESSION['user_name'], 0, 1)); ?>
            </div>
            <div class="ml-3 overflow-hidden flex-1">
                <a href="<?php echo URLROOT; ?><?php echo isAdmin() ? '/admin/profile' : '/profile/index'; ?>" class="text-sm font-bold text-gray-900 dark:text-white hover:text-primary transition-colors block truncate">
                    <?php echo $_SESSION['user_name']; ?>
                </a>
                <a href="<?php echo URLROOT; ?>/users/logout" class="text-[11px] text-red-500 hover:text-red-600 font-bold flex items-center mt-0.5 transition-colors">
                    <svg class="w-3.5 h-3.5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>
                    Sign Out
                </a>
            </div>
        </div>
    </div>
</aside>