<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>User Dashboard - Task Panel</title>
    
    <!-- Google Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400..700;1,400..700&display=swap" rel="stylesheet">
    
    <!-- Inline CSS for styling (Zero external assets required, pure Vanilla CSS) -->
    <script>
        // Clear filter on page refresh instantly to prevent flicker
        if (window.location.search) {
            const navEntries = performance.getEntriesByType("navigation");
            if ((navEntries.length > 0 && navEntries[0].type === "reload") || (performance.navigation && performance.navigation.type === 1)) {
                window.location.replace(window.location.pathname);
            }
        }
    </script>
    <style>
        /* CSS Custom Variables (Consistent with login theme) */
        :root {
            --primary-color: #3b46f1;
            --primary-hover: #2a35d8;
            --primary-light: #eff6ff;
            --bg-main: #f8fafc;
            --bg-card: #ffffff;
            
            --text-main: #0f172a;
            --text-muted: #64748b;
            --text-label: #334155;
            --border-color: #e2e8f0;
            --border-hover: #cbd5e1;
            --font-family: 'Instrument Sans', sans-serif;

            /* Metrics Colors */
            --color-completed: #10b981;
            --color-completed-light: #ecfdf5;
            --color-progress: #3b82f6;
            --color-progress-light: #eff6ff;
            --color-pending: #f59e0b;
            --color-pending-light: #fffbeb;
            --color-hold: #f97316;
            --color-hold-light: #fff7ed;
            --color-cancelled: #ef4444;
            --color-cancelled-light: #fef2f2;
            
            --sidebar-width: 260px;
            --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
            --border-radius: 12px;
        }

        /* Global Reset & Base Styling */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: var(--font-family);
            background-color: var(--bg-main);
            color: var(--text-main);
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            overflow-x: hidden;
        }

        /* Scrollbar customization */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        ::-webkit-scrollbar-track {
            background: transparent;
        }
        ::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

        /* Main Page Layout Wrapper */
        .dashboard-layout {
            display: flex;
            position: relative;
            min-height: 100vh;
        }

        /* Main Content Panel Area */
        .main-content {
            margin-left: var(--sidebar-width);
            flex-grow: 1;
            padding: 2rem;
            display: flex;
            flex-direction: column;
            gap: 2rem;
            min-width: 0;
            transition: margin-left 0.3s ease;
        }

        /* Topbar Header Area */
        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1.5rem;
            flex-wrap: wrap;
        }

        .topbar-left {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .topbar-left .dashboard-header {
            display: flex;
            flex-direction: column;
            gap: 0.125rem;
            animation: none;
        }

        .menu-toggle-btn {
            display: none;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            width: 40px;
            height: 40px;
            border-radius: 8px;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--text-label);
            transition: all 0.2s ease;
        }

        .menu-toggle-btn:hover {
            background-color: var(--primary-light);
            color: var(--primary-color);
            border-color: var(--primary-color);
        }

        .menu-toggle-btn svg {
            width: 1.25rem;
            height: 1.25rem;
        }

        .top-badge {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
            color: #ffffff;
            padding: 0.5rem 1rem;
            border-radius: 9999px;
            font-size: 0.875rem;
            font-weight: 700;
            box-shadow: 0 4px 10px rgba(59, 70, 241, 0.15);
            display: flex;
            align-items: center;
            gap: 0.375rem;
        }

        /* Right section: Profile */
        .topbar-right {
            display: flex;
            align-items: center;
            gap: 1.25rem;
        }

        .notification-trigger {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            cursor: pointer;
            position: relative;
            transition: all 0.2s ease;
            box-shadow: var(--shadow-sm);
        }

        .notification-trigger:hover {
            color: var(--primary-color);
            border-color: var(--primary-hover);
            background-color: var(--primary-light);
        }

        .notification-dot {
            width: 8px;
            height: 8px;
            background-color: #ef4444;
            border-radius: 50%;
            position: absolute;
            top: 2px;
            right: 2px;
            border: 2px solid var(--bg-card);
        }

        .notification-trigger svg {
            width: 1.25rem;
            height: 1.25rem;
            stroke-width: 2;
        }

        /* User Profile badge */
        .user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

        /* Custom image avatar / fallback initials avatar */
        .avatar-frame {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            position: relative;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            overflow: hidden;
            background: linear-gradient(135deg, #4f46e5, #3b82f6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            font-weight: 700;
            font-size: 0.875rem;
        }

        .avatar-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .user-info {
            display: flex;
            flex-direction: column;
            line-height: 1.2;
        }

        .user-fullname {
            font-size: 0.875rem;
            font-weight: 700;
            color: var(--text-main);
        }

        .user-role-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 500;
        }

        /* Welcome Section Header block */
        .dashboard-header {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            animation: fadeIn 0.5s ease-out;
        }

        .dashboard-title {
            font-size: 1.875rem;
            font-weight: 800;
            letter-spacing: -0.03em;
            color: var(--text-main);
        }

        .dashboard-subtitle {
            font-size: 0.95rem;
            color: var(--text-muted);
            font-weight: 500;
        }

        /* Card Component base styling */
        .card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 1.5rem;
            box-shadow: var(--shadow-sm);
            transition: all 0.3s ease;
        }

        .card:hover {
            box-shadow: var(--shadow-md);
            border-color: var(--border-hover);
        }

        .card-title {
            font-size: 1.05rem;
            font-weight: 700;
            color: var(--text-main);
            margin-bottom: 1.25rem;
            letter-spacing: -0.01em;
        }

        /* Metrics summary cards grid layout */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1.25rem;
            animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* Themed metric icon circular frames */
        .metric-icon-box {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 1rem;
            transition: transform 0.3s ease;
        }

        .metric-card:hover .metric-icon-box {
            transform: scale(1.1);
        }

        .metric-icon-box svg {
            width: 1.5rem;
            height: 1.5rem;
            stroke-width: 2;
        }

        .metric-label {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-muted);
            margin-bottom: 0.25rem;
        }

        .metric-value {
            font-size: 1.75rem;
            font-weight: 800;
            color: var(--text-main);
            line-height: 1.1;
            margin-bottom: 0.5rem;
        }

        .metric-trend {
            font-size: 0.75rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }

        /* Theme application rules */
        .theme-blue {
            background-color: var(--color-progress-light);
            color: var(--color-progress);
        }
        .theme-purple {
            background-color: #f5f3ff;
            color: #8b5cf6;
        }
        .theme-orange {
            background-color: var(--color-pending-light);
            color: var(--color-pending);
        }
        .theme-green {
            background-color: var(--color-completed-light);
            color: var(--color-completed);
        }

        .trend-positive {
            color: var(--color-completed);
        }
        .trend-muted {
            color: var(--text-muted);
        }

        /* Charts panel layout */
        .charts-grid {
            display: grid;
            grid-template-columns: 1.1fr 0.9fr;
            gap: 1.5rem;
            animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* Donut Chart visual design */
        .donut-container {
            display: flex;
            align-items: center;
            justify-content: space-around;
            gap: 1.5rem;
            flex-wrap: wrap;
            padding: 0.5rem 0;
        }

        .donut-chart-wrapper {
            position: relative;
            width: 160px;
            height: 160px;
        }

        .donut-chart-wrapper svg {
            width: 100%;
            height: 100%;
            transform: rotate(-90deg);
        }

        /* Center details in Donut hole */
        .donut-center-text {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            display: flex;
            flex-direction: column;
            line-height: 1;
        }

        .donut-number {
            font-size: 1.75rem;
            font-weight: 800;
            color: var(--text-main);
        }

        .donut-label {
            font-size: 0.7rem;
            color: var(--text-muted);
            font-weight: 600;
            margin-top: 0.125rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .donut-slice {
            fill: transparent;
            stroke-width: 18;
            transition: stroke-width 0.2s ease, filter 0.2s ease;
            cursor: pointer;
        }

        .donut-slice:hover {
            stroke-width: 21;
            filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
        }

        .slice-completed {
            stroke: var(--color-completed);
            animation: draw-completed 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        .slice-progress {
            stroke: var(--color-progress);
            animation: draw-progress 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        .slice-pending {
            stroke: var(--color-pending);
            animation: draw-pending 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        .slice-hold {
            stroke: var(--color-hold);
            animation: draw-hold 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        .slice-cancelled {
            stroke: var(--color-cancelled);
            animation: draw-cancelled 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }

        /* Legend items inside donut view */
        .donut-legend {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            min-width: 180px;
        }

        .legend-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.5rem 0.75rem;
            border-radius: 6px;
            transition: background-color 0.2s ease;
        }

        .legend-item:hover {
            background-color: var(--bg-main);
        }

        .legend-left {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-label);
        }

        .legend-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .legend-right {
            font-size: 0.85rem;
            font-weight: 700;
            color: var(--text-main);
            text-align: right;
        }

        .legend-percentage {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 500;
            margin-left: 0.25rem;
        }

        /* Vertical Bar Chart layout design */
        .bar-chart-container {
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            height: 200px;
            position: relative;
            padding-top: 1.5rem;
        }

        .bar-chart-gridlines {
            position: absolute;
            inset: 1.5rem 0 1.75rem 24px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            pointer-events: none;
            z-index: 1;
        }

        .gridline {
            width: 100%;
            border-bottom: 1px dashed var(--border-color);
            position: relative;
        }

        .gridline-label {
            position: absolute;
            left: -24px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--text-muted);
        }

        .bar-chart-plot {
            position: relative;
            z-index: 5;
            display: flex;
            justify-content: space-around;
            align-items: flex-end;
            height: 100%;
            margin-left: 24px;
            padding-bottom: 0.25rem;
        }

        .bar-column {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 60px;
            height: 100%;
            justify-content: flex-end;
        }

        .bar-value {
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--text-main);
            margin-bottom: 0.25rem;
            opacity: 0;
            transform: translateY(4px);
            animation: showValue 0.5s ease-out 0.8s forwards;
        }

        .bar-pill {
            width: 24px;
            border-radius: 4px 4px 0 0;
            position: relative;
            transition: all 0.3s ease;
            cursor: pointer;
            height: 0;
        }

        .bar-pill:hover {
            transform: scaleX(1.15);
            filter: brightness(1.05);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
        }

        /* Animations for bars height */
        .bar-completed {
            background: linear-gradient(to top, var(--color-completed), #34d399);
            animation: grow-bar-completed 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        .bar-progress {
            background: linear-gradient(to top, var(--color-progress), #60a5fa);
            animation: grow-bar-progress 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        .bar-pending {
            background: linear-gradient(to top, var(--color-pending), #fbbf24);
            animation: grow-bar-pending 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        .bar-hold {
            background: linear-gradient(to top, var(--color-hold), #fdba74);
            animation: grow-bar-hold 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        .bar-cancelled {
            background: linear-gradient(to top, var(--color-cancelled), #f87171);
            animation: grow-bar-cancelled 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        .bar-label {
            font-size: 0.725rem;
            font-weight: 700;
            color: var(--text-muted);
            margin-top: 0.5rem;
            text-align: center;
            white-space: nowrap;
        }

        @keyframes showValue {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Bottom lists layout */
        .bottom-grid {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            margin-bottom: 2rem;
            animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
        }   

        /* Table design customization */
        .table-responsive {
            width: 100%;
            overflow-x: auto;
        }

        .tasks-table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
        }

        .tasks-table th {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-weight: 700;
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .tasks-table td {
            padding: 0.9rem 1rem;
            border-bottom: 1px solid var(--border-color);
            font-size: 0.875rem;
            color: var(--text-label);
        }

        .tasks-table tr:last-child td {
            border-bottom: none;
        }

        .tasks-table tbody tr {
            transition: background-color 0.2s ease;
        }

        .tasks-table tbody tr:hover {
            background-color: #fafafb;
        }

        .task-name-cell {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
            color: var(--text-main);
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .project-tag {
            color: var(--text-muted);
            font-weight: 500;
        }

        .badge {
            display: inline-flex;
            align-items: center;
            padding: 0.25rem 0.625rem;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 700;
            line-height: 1;
            white-space: nowrap;
        }

        .badge-progress {
            background-color: var(--color-progress-light);
            color: var(--color-progress);
        }

        .badge-completed {
            background-color: var(--color-completed-light);
            color: var(--color-completed);
        }

        .badge-pending {
            background-color: var(--color-pending-light);
            color: var(--color-pending);
        }

        .badge-hold {
            background-color: var(--color-hold-light);
            color: var(--color-hold);
        }

        .badge-cancelled {
            background-color: var(--color-cancelled-light);
            color: var(--color-cancelled);
        }



        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(16px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* ==========================================================================
           RESPONSIVE STYLES (Mobile / Tablet adaptations)
           ========================================================================== */
        @media (max-width: 1024px) {
            .main-content {
                margin-left: 0;
                padding: 1.5rem;
            }

            .menu-toggle-btn {
                display: flex;
            }

            .metrics-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .charts-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 640px) {
            .metrics-grid {
                grid-template-columns: 1fr;
            }

            .bottom-grid {
                grid-template-columns: 1fr;
            }

            .topbar-right {
                width: 100%;
                justify-content: space-between;
                margin-top: 0.5rem;
            }

            .donut-container {
                flex-direction: column;
                align-items: center;
            }
        }
    </style>
    <!-- Favicon -->
    <link rel="icon" type="image/png" href="<?php echo e(asset('images/faviocntaskpannel.png')); ?>">
</head>
<body>

    <div class="dashboard-layout">

        <?php echo $__env->make('user.sidebar.sidebar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

        <main class="main-content">

            <?php ob_start(); ?>
                <form method="GET" action="<?php echo e(route('user.dashboard')); ?>" style="display: flex; gap: 1rem; align-items: center; margin-left: auto; margin-right: 1rem;">
                    <select name="project_id" onchange="this.form.submit()" style="padding: 0.5rem; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-main); color: var(--text-main); font-family: inherit; font-size: 0.875rem;">
                        <option value="">All Projects</option>
                        <?php $__currentLoopData = $allProjects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($p->id); ?>" <?php echo e(request('project_id') == $p->id ? 'selected' : ''); ?>><?php echo e($p->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </form>
            <?php $rightContent = ob_get_clean(); ?>

            <?php echo $__env->make('user.sidebar.topbar', [
                'pageTitle'    => 'Dashboard',
                'pageSubtitle' => 'Welcome back, ' . explode(' ', $user->name)[0] . '! 👋',
                'rightContent' => $rightContent
            ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <section class="metrics-grid">
                
                <!-- Card 1: Total Tasks -->
                <a href="<?php echo e(route('user.tasks.index')); ?>" class="card metric-card" style="text-decoration: none; color: inherit; display: block;">
                    <div class="metric-icon-box theme-purple" style="background-color: var(--primary-light); color: var(--primary-color);">
                        <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>
                    </div>
                    <div class="metric-label">Total Tasks</div>
                    <div class="metric-value"><?php echo e($totalTasks); ?></div>
                    <div class="metric-trend trend-muted">All Tasks</div>
                </a>
            </section>

            <section class="charts-grid">

                
                <?php
                    $completedDash = $totalTasks > 0 ? ($completedTasks / $totalTasks) * 439.8 : 0;
                    $inProgressDash = $totalTasks > 0 ? ($inProgressTasks / $totalTasks) * 439.8 : 0;
                    $pendingDash = $totalTasks > 0 ? ($pendingTasks / $totalTasks) * 439.8 : 0;
                    $holdDash = $totalTasks > 0 ? ($holdTasks / $totalTasks) * 439.8 : 0;
                    $cancelledDash = $totalTasks > 0 ? ($cancelledTasks / $totalTasks) * 439.8 : 0;

                    $inProgressOffset = -$completedDash;
                    $pendingOffset = -($completedDash + $inProgressDash);
                    $holdOffset = -($completedDash + $inProgressDash + $pendingDash);
                    $cancelledOffset = -($completedDash + $inProgressDash + $pendingDash + $holdDash);
                ?>

                <!-- Dynamic keyframe height style overrides -->
                <style>
                    @keyframes grow-bar-completed { from { height: 0; } to { height: <?php echo e($completedPercentage); ?>%; } }
                    @keyframes grow-bar-progress { from { height: 0; } to { height: <?php echo e($inProgressPercentage); ?>%; } }
                    @keyframes grow-bar-pending { from { height: 0; } to { height: <?php echo e($pendingPercentage); ?>%; } }
                    @keyframes grow-bar-hold { from { height: 0; } to { height: <?php echo e($holdPercentage); ?>%; } }
                    @keyframes grow-bar-cancelled { from { height: 0; } to { height: <?php echo e($cancelledPercentage); ?>%; } }

                    @keyframes draw-completed { from { stroke-dasharray: 0 439.8; } to { stroke-dasharray: <?php echo e($completedDash); ?> 439.8; } }
                    @keyframes draw-progress { from { stroke-dasharray: 0 439.8; } to { stroke-dasharray: <?php echo e($inProgressDash); ?> 439.8; } }
                    @keyframes draw-pending { from { stroke-dasharray: 0 439.8; } to { stroke-dasharray: <?php echo e($pendingDash); ?> 439.8; } }
                    @keyframes draw-hold { from { stroke-dasharray: 0 439.8; } to { stroke-dasharray: <?php echo e($holdDash); ?> 439.8; } }
                    @keyframes draw-cancelled { from { stroke-dasharray: 0 439.8; } to { stroke-dasharray: <?php echo e($cancelledDash); ?> 439.8; } }
                </style>
                
                <!-- Card 1: Task Progress (Donut Chart) -->
                <div class="card">
                    <h2 class="card-title">Task Progress</h2>
                    
                    <div class="donut-container">
                        <div class="donut-chart-wrapper">
                            <svg viewBox="0 0 200 200">
                                <!-- Background Circle track -->
                                <circle cx="100" cy="100" r="70" fill="transparent" stroke="#f1f5f9" stroke-width="18" />
                                
                                <?php if($totalTasks > 0): ?>
                                    <!-- Completed -->
                                    <circle class="donut-slice slice-completed" cx="100" cy="100" r="70" 
                                            stroke-dasharray="<?php echo e($completedDash); ?> 439.8" stroke-dashoffset="0" />
                                    
                                    <!-- In Progress -->
                                    <circle class="donut-slice slice-progress" cx="100" cy="100" r="70" 
                                            stroke-dasharray="<?php echo e($inProgressDash); ?> 439.8" stroke-dashoffset="<?php echo e($inProgressOffset); ?>" />
                                    
                                    <!-- Pending -->
                                    <circle class="donut-slice slice-pending" cx="100" cy="100" r="70" 
                                            stroke-dasharray="<?php echo e($pendingDash); ?> 439.8" stroke-dashoffset="<?php echo e($pendingOffset); ?>" />

                                    <!-- Hold -->
                                    <circle class="donut-slice slice-hold" cx="100" cy="100" r="70" 
                                            stroke-dasharray="<?php echo e($holdDash); ?> 439.8" stroke-dashoffset="<?php echo e($holdOffset); ?>" />

                                    <!-- Cancelled -->
                                    <circle class="donut-slice slice-cancelled" cx="100" cy="100" r="70" 
                                            stroke-dasharray="<?php echo e($cancelledDash); ?> 439.8" stroke-dashoffset="<?php echo e($cancelledOffset); ?>" />
                                <?php endif; ?>
                            </svg>
                            
                            <!-- Central Label Display -->
                            <div class="donut-center-text">
                                <span class="donut-number"><?php echo e($filteredTotalTasks); ?></span>
                                <span class="donut-label">Filtered Tasks</span>
                            </div>
                        </div>

                        <!-- Legend -->
                        <div class="donut-legend">
                            <div class="legend-item">
                                <div class="legend-left">
                                    <span class="legend-dot" style="background-color: var(--color-completed);"></span>
                                    <span>Completed</span>
                                </div>
                                <div class="legend-right">
                                    <span><?php echo e($completedTasks); ?></span>
                                    <span class="legend-percentage">(<?php echo e($completedPercentage); ?>%)</span>
                                </div>
                            </div>
                            <div class="legend-item">
                                <div class="legend-left">
                                    <span class="legend-dot" style="background-color: var(--color-progress);"></span>
                                    <span>In Progress</span>
                                </div>
                                <div class="legend-right">
                                    <span><?php echo e($inProgressTasks); ?></span>
                                    <span class="legend-percentage">(<?php echo e($inProgressPercentage); ?>%)</span>
                                </div>
                            </div>
                            <div class="legend-item">
                                <div class="legend-left">
                                    <span class="legend-dot" style="background-color: var(--color-pending);"></span>
                                    <span>Pending</span>
                                </div>
                                <div class="legend-right">
                                    <span><?php echo e($pendingTasks); ?></span>
                                    <span class="legend-percentage">(<?php echo e($pendingPercentage); ?>%)</span>
                                </div>
                            </div>
                            <div class="legend-item">
                                <div class="legend-left">
                                    <span class="legend-dot" style="background-color: var(--color-hold);"></span>
                                    <span>Hold</span>
                                </div>
                                <div class="legend-right">
                                    <span><?php echo e($holdTasks); ?></span>
                                    <span class="legend-percentage">(<?php echo e($holdPercentage); ?>%)</span>
                                </div>
                            </div>
                            <div class="legend-item">
                                <div class="legend-left">
                                    <span class="legend-dot" style="background-color: var(--color-cancelled);"></span>
                                    <span>Cancelled</span>
                                </div>
                                <div class="legend-right">
                                    <span><?php echo e($cancelledTasks); ?></span>
                                    <span class="legend-percentage">(<?php echo e($cancelledPercentage); ?>%)</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Card 2: Tasks by Status (Bar Chart) -->
                <div class="card">
                    <h2 class="card-title">Tasks by Status</h2>
                    
                    <div class="bar-chart-container">
                        <div class="bar-chart-gridlines">
                            <div class="gridline"><span class="gridline-label">100</span></div>
                            <div class="gridline"><span class="gridline-label">75</span></div>
                            <div class="gridline"><span class="gridline-label">50</span></div>
                            <div class="gridline"><span class="gridline-label">25</span></div>
                            <div class="gridline" style="border-bottom: 1px solid var(--border-color);"><span class="gridline-label">0</span></div>
                        </div>

                        <div class="bar-chart-plot">
                            <!-- Completed Bar -->
                            <div class="bar-column">
                                <span class="bar-value"><?php echo e($completedTasks); ?></span>
                                <div class="bar-pill bar-completed" title="Completed: <?php echo e($completedTasks); ?>"></div>
                                <span class="bar-label">Completed</span>
                            </div>
                            
                            <!-- In Progress Bar -->
                            <div class="bar-column">
                                <span class="bar-value"><?php echo e($inProgressTasks); ?></span>
                                <div class="bar-pill bar-progress" title="In Progress: <?php echo e($inProgressTasks); ?>"></div>
                                <span class="bar-label">In Progress</span>
                            </div>
                            
                            <!-- Pending Bar -->
                            <div class="bar-column">
                                <span class="bar-value"><?php echo e($pendingTasks); ?></span>
                                <div class="bar-pill bar-pending" title="Pending: <?php echo e($pendingTasks); ?>"></div>
                                <span class="bar-label">Pending</span>
                            </div>

                            <!-- Hold Bar -->
                            <div class="bar-column">
                                <span class="bar-value"><?php echo e($holdTasks); ?></span>
                                <div class="bar-pill bar-hold" title="Hold: <?php echo e($holdTasks); ?>"></div>
                                <span class="bar-label">Hold</span>
                            </div>

                            <!-- Cancelled Bar -->
                            <div class="bar-column">
                                <span class="bar-value"><?php echo e($cancelledTasks); ?></span>
                                <div class="bar-pill bar-cancelled" title="Cancelled: <?php echo e($cancelledTasks); ?>"></div>
                                <span class="bar-label">Cancelled</span>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <!-- ==========================================
                 3. BOTTOM SECTION (RECENT TASKS & DEADLINES)
                 ========================================== -->
            <section class="bottom-grid">
                
                <!-- Recent Tasks -->
                <div class="card">
                    <h2 class="card-title">Recent Tasks</h2>
                    
                    <div class="table-responsive">
                        <table class="tasks-table">
                            <thead>
                                <tr>
                                    <th>Task Name</th>
                                    <th>Project</th>
                                    <th>Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $recentTasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <?php
                                        $statusClass = 'pending';
                                        $dotColor = 'var(--color-pending)';
                                        $statusLower = strtolower($task->status);
                                        if ($statusLower === 'completed') {
                                            $statusClass = 'completed';
                                            $dotColor = 'var(--color-completed)';
                                        } elseif ($statusLower === 'in progress') {
                                            $statusClass = 'progress';
                                            $dotColor = 'var(--color-progress)';
                                        } elseif ($statusLower === 'hold') {
                                            $statusClass = 'hold';
                                            $dotColor = 'var(--color-hold)';
                                        } elseif ($statusLower === 'cancelled') {
                                            $statusClass = 'cancelled';
                                            $dotColor = 'var(--color-cancelled)';
                                        }
                                    ?>
                                    <tr>
                                        <td>
                                            <div class="task-name-cell">
                                                <span class="status-dot" style="background-color: <?php echo e($dotColor); ?>;"></span>
                                                <span><?php echo e($task->name); ?></span>
                                            </div>
                                        </td>
                                        <td><span class="project-tag"><?php echo e($task->project->name); ?></span></td>
                                        <td><span class="badge badge-<?php echo e($statusClass); ?>"><?php echo e($task->status); ?></span></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="3" style="text-align: center; padding: 2rem; color: var(--text-muted);">
                                            No recent tasks
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </section>
        </main>
    </div>

    <script>
    </script>
</body>
</html>
<?php /**PATH D:\New\New\admin-panel\resources\views/user/dashboard/dashboard.blade.php ENDPATH**/ ?>