<?php
    $isAdmin = false;
    if (session('is_admin_logged_in')) {
        $isAdmin = true;
    } elseif (Auth::check()) {
        $user = Auth::user();
        if ($user->role === 'Super Admin' || $user->role === 'Admin') {
            $isAdmin = true;
        }
    }
?>

<?php if (! $__env->hasRenderedOnce('ae616f8f-57c6-42aa-9872-d4ea5245b293')): $__env->markAsRenderedOnce('ae616f8f-57c6-42aa-9872-d4ea5245b293'); ?>
<style>
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background-color: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 90;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }

    /* Sidebar Styling */
    .sidebar {
        width: 260px;
        background-color: #0e1c59 !important;
        border-right: 1px solid rgba(255, 255, 255, 0.15) !important;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 1.5rem;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Brand / Logo section */
    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 2rem;
        text-decoration: none;
        color: #ffffff !important;
    }

    .brand-logo-box {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: linear-gradient(135deg, #3b46f1, #2a35d8);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #ffffff;
        box-shadow: 0 4px 10px rgba(59, 70, 241, 0.2);
    }

    .brand-name {
        font-size: 1.25rem;
        font-weight: 700;
        letter-spacing: -0.025em;
        color: #ffffff !important;
    }

    /* Sidebar Navigation Menu */
    .sidebar-menu {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
        flex-grow: 1;
        padding: 0;
        margin: 0;
    }

    .sidebar-item a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        color: rgba(255, 255, 255, 0.75) !important;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.95rem;
        border-radius: 8px;
        transition: all 0.2s ease;
    }

    .sidebar-item a svg {
        width: 1.25rem;
        height: 1.25rem;
        stroke-width: 2;
        transition: stroke 0.2s ease;
    }

    /* Sidebar hover and active states */
    .sidebar-item a:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
    }

    .sidebar-item a:hover svg {
        color: #ffffff !important;
    }

    .sidebar-item.active a {
        background: linear-gradient(135deg, #3b46f1, #2a35d8) !important;
        color: #ffffff !important;
        box-shadow: 0 4px 12px rgba(59, 70, 241, 0.15);
    }

    .sidebar-item.active a svg {
        color: #ffffff !important;
    }

    /* Sidebar close button (mobile only) */
    .sidebar-close-btn {
        display: none;
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.6);
        cursor: pointer;
        position: absolute;
        top: 1.5rem;
        right: 1rem;
    }

    .sidebar-close-btn svg {
        width: 1.5rem;
        height: 1.5rem;
    }

    /* Sidebar Footer / Logout button */
    .sidebar-footer {
        border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
        padding-top: 1.25rem;
        margin-top: auto;
    }

    .logout-link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        color: rgba(255, 255, 255, 0.75) !important;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.95rem;
        border-radius: 8px;
        transition: all 0.2s ease;
        cursor: pointer;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
    }

    .logout-link:hover {
        background-color: rgba(239, 68, 68, 0.15) !important;
        color: #f87171 !important;
    }

    .logout-link svg {
        width: 1.25rem;
        height: 1.25rem;
        stroke-width: 2;
    }

    @media (max-width: 1024px) {
        .sidebar {
            transform: translateX(-100%);
        }
        
        .sidebar.active {
            transform: translateX(0) !important;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
        }

        .sidebar-close-btn {
            display: block !important;
        }
    }
</style>
<?php endif; ?>

<div id="sidebar-backdrop" class="sidebar-backdrop"></div>

<aside id="dashboard-sidebar" class="sidebar">
    <button id="sidebar-close" class="sidebar-close-btn" aria-label="Close sidebar">
        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
            <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"></path>
        </svg>
    </button>

    <!-- Brand Logo Header -->
    <div>
        <a href="<?php echo e($isAdmin ? route('dashboard') : route('user.dashboard')); ?>" class="sidebar-brand">
            <div class="brand-logo-box">
                <svg style="width: 1.25rem; height: 1.25rem;" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                    <path stroke-linecap="round" stroke-linejoin="round" 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-6 9l2 2 4-4"></path>
                </svg>
            </div>
            <span class="brand-name"><?php echo e($isAdmin ? 'ADMIN PANEL' : 'USER PANEL'); ?></span>
        </a>

        <!-- Navigation List Menu -->
        <ul class="sidebar-menu">
            <?php if($isAdmin): ?>
                <li class="sidebar-item <?php echo e(request()->routeIs('dashboard') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('dashboard')); ?>">
                        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                            <path stroke-linecap="round" stroke-linejoin="round" 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>
                        <span>Dashboard</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('users.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('users.index')); ?>">
                        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a3 3 0 11-6 0 3 3 0 016 0z"></path>
                        </svg>
                        <span>Users</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('projects.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('projects.index')); ?>">
                        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>
                        </svg>
                        <span>Projects</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('tasks.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('tasks.index')); ?>">
                        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                            <path stroke-linecap="round" stroke-linejoin="round" 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>
                        <span>Manage Tasks</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('profile.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('profile.index')); ?>">
                        <svg 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="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>
                        <span>Profile</span>
                    </a>
                </li>
            <?php else: ?>
                <li class="sidebar-item <?php echo e(request()->routeIs('user.dashboard') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('user.dashboard')); ?>">
                        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                            <path stroke-linecap="round" stroke-linejoin="round" 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>
                        <span>Dashboard</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('user.tasks.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('user.tasks.index')); ?>">
                        <svg 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="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>
                        <span>My Tasks</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('user.profile.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('user.profile.index')); ?>">
                        <svg 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="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>
                        <span>Profile</span>
                    </a>
                </li>
                <li class="sidebar-item <?php echo e(request()->routeIs('user.change-password.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('user.change-password.index')); ?>">
                        <svg 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="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
                        </svg>
                        <span>Change Password</span>
                    </a>
                </li>
            <?php endif; ?>
        </ul>
    </div>

    <!-- Logout Link Button -->
    <div class="sidebar-footer">
        <form method="POST" action="<?php echo e(route('logout')); ?>" id="logout-form" style="display: none;">
            <?php echo csrf_field(); ?>
        </form>
        <button class="logout-link" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                <path stroke-linecap="round" stroke-linejoin="round" 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>
            <span>Logout</span>
        </button>
    </div>
</aside>


<script>
    document.addEventListener('DOMContentLoaded', function() {
        const sidebar = document.getElementById('dashboard-sidebar');
        const sidebarToggle = document.getElementById('sidebar-toggle');
        const sidebarClose = document.getElementById('sidebar-close');
        const sidebarBackdrop = document.getElementById('sidebar-backdrop');

        function toggleSidebar() {
            if (sidebar) sidebar.classList.toggle('active');
            if (sidebarBackdrop) sidebarBackdrop.classList.toggle('active');
        }

        if (sidebarToggle) sidebarToggle.addEventListener('click', toggleSidebar);
        if (sidebarClose) sidebarClose.addEventListener('click', toggleSidebar);
        if (sidebarBackdrop) sidebarBackdrop.addEventListener('click', toggleSidebar);
    });
</script>
<?php /**PATH D:\New\New\admin-panel\resources\views/admin/sidebar/sidebar.blade.php ENDPATH**/ ?>