<div class="space-y-6">
    <!-- Enhanced Header -->
    <div class="bg-gradient-to-r from-indigo-50 to-blue-50 dark:from-gray-800 dark:to-gray-900 border border-zinc-200 dark:border-zinc-700 rounded-lg border border-zinc-200 dark:border-zinc-700">
        <div class="px-8 py-6 space-y-6">
            <!-- Title and Action Section -->
            <div class="flex flex-col xl:flex-row xl:items-center xl:justify-between space-y-4 xl:space-y-0">
                <div class="space-y-1">
                    <div class="flex items-center space-x-3">
                        <div class="p-2 bg-indigo-100 dark:bg-indigo-900/50 rounded-lg">
                            <svg class="w-6 h-6 text-indigo-600 dark:text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
                            </svg>
                        </div>
                        <div>
                            <h1 class="text-3xl font-bold text-zinc-900 dark:text-white dark:text-white">Appointment Management</h1>
                            <p class="text-zinc-600 dark:text-zinc-400 dark:text-gray-400">Schedule, track, and manage customer appointments</p>
                        </div>
                    </div>
                </div>
                
                <div class="flex flex-col sm:flex-row gap-3">
                    <!-- Quick Actions -->
                    <div class="flex space-x-2">
                        <button wire:click="createAppointment" class="inline-flex items-center px-4 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-semibold rounded-lg border border-zinc-200 dark:border-zinc-700 hover:shadow-xl transition-all duration-200 transform hover:scale-105">
                            <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
                            </svg>
                            New Appointment
                        </button>
                        
                        <button class="inline-flex items-center px-4 py-2.5 bg-white dark:bg-zinc-800 hover:bg-zinc-50 dark:hover:bg-zinc-700 text-gray-700 dark:text-gray-300 text-sm font-medium rounded-lg border border-zinc-300 dark:border-zinc-600 dark:border-gray-600 border border-zinc-200 dark:border-zinc-700 hover:shadow-md transition-all duration-200">
                            <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path>
                            </svg>
                            Export
                        </button>
                    </div>
                </div>
            </div>

            <!-- Enhanced Stats Cards -->
            <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
                <div class="bg-white dark:bg-zinc-800/50 backdrop-blur-sm border border-zinc-200 dark:border-zinc-700 rounded-lg p-6 hover:border border-zinc-200 dark:border-zinc-700 transition-all duration-200 hover:scale-105">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-zinc-600 dark:text-zinc-400 dark:text-gray-400">Today's Total</p>
                            <p class="text-3xl font-bold text-zinc-900 dark:text-white dark:text-white">{{ $todayStats['total'] }}</p>
                            <p class="text-xs text-zinc-500 dark:text-zinc-400 dark:text-zinc-500 dark:text-zinc-400 mt-1">Scheduled appointments</p>
                        </div>
                        <div class="p-3 bg-blue-100 dark:bg-blue-900/50 rounded-lg">
                            <svg class="w-6 h-6 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
                            </svg>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white dark:bg-zinc-800/50 backdrop-blur-sm border border-zinc-200 dark:border-zinc-700 rounded-lg p-6 hover:border border-zinc-200 dark:border-zinc-700 transition-all duration-200 hover:scale-105">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-zinc-600 dark:text-zinc-400 dark:text-gray-400">Confirmed</p>
                            <p class="text-3xl font-bold text-green-600 dark:text-green-400">{{ $todayStats['confirmed'] }}</p>
                            <p class="text-xs text-zinc-500 dark:text-zinc-400 dark:text-zinc-500 dark:text-zinc-400 mt-1">Ready to serve</p>
                        </div>
                        <div class="p-3 bg-green-100 dark:bg-green-900/50 rounded-lg">
                            <svg class="w-6 h-6 text-green-600 dark:text-green-400" 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>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white dark:bg-zinc-800/50 backdrop-blur-sm border border-zinc-200 dark:border-zinc-700 rounded-lg p-6 hover:border border-zinc-200 dark:border-zinc-700 transition-all duration-200 hover:scale-105">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-zinc-600 dark:text-zinc-400 dark:text-gray-400">In Progress</p>
                            <p class="text-3xl font-bold text-yellow-600 dark:text-yellow-400">{{ $todayStats['in_progress'] }}</p>
                            <p class="text-xs text-zinc-500 dark:text-zinc-400 dark:text-zinc-500 dark:text-zinc-400 mt-1">Currently working</p>
                        </div>
                        <div class="p-3 bg-yellow-100 dark:bg-yellow-900/50 rounded-lg">
                            <svg class="w-6 h-6 text-yellow-600 dark:text-yellow-400" 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>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white dark:bg-zinc-800/50 backdrop-blur-sm border border-zinc-200 dark:border-zinc-700 rounded-lg p-6 hover:border border-zinc-200 dark:border-zinc-700 transition-all duration-200 hover:scale-105">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-zinc-600 dark:text-zinc-400 dark:text-gray-400">Completed</p>
                            <p class="text-3xl font-bold text-emerald-600 dark:text-emerald-400">{{ $todayStats['completed'] }}</p>
                            <p class="text-xs text-zinc-500 dark:text-zinc-400 dark:text-zinc-500 dark:text-zinc-400 mt-1">Successfully finished</p>
                        </div>
                        <div class="p-3 bg-emerald-100 dark:bg-emerald-900/50 rounded-lg">
                            <svg class="w-6 h-6 text-emerald-600 dark:text-emerald-400" 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>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Enhanced Filters Section -->
            <div class="bg-white dark:bg-zinc-800/30 rounded-lg p-6 border border-zinc-200 dark:border-zinc-700">
                <div class="flex flex-col lg:flex-row gap-4">
                    <!-- Search Bar -->
                    <div class="flex-1">
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Search Appointments</label>
                        <div class="relative">
                            <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                <svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
                                </svg>
                            </div>
                            <input wire:model.live="search" 
                                   type="text" 
                                   placeholder="Search by customer, vehicle, or service..." 
                                   class="block w-full pl-10 pr-4 py-3 border border-zinc-300 dark:border-zinc-600 dark:border-gray-600 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent border border-zinc-200 dark:border-zinc-700 hover:shadow-md transition-all duration-200" />
                        </div>
                    </div>
                    
                    <!-- Filter Controls -->
                    <div class="grid grid-cols-2 lg:grid-cols-4 gap-3 lg:w-auto">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Status</label>
                            <select wire:model.live="statusFilter" class="block w-full rounded-lg border-zinc-300 dark:border-zinc-600 dark:border-gray-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white dark:text-white border border-zinc-200 dark:border-zinc-700 focus:border-indigo-500 focus:ring-indigo-500 hover:shadow-md transition-all duration-200">
                                <option value="">All Statuses</option>
                                <option value="scheduled">Scheduled</option>
                                <option value="confirmed">Confirmed</option>
                                <option value="in_progress">In Progress</option>
                                <option value="completed">Completed</option>
                                <option value="cancelled">Cancelled</option>
                                <option value="no_show">No Show</option>
                            </select>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Type</label>
                            <select wire:model.live="typeFilter" class="block w-full rounded-lg border-zinc-300 dark:border-zinc-600 dark:border-gray-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white dark:text-white border border-zinc-200 dark:border-zinc-700 focus:border-indigo-500 focus:ring-indigo-500 hover:shadow-md transition-all duration-200">
                                <option value="">All Types</option>
                                <option value="maintenance">Maintenance</option>
                                <option value="repair">Repair</option>
                                <option value="inspection">Inspection</option>
                                <option value="estimate">Estimate</option>
                                <option value="pickup">Pickup</option>
                                <option value="delivery">Delivery</option>
                            </select>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Technician</label>
                            <select wire:model.live="technicianFilter" class="block w-full rounded-lg border-zinc-300 dark:border-zinc-600 dark:border-gray-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white dark:text-white border border-zinc-200 dark:border-zinc-700 focus:border-indigo-500 focus:ring-indigo-500 hover:shadow-md transition-all duration-200">
                                <option value="">All Technicians</option>
                                @foreach($technicians as $technician)
                                    <option value="{{ $technician->id }}">{{ $technician->full_name }}</option>
                                @endforeach
                            </select>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Date Range</label>
                            <select wire:model.live="dateFilter" class="block w-full rounded-lg border-zinc-300 dark:border-zinc-600 dark:border-gray-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white dark:text-white border border-zinc-200 dark:border-zinc-700 focus:border-indigo-500 focus:ring-indigo-500 hover:shadow-md transition-all duration-200">
                                <option value="">All Dates</option>
                                <option value="today">Today</option>
                                <option value="tomorrow">Tomorrow</option>
                                <option value="this_week">This Week</option>
                                <option value="next_week">Next Week</option>
                                <option value="overdue">Overdue</option>
                            </select>
                        </div>
                    </div>
                </div>
                
                <!-- Filter Summary and Reset -->
                <div class="flex items-center justify-between mt-4 pt-4 border-t border-zinc-200 dark:border-zinc-700">
                    <div class="text-sm text-zinc-600 dark:text-zinc-400 dark:text-gray-400">
                        @php
                            $activeFilters = collect([$search, $statusFilter, $typeFilter, $technicianFilter, $dateFilter])->filter()->count();
                        @endphp
                        @if($activeFilters > 0)
                            {{ $activeFilters }} filter{{ $activeFilters !== 1 ? 's' : '' }} active
                        @else
                            No filters applied
                        @endif
                    </div>
                    @if($activeFilters > 0)
                        <button wire:click="clearFilters" class="text-sm text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300 font-medium">
                            Clear all filters
                        </button>
                    @endif
                </div>
            </div>
        </div>
    </div>

    <!-- Enhanced Appointments Table -->
    <div class="bg-white dark:bg-zinc-800 shadow-xl rounded-lg border border-zinc-200 dark:border-zinc-700 overflow-hidden">
        @if($appointments->count() > 0)
            <!-- Table Header with Results Count -->
            <div class="px-6 py-4 bg-zinc-50 dark:bg-zinc-700/50 border-b border-zinc-200 dark:border-zinc-700">
                <div class="flex items-center justify-between">
                    <div class="flex items-center space-x-2">
                        <h3 class="text-lg font-semibold text-zinc-900 dark:text-white dark:text-white">Appointments</h3>
                        <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200">
                            {{ $appointments->total() }} total
                        </span>
                    </div>
                    <div class="flex items-center space-x-2 text-sm text-zinc-500 dark:text-zinc-400 dark:text-gray-400">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                        </svg>
                        <span>Showing {{ $appointments->firstItem() }}-{{ $appointments->lastItem() }} of {{ $appointments->total() }}</span>
                    </div>
                </div>
            </div>

            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-zinc-200 dark:divide-zinc-700">
                    <thead class="bg-zinc-50 dark:bg-zinc-700">
                        <tr>
                            <th class="group px-6 py-4 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 dark:text-gray-400 uppercase tracking-wider cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-600 transition-colors">
                                <div class="flex items-center space-x-1">
                                    <span>Date & Time</span>
                                    <svg class="w-4 h-4 opacity-0 group-hover:opacity-100" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"></path>
                                    </svg>
                                </div>
                            </th>
                            <th class="px-6 py-4 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 dark:text-gray-400 uppercase tracking-wider">
                                Customer & Vehicle
                            </th>
                            <th class="px-6 py-4 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 dark:text-gray-400 uppercase tracking-wider">
                                Service Details
                            </th>
                            <th class="px-6 py-4 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 dark:text-gray-400 uppercase tracking-wider">
                                Technician
                            </th>
                            <th class="px-6 py-4 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 dark:text-gray-400 uppercase tracking-wider">
                                Status
                            </th>
                            <th class="px-6 py-4 text-right text-xs font-semibold text-zinc-500 dark:text-zinc-400 dark:text-gray-400 uppercase tracking-wider">
                                Actions
                            </th>
                        </tr>
                    </thead>
                    <tbody class="bg-white dark:bg-zinc-800 divide-y divide-zinc-200 dark:divide-zinc-700">
                        @foreach($appointments as $appointment)
                            <tr class="hover:bg-zinc-50 dark:hover:bg-zinc-700/50 transition-all duration-200 {{ $appointment->isOverdue() ? 'bg-red-50 dark:bg-red-900/20 border-l-4 border-red-400' : '' }}">
                                <td class="px-6 py-5 whitespace-nowrap">
                                    <div class="flex items-center">
                                        <div class="flex-shrink-0">
                                            <div class="w-10 h-10 rounded-lg {{ $appointment->isOverdue() ? 'bg-red-100 dark:bg-red-900/50' : 'bg-indigo-100 dark:bg-indigo-900/50' }} flex items-center justify-center">
                                                <svg class="w-5 h-5 {{ $appointment->isOverdue() ? 'text-red-600 dark:text-red-400' : 'text-indigo-600 dark:text-indigo-400' }}" 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>
                                            </div>
                                        </div>
                                        <div class="ml-4">
                                            <div class="text-sm font-semibold text-zinc-900 dark:text-white dark:text-white">
                                                {{ $appointment->formatted_date }}
                                            </div>
                                            <div class="text-sm text-zinc-500 dark:text-zinc-400 dark:text-gray-400">
                                                {{ $appointment->formatted_time }} - {{ $appointment->formatted_end_time }}
                                                <span class="ml-1 text-xs">({{ $appointment->getDurationInHours() }}h)</span>
                                            </div>
                                            @if($appointment->isOverdue())
                                                <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200 mt-1">
                                                    <svg class="w-3 h-3 mr-1" 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-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L2.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
                                                    </svg>
                                                    Overdue
                                                </span>
                                            @endif
                                        </div>
                                    </div>
                                </td>
                                <td class="px-6 py-5">
                                    <div class="flex items-center">
                                        <div class="flex-shrink-0">
                                            <div class="w-10 h-10 rounded-full bg-gray-200 dark:bg-zinc-600 flex items-center justify-center">
                                                <svg class="w-5 h-5 text-zinc-500 dark:text-zinc-400 dark:text-gray-400" 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>
                                            </div>
                                        </div>
                                        <div class="ml-4">
                                            <div class="text-sm font-semibold text-zinc-900 dark:text-white dark:text-white">
                                                {{ $appointment->customer->full_name }}
                                            </div>
                                            <div class="text-sm text-zinc-500 dark:text-zinc-400 dark:text-gray-400">
                                                {{ $appointment->vehicle->year }} {{ $appointment->vehicle->make }} {{ $appointment->vehicle->model }}
                                            </div>
                                            <div class="text-xs text-gray-400 dark:text-zinc-500 dark:text-zinc-400 font-mono">
                                                {{ $appointment->vehicle->license_plate }}
                                            </div>
                                        </div>
                                    </div>
                                </td>
                                <td class="px-6 py-5">
                                    <div class="space-y-2">
                                        <div class="flex items-center space-x-2">
                                            <span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold 
                                                {{ $appointment->type_color === 'blue' ? 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200' : '' }}
                                                {{ $appointment->type_color === 'green' ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' : '' }}
                                                {{ $appointment->type_color === 'yellow' ? 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200' : '' }}
                                                {{ $appointment->type_color === 'red' ? 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200' : '' }}
                                                {{ $appointment->type_color === 'purple' ? 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200' : '' }}
                                                {{ $appointment->type_color === 'gray' ? 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200' : '' }}">
                                                {{ ucfirst(str_replace('_', ' ', $appointment->appointment_type)) }}
                                            </span>
                                        </div>
                                        <div class="text-sm text-zinc-600 dark:text-zinc-400 dark:text-gray-400">
                                            {{ Str::limit($appointment->service_requested, 60) }}
                                        </div>
                                    </div>
                                </td>
                                <td class="px-6 py-5 whitespace-nowrap">
                                    @if($appointment->assignedTechnician)
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0">
                                                <div class="w-8 h-8 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center">
                                                    <svg class="w-4 h-4 text-green-600 dark:text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                                                    </svg>
                                                </div>
                                            </div>
                                            <div class="ml-3">
                                                <div class="text-sm font-medium text-zinc-900 dark:text-white dark:text-white">
                                                    {{ $appointment->assignedTechnician->full_name }}
                                                </div>
                                            </div>
                                        </div>
                                    @else
                                        <div class="flex items-center text-gray-400 dark:text-zinc-500 dark:text-zinc-400">
                                            <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"></path>
                                            </svg>
                                            <span class="text-sm">Unassigned</span>
                                        </div>
                                    @endif
                                </td>
                                <td class="px-6 py-5 whitespace-nowrap">
                                    <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-semibold 
                                        {{ $appointment->status_color === 'blue' ? 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200' : '' }}
                                        {{ $appointment->status_color === 'green' ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' : '' }}
                                        {{ $appointment->status_color === 'yellow' ? 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200' : '' }}
                                        {{ $appointment->status_color === 'red' ? 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200' : '' }}
                                        {{ $appointment->status_color === 'purple' ? 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200' : '' }}
                                        {{ $appointment->status_color === 'gray' ? 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200' : '' }}">
                                        @if($appointment->status === 'scheduled')
                                            <svg class="w-3 h-3 mr-1" 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>
                                        @elseif($appointment->status === 'confirmed')
                                            <svg class="w-3 h-3 mr-1" 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>
                                        @elseif($appointment->status === 'in_progress')
                                            <svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 24 24">
                                                <circle cx="12" cy="12" r="10"/>
                                                <circle cx="12" cy="12" r="3"/>
                                            </svg>
                                        @elseif($appointment->status === 'completed')
                                            <svg class="w-3 h-3 mr-1" 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>
                                        @endif
                                        {{ ucfirst(str_replace('_', ' ', $appointment->status)) }}
                                    </span>
                                </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                        <div class="flex space-x-2">
                                            @if($appointment->status === 'scheduled')
                                                <button wire:click="confirmAppointment({{ $appointment->id }})" 
                                                        title="Confirm"
                                                        class="text-gray-400 hover:text-green-600 transition-colors duration-200">
                                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
                                                    </svg>
                                                </button>
                                            @endif
                                            
                                            @if($appointment->canBeCheckedIn())
                                                <button wire:click="checkInAppointment({{ $appointment->id }})" 
                                                        title="Check In"
                                                        class="text-gray-400 hover:text-blue-600 transition-colors duration-200">
                                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"></path>
                                                    </svg>
                                                </button>
                                            @endif
                                            
                                            @if($appointment->canBeCompleted())
                                                <button wire:click="completeAppointment({{ $appointment->id }})" 
                                                        title="Complete"
                                                        class="text-gray-400 hover:text-green-600 transition-colors duration-200">
                                                    <svg class="w-4 h-4" 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>
                                                </button>
                                            @endif
                                            
                                            @if($appointment->canBeModified())
                                                <button wire:click="editAppointment({{ $appointment->id }})" 
                                                        title="Edit"
                                                        class="text-gray-400 hover:text-indigo-600 transition-colors duration-200">
                                                    <svg class="w-4 h-4" 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-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
                                                    </svg>
                                                </button>
                                                <button wire:click="cancelAppointment({{ $appointment->id }})" 
                                                        wire:confirm="Are you sure you want to cancel this appointment?"
                                                        title="Cancel"
                                                        class="text-gray-400 hover:text-red-600 transition-colors duration-200">
                                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
                                                    </svg>
                                                </button>
                                            @endif
                                            
                                            @if($appointment->isOverdue() && $appointment->status === 'scheduled')
                                                <button wire:click="markNoShow({{ $appointment->id }})" 
                                                        wire:confirm="Mark this appointment as no-show?"
                                                        title="No Show"
                                                        class="text-gray-400 hover:text-orange-600 transition-colors duration-200">
                                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7a4 4 0 11-8 0 4 4 0 018 0zM9 14a6 6 0 00-6 6v1h12v-1a6 6 0 00-6-6z"></path>
                                                    </svg>
                                                </button>
                                            @endif
                                        </div>
                                    </td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>

                <!-- Pagination -->
                <div class="px-6 py-4 border-t border-zinc-200 dark:border-zinc-700">
                    {{ $appointments->links() }}
                </div>
            @else
                <div class="text-center py-12">
                    <svg class="w-12 h-12 text-gray-400 dark:text-zinc-500 dark:text-zinc-400 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
                    </svg>
                    <h3 class="text-lg font-medium text-zinc-600 dark:text-zinc-400 dark:text-gray-400 mb-2">No appointments found</h3>
                    <p class="text-zinc-500 dark:text-zinc-400 dark:text-zinc-500 dark:text-zinc-400 mb-4">
                        @if($search || $statusFilter || $technicianFilter || $dateFilter || $typeFilter)
                            Try adjusting your filters to see more results.
                        @else
                            Get started by scheduling your first appointment.
                        @endif
                    </p>
                    <button wire:click="createAppointment" class="inline-flex items-center px-4 py-2 border border-transparent rounded-md border border-zinc-200 dark:border-zinc-700 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition-colors duration-200">
                        <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
                        </svg>
                        Schedule Appointment
                    </button>
                </div>
            @endif
        </div>

    <!-- Appointment Form Modal -->
    @if($showForm)
        <livewire:appointments.form :appointment="$selectedAppointment" />
    @endif
</div>
