<?php if (isset($component)) { $__componentOriginal4619374cef299e94fd7263111d0abc69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal4619374cef299e94fd7263111d0abc69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.app-layout','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> Dashboard <?php $__env->endSlot(); ?>
    
    <!-- Override Main Background for Dashboard -->
    <style>
        main { background-color: transparent !important; }
    </style>

    <!-- Background Decorators for Glassmorphism -->
    <div class="fixed top-0 left-0 w-full h-96 bg-gradient-to-br from-indigo-900 via-primary-900 to-slate-900 opacity-90 -z-10"></div>
    <div class="fixed top-20 right-20 w-96 h-96 bg-primary-500/30 rounded-full blur-[120px] -z-10 pointer-events-none"></div>
    <div class="fixed bottom-20 left-20 w-96 h-96 bg-indigo-500/20 rounded-full blur-[100px] -z-10 pointer-events-none"></div>

    <div class="max-w-7xl mx-auto py-8 px-4 sm:px-6 lg:px-8 relative z-0">
        <!-- Header -->
        <div class="mb-10 flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4">
            <div>
                <h1 class="text-3xl font-extrabold text-white tracking-tight drop-shadow-sm">Welcome back, <?php echo e(explode(' ', Auth::user()->name)[0]); ?></h1>
                <p class="text-primary-100 mt-2 font-medium text-sm">Here's what's happening with your business today.</p>
            </div>
            <div class="flex items-center gap-3">
                <div class="bg-white/10 backdrop-blur-md border border-white/20 text-white px-4 py-2 rounded-xl text-sm font-semibold shadow-lg">
                    <span class="opacity-80 font-normal mr-1">Today:</span> <?php echo e(date('M d, Y')); ?>

                </div>
            </div>
        </div>

        <!-- Premium Stats Grid -->
        <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-5 mb-12">
            <!-- Card 1: Total Sales (Gradient Focus) -->
            <div class="group bg-gradient-to-br from-primary-500 to-primary-700 p-6 rounded-3xl border border-primary-400/50 shadow-2xl shadow-primary-500/30 flex flex-col justify-between hover:-translate-y-1 hover:shadow-primary-500/40 transition-all duration-300 cursor-pointer overflow-hidden relative" onclick="window.location='<?php echo e(route('bookings.index')); ?>'">
                <div class="absolute top-0 right-0 -mt-4 -mr-4 w-24 h-24 bg-white/10 rounded-full blur-2xl transform group-hover:scale-150 transition-transform duration-500"></div>
                <div class="flex items-center justify-between mb-8 relative z-10">
                    <span class="text-xs font-bold text-white/80 uppercase tracking-wider">Total Sales</span>
                    <div class="bg-white/20 p-2 rounded-xl backdrop-blur-sm">
                        <svg class="h-5 w-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"></path></svg>
                    </div>
                </div>
                <div class="relative z-10">
                    <div class="text-3xl font-black text-white tracking-tight drop-shadow-md">Rs <?php echo e(number_format($totalSales)); ?></div>
                </div>
            </div>
            
            <!-- Card 2: Collections -->
            <div class="group bg-white/80 backdrop-blur-xl p-6 rounded-3xl border border-white/60 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col justify-between hover:-translate-y-1 hover:bg-white transition-all duration-300 cursor-pointer" onclick="window.location='<?php echo e(route('transactions.index')); ?>'">
                <div class="flex items-center justify-between mb-8">
                    <span class="text-xs font-bold text-gray-500 uppercase tracking-wider">Collections</span>
                    <div class="bg-indigo-50 p-2 rounded-xl text-indigo-600 group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-300">
                        <svg class="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-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                    </div>
                </div>
                <div class="text-2xl font-extrabold text-gray-900 tracking-tight">Rs <?php echo e(number_format($actualCollections)); ?></div>
            </div>

            <!-- Card 3: Gross Profit -->
            <div class="group bg-white/80 backdrop-blur-xl p-6 rounded-3xl border border-white/60 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col justify-between hover:-translate-y-1 hover:bg-white transition-all duration-300 cursor-pointer">
                <div class="flex items-center justify-between mb-8">
                    <span class="text-xs font-bold text-gray-500 uppercase tracking-wider">Gross Profit</span>
                    <div class="bg-emerald-50 p-2 rounded-xl text-emerald-600 group-hover:bg-emerald-500 group-hover:text-white transition-colors duration-300">
                        <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path></svg>
                    </div>
                </div>
                <div class="text-2xl font-extrabold text-gray-900 tracking-tight">Rs <?php echo e(number_format($profit)); ?></div>
            </div>

            <!-- Card 4: Defaulters -->
            <div class="group bg-white/80 backdrop-blur-xl p-6 rounded-3xl border border-white/60 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col justify-between hover:-translate-y-1 hover:bg-white transition-all duration-300 cursor-pointer relative overflow-hidden" onclick="window.location='<?php echo e(route('customers.index', ['is_defaulter' => 1])); ?>'">
                <?php if($defaultersCount > 0): ?>
                <div class="absolute top-0 right-0 w-2 h-full bg-red-500 shadow-[0_0_15px_rgba(239,68,68,0.5)]"></div>
                <?php endif; ?>
                <div class="flex items-center justify-between mb-8">
                    <span class="text-xs font-bold text-gray-500 uppercase tracking-wider">Defaulters</span>
                    <div class="bg-red-50 p-2 rounded-xl text-red-600 group-hover:bg-red-500 group-hover:text-white transition-colors duration-300">
                        <svg class="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 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
                    </div>
                </div>
                <div class="text-2xl font-extrabold <?php echo e($defaultersCount > 0 ? 'text-red-600' : 'text-gray-900'); ?> tracking-tight"><?php echo e($defaultersCount); ?></div>
            </div>

            <!-- Card 5: Available Plots -->
            <div class="group bg-white/80 backdrop-blur-xl p-6 rounded-3xl border border-white/60 shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col justify-between hover:-translate-y-1 hover:bg-white transition-all duration-300 cursor-pointer" onclick="window.location='<?php echo e(route('properties.index')); ?>'">
                <div class="flex items-center justify-between mb-8">
                    <span class="text-xs font-bold text-gray-500 uppercase tracking-wider">Available Plots</span>
                    <div class="bg-blue-50 p-2 rounded-xl text-blue-600 group-hover:bg-blue-500 group-hover:text-white transition-colors duration-300">
                        <svg class="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 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path></svg>
                    </div>
                </div>
                <div class="text-2xl font-extrabold text-gray-900 tracking-tight"><?php echo e($availableProperties); ?></div>
            </div>
        </div>

        <!-- Main Content Area -->
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
            <!-- Left Column: Chart and Sales -->
            <div class="lg:col-span-2 space-y-8">
                <!-- Premium Chart -->
                <div class="bg-white/90 backdrop-blur-xl p-6 md:p-8 rounded-[2rem] border border-white shadow-[0_8px_30px_rgb(0,0,0,0.04)]">
                    <div class="flex flex-col sm:flex-row justify-between items-start sm:items-end mb-8 gap-4">
                        <div>
                            <h3 class="text-lg font-bold text-gray-900">Revenue Pipeline</h3>
                            <p class="text-sm text-gray-500 mt-1">Monthly recurring and one-time collections (<?php echo e(date('Y')); ?>)</p>
                        </div>
                    </div>
                    <div class="relative h-[320px] w-full">
                        <canvas id="revenueChart" class="w-full h-full"></canvas>
                    </div>
                </div>

                <!-- Recent Sales Table -->
                <div class="bg-white/90 backdrop-blur-xl rounded-[2rem] border border-white shadow-[0_8px_30px_rgb(0,0,0,0.04)] overflow-hidden flex flex-col">
                    <div class="p-6 md:p-8 border-b border-gray-100 flex justify-between items-center bg-white/50">
                        <div>
                            <h3 class="text-lg font-bold text-gray-900">Recent Sales</h3>
                            <p class="text-sm text-gray-500 mt-1">Latest property bookings</p>
                        </div>
                        <a href="<?php echo e(route('bookings.index')); ?>" class="text-sm font-semibold text-primary-600 hover:text-primary-800 transition-colors bg-primary-50 px-4 py-2 rounded-full">View All</a>
                    </div>
                    <div class="overflow-x-auto w-full">
                        <table class="min-w-full text-sm">
                            <thead>
                                <tr class="bg-gray-50/50">
                                    <th class="px-6 py-4 text-left font-bold text-gray-500 uppercase tracking-wider text-xs">Customer</th>
                                    <th class="px-6 py-4 text-left font-bold text-gray-500 uppercase tracking-wider text-xs">Property</th>
                                    <th class="px-6 py-4 text-right font-bold text-gray-500 uppercase tracking-wider text-xs">Date</th>
                                </tr>
                            </thead>
                            <tbody class="divide-y divide-gray-50 bg-white">
                                <?php $__empty_1 = true; $__currentLoopData = $recentBookings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $booking): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr class="hover:bg-gray-50 transition-colors cursor-pointer group" onclick="window.location='<?php echo e(route('bookings.show', $booking->id)); ?>'">
                                    <td class="px-6 py-4">
                                        <div class="flex items-center gap-3">
                                            <div class="h-8 w-8 rounded-full bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center text-gray-600 font-bold text-xs border border-gray-200">
                                                <?php echo e(substr($booking->customer->full_name ?? 'N', 0, 1)); ?>

                                            </div>
                                            <div class="font-bold text-gray-900 group-hover:text-primary-600 transition-colors"><?php echo e($booking->customer->full_name ?? 'N/A'); ?></div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 font-medium text-gray-600"><?php echo e($booking->property->title ?? 'N/A'); ?></td>
                                    <td class="px-6 py-4 text-right">
                                        <span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-gray-100 text-gray-600">
                                            <?php echo e($booking->booking_date->format('M d, Y')); ?>

                                        </span>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="3" class="px-6 py-12 text-center text-gray-400 font-medium">No recent sales found.</td>
                                </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <!-- Right Column: Leads and Quick Actions -->
            <div class="space-y-8">
                <!-- New Leads -->
                <div class="bg-white/90 backdrop-blur-xl rounded-[2rem] border border-white shadow-[0_8px_30px_rgb(0,0,0,0.04)] flex flex-col">
                    <div class="p-6 md:p-8 border-b border-gray-100 flex justify-between items-center bg-white/50">
                        <div>
                            <h3 class="text-lg font-bold text-gray-900">New Leads</h3>
                            <p class="text-sm text-gray-500 mt-1">Recently acquired</p>
                        </div>
                        <a href="<?php echo e(route('leads.index')); ?>" class="text-sm font-semibold text-indigo-600 hover:text-indigo-800 transition-colors bg-indigo-50 px-4 py-2 rounded-full">View All</a>
                    </div>
                    <div class="p-4 bg-white rounded-b-[2rem]">
                        <div class="space-y-2">
                            <?php $__empty_1 = true; $__currentLoopData = $recentLeads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lead): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="flex items-center justify-between group cursor-pointer hover:bg-gray-50 p-4 rounded-2xl transition-all border border-transparent hover:border-gray-100" onclick="window.location='<?php echo e(route('leads.show', $lead->id)); ?>'">
                                <div class="flex items-center gap-4">
                                    <div class="h-10 w-10 rounded-xl bg-gradient-to-br from-indigo-50 to-indigo-100 flex items-center justify-center text-indigo-600 font-bold border border-indigo-100 shadow-sm group-hover:scale-110 transition-transform">
                                        <?php echo e(substr($lead->name, 0, 1)); ?>

                                    </div>
                                    <div>
                                        <p class="text-sm font-bold text-gray-900 group-hover:text-indigo-600 transition-colors"><?php echo e($lead->name); ?></p>
                                        <p class="text-xs font-medium text-gray-400 mt-0.5 flex items-center gap-1">
                                            <svg class="w-3 h-3" 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>
                                            <?php echo e($lead->created_at->diffForHumans()); ?>

                                        </p>
                                    </div>
                                </div>
                                <div class="h-8 w-8 rounded-full bg-white flex items-center justify-center shadow-sm border border-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:border-indigo-200 transition-colors">
                                    <svg class="h-4 w-4 transform group-hover:translate-x-0.5 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
                                </div>
                            </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <p class="text-sm font-medium text-gray-400 text-center py-8">No recent leads.</p>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>

                <!-- Quick Reports (Glassmorphism Buttons) -->
                <div class="bg-white/90 backdrop-blur-xl p-6 md:p-8 rounded-[2rem] border border-white shadow-[0_8px_30px_rgb(0,0,0,0.04)]">
                    <h3 class="text-lg font-bold text-gray-900 mb-6">Quick Reports</h3>
                    <div class="space-y-3">
                        <a href="<?php echo e(route('reports.standard', ['preset' => 'financial'])); ?>" class="flex items-center justify-between p-4 rounded-2xl border border-gray-100 bg-gradient-to-r from-gray-50 to-white hover:from-primary-50 hover:to-white hover:border-primary-100 hover:shadow-md transition-all group">
                            <span class="text-sm font-bold text-gray-700 group-hover:text-primary-700">Monthly Revenue</span>
                            <svg class="w-5 h-5 text-gray-400 group-hover:text-primary-500 transition-colors" 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>
                        </a>
                        <a href="<?php echo e(route('reports.standard', ['preset' => 'sales'])); ?>" class="flex items-center justify-between p-4 rounded-2xl border border-gray-100 bg-gradient-to-r from-gray-50 to-white hover:from-indigo-50 hover:to-white hover:border-indigo-100 hover:shadow-md transition-all group">
                            <span class="text-sm font-bold text-gray-700 group-hover:text-indigo-700">Sales & Bookings</span>
                            <svg class="w-5 h-5 text-gray-400 group-hover:text-indigo-500 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path></svg>
                        </a>
                        <a href="<?php echo e(route('reports.standard', ['preset' => 'inventory'])); ?>" class="flex items-center justify-between p-4 rounded-2xl border border-gray-100 bg-gradient-to-r from-gray-50 to-white hover:from-emerald-50 hover:to-white hover:border-emerald-100 hover:shadow-md transition-all group">
                            <span class="text-sm font-bold text-gray-700 group-hover:text-emerald-700">Active Rentals</span>
                            <svg class="w-5 h-5 text-gray-400 group-hover:text-emerald-500 transition-colors" 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>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Enhanced Chart.js configuration -->
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const ctx = document.getElementById('revenueChart');
            if(ctx) {
                // Create gradient for the line
                let gradientFill = ctx.getContext('2d').createLinearGradient(0, 0, 0, 400);
                gradientFill.addColorStop(0, 'rgba(34, 197, 94, 0.2)'); // primary-500 with opacity
                gradientFill.addColorStop(1, 'rgba(34, 197, 94, 0)');

                new Chart(ctx, {
                    type: 'line',
                    data: {
                        labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
                        datasets: [{
                            data: <?php echo json_encode(array_values($chartData)); ?>,
                            borderColor: '#16a34a', // primary-600
                            borderWidth: 3,
                            backgroundColor: gradientFill,
                            pointBackgroundColor: '#ffffff',
                            pointBorderColor: '#16a34a',
                            pointBorderWidth: 2,
                            pointRadius: 5,
                            pointHoverRadius: 7,
                            pointHoverBackgroundColor: '#16a34a',
                            pointHoverBorderColor: '#ffffff',
                            pointHoverBorderWidth: 2,
                            tension: 0.4, // Smoother curves
                            fill: true
                        }]
                    },
                    options: {
                        responsive: true,
                        maintainAspectRatio: false,
                        plugins: {
                            legend: { display: false },
                            tooltip: {
                                backgroundColor: '#111827', // slate-900
                                titleFont: { family: "'Inter', sans-serif", size: 13, weight: 'bold' },
                                bodyFont: { family: "'Inter', sans-serif", size: 14, weight: 'bold' },
                                padding: 14,
                                cornerRadius: 10,
                                displayColors: false,
                                callbacks: {
                                    label: function(context) {
                                        return 'Rs ' + context.parsed.y.toLocaleString();
                                    }
                                }
                            }
                        },
                        scales: {
                            y: {
                                beginAtZero: true,
                                border: { display: false },
                                grid: { color: '#f3f4f6', drawTicks: false, borderDash: [5, 5] },
                                ticks: {
                                    color: '#6b7280',
                                    font: { family: "'Inter', sans-serif", size: 12, weight: '500' },
                                    padding: 12,
                                    callback: function(value) {
                                        return value >= 1000 ? (value/1000) + 'k' : value;
                                    }
                                }
                            },
                            x: {
                                border: { display: false },
                                grid: { display: false },
                                ticks: {
                                    color: '#6b7280',
                                    font: { family: "'Inter', sans-serif", size: 12, weight: '500' },
                                    padding: 12
                                }
                            }
                        },
                        interaction: {
                            intersect: false,
                            mode: 'index',
                        },
                    }
                });
            }
        });
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal4619374cef299e94fd7263111d0abc69)): ?>
<?php $attributes = $__attributesOriginal4619374cef299e94fd7263111d0abc69; ?>
<?php unset($__attributesOriginal4619374cef299e94fd7263111d0abc69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal4619374cef299e94fd7263111d0abc69)): ?>
<?php $component = $__componentOriginal4619374cef299e94fd7263111d0abc69; ?>
<?php unset($__componentOriginal4619374cef299e94fd7263111d0abc69); ?>
<?php endif; ?>
<?php /**PATH C:\wamp64\www\my-project\resources\views/dashboard/index.blade.php ENDPATH**/ ?>