<div class="space-y-6">
    <!-- Stats Cards -->
    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4">
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700 p-4">
            <div class="text-center">
                <div class="text-2xl font-bold text-blue-600">{{ number_format($stats['total_customers']) }}</div>
                <div class="text-sm text-zinc-600 dark:text-zinc-400">Active Customers</div>
            </div>
        </div>
        
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700 p-4">
            <div class="text-center">
                <div class="text-2xl font-bold text-green-600">{{ number_format($stats['total_vehicles']) }}</div>
                <div class="text-sm text-zinc-600 dark:text-zinc-400">Vehicles</div>
            </div>
        </div>
        
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700 p-4">
            <div class="text-center">
                <div class="text-2xl font-bold text-orange-600">{{ number_format($stats['pending_orders']) }}</div>
                <div class="text-sm text-zinc-600 dark:text-zinc-400">Pending Orders</div>
            </div>
        </div>
        
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700 p-4">
            <div class="text-center">
                <div class="text-2xl font-bold text-purple-600">{{ number_format($stats['today_appointments']) }}</div>
                <div class="text-sm text-zinc-600 dark:text-zinc-400">Today's Appointments</div>
            </div>
        </div>
        
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700 p-4">
            <div class="text-center">
                <div class="text-2xl font-bold text-emerald-600">${{ number_format($stats['monthly_revenue'], 2) }}</div>
                <div class="text-sm text-zinc-600 dark:text-zinc-400">Monthly Revenue</div>
            </div>
        </div>
        
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700 p-4">
            <div class="text-center">
                <div class="text-2xl font-bold text-indigo-600">{{ number_format($stats['orders_this_week']) }}</div>
                <div class="text-sm text-zinc-600 dark:text-zinc-400">Orders This Week</div>
            </div>
        </div>
    </div>

    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
        <!-- Today's Appointments -->
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700">
            <div class="border-b border-zinc-200 dark:border-zinc-700 p-4">
                <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Today's Appointments</h3>
            </div>
            
            <div class="p-4 space-y-3">
                @forelse($todayAppointments as $appointment)
                    <div class="flex items-center justify-between p-3 bg-zinc-50 dark:bg-zinc-700 rounded-lg">
                        <div>
                            <div class="font-medium">{{ $appointment->customer->full_name }}</div>
                            <div class="text-sm text-zinc-600 dark:text-zinc-400">{{ $appointment->vehicle->display_name }}</div>
                            <div class="text-xs text-zinc-500 dark:text-zinc-400">{{ $appointment->service_requested }}</div>
                        </div>
                        <div class="text-right">
                            <div class="text-sm font-medium">{{ $appointment->scheduled_datetime->format('g:i A') }}</div>
                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full 
                                {{ $appointment->status === 'confirmed' ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' : 'bg-zinc-100 text-zinc-800 dark:bg-zinc-700 dark:text-zinc-200' }}">
                                {{ ucfirst($appointment->status) }}
                            </span>
                        </div>
                    </div>
                @empty
                    <div class="text-center py-4 text-zinc-500 dark:text-zinc-400">No appointments scheduled for today</div>
                @endforelse
            </div>
        </div>

        <!-- Pending Orders -->
        <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700">
            <div class="border-b border-zinc-200 dark:border-zinc-700 p-4">
                <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Pending Orders</h3>
            </div>
            
            <div class="p-4 space-y-3">
                @forelse($pendingOrders as $order)
                    <div class="flex items-center justify-between p-3 bg-zinc-50 dark:bg-zinc-700 rounded-lg">
                        <div>
                            <div class="font-medium">{{ $order->order_number }}</div>
                            <div class="text-sm text-zinc-600 dark:text-zinc-400">{{ $order->customer->full_name }}</div>
                            <div class="text-xs text-zinc-500 dark:text-zinc-400">{{ $order->vehicle->display_name }}</div>
                        </div>
                        <div class="text-right">
                            <div class="text-sm font-medium">${{ number_format($order->total_amount, 2) }}</div>
                            <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full 
                                {{ $order->status === 'pending' ? 'bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200' : 'bg-zinc-100 text-zinc-800 dark:bg-zinc-700 dark:text-zinc-200' }}">
                                {{ ucfirst(str_replace('_', ' ', $order->status)) }}
                            </span>
                        </div>
                    </div>
                @empty
                    <div class="text-center py-4 text-zinc-500 dark:text-zinc-400">No pending orders</div>
                @endforelse
            </div>
        </div>
    </div>

    <!-- Recent Service Orders -->
    <div class="bg-white dark:bg-zinc-800 rounded-lg border border-zinc-200 dark:border-zinc-700">
        <div class="border-b border-zinc-200 dark:border-zinc-700 p-4">
            <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Recent Service Orders</h3>
        </div>
        
        <div class="overflow-x-auto">
            <table class="min-w-full">
                <thead>
                    <tr class="border-b border-zinc-200 dark:border-zinc-700">
                        <th class="text-left py-2 px-4">Order #</th>
                        <th class="text-left py-2 px-4">Customer</th>
                        <th class="text-left py-2 px-4">Vehicle</th>
                        <th class="text-left py-2 px-4">Technician</th>
                        <th class="text-left py-2 px-4">Status</th>
                        <th class="text-left py-2 px-4">Total</th>
                        <th class="text-left py-2 px-4">Date</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse($recentServiceOrders as $order)
                        <tr class="border-b border-zinc-200 dark:border-zinc-700">
                            <td class="py-2 px-4 font-medium">{{ $order->order_number }}</td>
                            <td class="py-2 px-4">{{ $order->customer->full_name }}</td>
                            <td class="py-2 px-4">{{ $order->vehicle->display_name }}</td>
                            <td class="py-2 px-4">{{ $order->assignedTechnician?->first_name }} {{ $order->assignedTechnician?->last_name }}</td>
                            <td class="py-2 px-4">
                                <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full 
                                    {{ $order->status === 'completed' ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' : 
                                       ($order->status === 'in_progress' ? 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200' : 
                                        'bg-zinc-100 text-zinc-800 dark:bg-zinc-700 dark:text-zinc-200') }}">
                                    {{ ucfirst(str_replace('_', ' ', $order->status)) }}
                                </span>
                            </td>
                            <td class="py-2 px-4">${{ number_format($order->total_amount, 2) }}</td>
                            <td class="py-2 px-4">{{ $order->created_at->format('M j, Y') }}</td>
                        </tr>
                    @empty
                        <tr>
                            <td colspan="7" class="text-center py-4 text-zinc-500 dark:text-zinc-400">No service orders yet</td>
                        </tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
</div>
