<?php
    $user = auth()->user();
    $isAdmin = $user->isAdmin();
    $isOwner = $user->isOwner();
    $isDriver = ! $isAdmin && ! $isOwner;
    $workspaceLabel = $isAdmin ? 'Admin Workspace' : ($isOwner ? 'Owner Workspace' : 'Driver Workspace');
    
    // Check if trial is expired and no card is saved
    $subscription = $user->subscription;
    $isTrialExpiredNoPay = $subscription && $subscription->isTrialExpired() && !$subscription->hasCardSaved();
?>

<aside x-data="{ open: false }" class="w-72 min-h-screen border-r border-sky-900/10 bg-white/95 backdrop-blur flex flex-col shadow-2xl shadow-sky-950/5" :class="{ 'opacity-50 pointer-events-none': <?php echo json_encode($isTrialExpiredNoPay, 15, 512) ?> }">
    <div class="border-b border-sky-100 bg-gradient-to-r from-[#003D7A] to-[#0a4a91] p-6 text-white">
        <a href="<?php echo e($isAdmin ? route('admin.dashboard') : route('dashboard')); ?>" class="flex items-center gap-3 text-xl font-bold text-white no-underline hover:text-white focus:text-white">
            <span class="inline-flex h-10 w-10 items-center justify-center rounded-xl bg-[#00BFA5] text-white shadow-lg shadow-teal-900/20">T</span>
            <span class="leading-tight text-white">
                <span class="block text-white">TrueTrucker</span>
                <span class="mt-0.5 block text-xs font-medium uppercase tracking-[0.18em] text-sky-100"><?php echo e(ucfirst($user->role)); ?> portal</span>
            </span>
        </a>
    </div>

    <nav class="flex-1 space-y-6 px-4 py-6">
        <div>
            <div class="px-3 pb-2 text-[11px] font-semibold uppercase tracking-[0.22em] text-sky-900/45"><?php echo e($workspaceLabel); ?></div>

            <?php if($isAdmin): ?>
                <div class="space-y-1">
                    <a href="<?php echo e(route('admin.dashboard')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.dashboard') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 13h8V3H3v10zm10 8h8V3h-8v18zM3 21h8v-6H3v6z"></path></svg>
                        Dashboard
                    </a>
                    <a href="<?php echo e(route('admin.companies.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.companies.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 21h16M4 7l8-4 8 4M6 10h12M6 14h12M6 18h12"></path></svg>
                        Companies
                    </a>
                    <a href="<?php echo e(route('admin.users.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.users.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5V9l-5-2m0 13H7m10 0v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6m10 0V7M7 20H2V9l5-2m0 13V7m0 0l5-2 5 2"></path></svg>
                        Users
                    </a>
                    <a href="<?php echo e(route('admin.owners.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.owners.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5V9l-5-2m0 13H7m10 0v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6m10 0V7M7 20H2V9l5-2m0 13V7m0 0l5-2 5 2"></path></svg>
                        Owners
                    </a>
                    <a href="<?php echo e(route('admin.drivers.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.drivers.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                        Drivers
                    </a>
                    <a href="<?php echo e(route('admin.fleet.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.fleet.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5"></path></svg>
                        Fleet
                    </a>
                    <a href="<?php echo e(route('admin.payments.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.payments.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9V7a5 5 0 00-10 0v2m-2 0h14a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2v-8a2 2 0 012-2z"></path></svg>
                        Payments
                    </a>
                    <a href="<?php echo e(route('admin.packages.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.packages.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V7a2 2 0 00-2-2h-3V3H9v2H6a2 2 0 00-2 2v6m16 0v6a2 2 0 01-2 2H6a2 2 0 01-2-2v-6m16 0H4"></path></svg>
                        Packages
                    </a>
                    <a href="<?php echo e(route('admin.payment-methods.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('admin.payment-methods.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-3.314 0-6 1.343-6 3v2c0 1.657 2.686 3 6 3s6-1.343 6-3v-2c0-1.657-2.686-3-6-3zm0 8c-3.314 0-6-1.343-6-3v4c0 1.657 2.686 3 6 3s6-1.343 6-3v-4c0 1.657-2.686 3-6 3z"></path></svg>
                        Payment Methods
                    </a>
                </div>
            <?php elseif($isOwner): ?>
                <div class="space-y-1">
                    <a href="<?php echo e(route('dashboard')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('dashboard') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg>
                        Dashboard
                    </a>
                    <a href="<?php echo e(route('owner.loads.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('owner.loads.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                        Loads
                    </a>
                    <a href="<?php echo e(route('owner.trucks.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('owner.trucks.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5"></path></svg>
                        Fleet
                    </a>
                    <a href="<?php echo e(route('owner.drivers.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('owner.drivers.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                        Drivers
                    </a>
                    <a href="<?php echo e(route('owner.analytics.index')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('owner.analytics.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg>
                        Analytics
                    </a>
                    <a href="<?php echo e(route('documents.create')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('documents.*') || request()->routeIs('owner.documents.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 10v2a2 2 0 01-2 2H9a2 2 0 01-2-2v-6a2 2 0 012-2h2a2 2 0 012 2v6a2 2 0 01-2 2H9"></path></svg>
                        Documents
                    </a>
                </div>
            <?php else: ?>
                <div class="space-y-1">
                    <a href="<?php echo e(route('dashboard')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('dashboard') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg>
                        Dashboard
                    </a>
                    <a href="<?php echo e(route('documents.create')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('documents.*') || request()->routeIs('owner.documents.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                        <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 10v2a2 2 0 01-2 2H9a2 2 0 01-2-2v-6a2 2 0 012-2h2a2 2 0 012 2v6a2 2 0 01-2 2H9"></path></svg>
                        Documents
                    </a>
                </div>
            <?php endif; ?>
        </div>

        <div class="border-t border-sky-100 pt-4">
            <div class="px-3 pb-2 text-[11px] font-semibold uppercase tracking-[0.22em] text-sky-900/45">Account</div>
            <a href="<?php echo e(route('profile.edit')); ?>" class="flex items-center rounded-xl px-4 py-3 text-[#0F3D7A] hover:bg-sky-50 hover:text-[#00BFA5] <?php echo e(request()->routeIs('profile.*') ? 'bg-sky-50 text-[#00BFA5] shadow-sm' : ''); ?>">
                <svg class="mr-3 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5M16.5 3.5a2.121 2.121 0 013 3L12 14l-4 1 1-4 7.5-7.5z"></path></svg>
                Settings
            </a>
        </div>
    </nav>

    <div class="border-t border-sky-100 bg-slate-50/80 p-4">
        <div class="flex items-center space-x-3 rounded-xl border border-sky-100 bg-white px-3 py-3 shadow-sm">
            <div class="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-[#003D7A] to-[#00BFA5] font-semibold text-white">
                <?php echo e(substr($user->name, 0, 1)); ?>

            </div>
            <div class="min-w-0">
                <div class="truncate font-medium text-slate-900"><?php echo e($user->name); ?></div>
                <div class="truncate text-sm capitalize text-slate-500"><?php echo e($user->role); ?></div>
            </div>
        </div>
        <form method="POST" action="<?php echo e(route('logout')); ?>" class="mt-4">
            <?php echo csrf_field(); ?>
            <button type="submit" class="flex w-full items-center rounded-xl px-3 py-2.5 text-left text-sm font-semibold text-red-600 transition hover:bg-red-50 hover:text-red-700">
                <svg class="mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><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>
                Log Out
            </button>
        </form>
    </div>
</aside>
<?php /**PATH D:\true-trucker\web\resources\views/layouts/partials/sidebar.blade.php ENDPATH**/ ?>