<div>
    <div class="mb-8">
        <h1 class="text-2xl font-bold text-gray-900">My Vehicles</h1>
        <p class="text-gray-600">View information about your registered vehicles.</p>
    </div>

    @if($vehicles->count() > 0)
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            @foreach($vehicles as $vehicle)
                <div class="bg-white rounded-lg shadow overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center justify-between mb-4">
                            <div class="h-12 w-12 bg-blue-100 rounded-lg flex items-center justify-center">
                                <svg class="h-6 w-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 11.172V5l-1-1z"></path>
                                </svg>
                            </div>
                            <div class="text-right">
                                <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
                                    Active
                                </span>
                            </div>
                        </div>

                        <h3 class="text-lg font-semibold text-gray-900 mb-2">
                            {{ $vehicle->year }} {{ $vehicle->make }} {{ $vehicle->model }}
                        </h3>

                        <div class="space-y-2 text-sm text-gray-600">
                            @if($vehicle->license_plate)
                                <div class="flex justify-between">
                                    <span>License Plate:</span>
                                    <span class="font-medium">{{ $vehicle->license_plate }}</span>
                                </div>
                            @endif
                            
                            @if($vehicle->vin)
                                <div class="flex justify-between">
                                    <span>VIN:</span>
                                    <span class="font-medium font-mono text-xs">{{ Str::limit($vehicle->vin, 10) }}...</span>
                                </div>
                            @endif
                            
                            @if($vehicle->color)
                                <div class="flex justify-between">
                                    <span>Color:</span>
                                    <span class="font-medium">{{ ucfirst($vehicle->color) }}</span>
                                </div>
                            @endif
                            
                            @if($vehicle->mileage)
                                <div class="flex justify-between">
                                    <span>Mileage:</span>
                                    <span class="font-medium">{{ number_format($vehicle->mileage) }} miles</span>
                                </div>
                            @endif
                        </div>

                        <div class="mt-6 pt-4 border-t border-gray-200">
                            <div class="flex justify-between text-sm">
                                <div class="text-center">
                                    <div class="font-semibold text-gray-900">{{ $vehicle->job_cards_count }}</div>
                                    <div class="text-gray-500">Service Records</div>
                                </div>
                                <div class="text-center">
                                    <div class="font-semibold text-gray-900">{{ $vehicle->appointments_count }}</div>
                                    <div class="text-gray-500">Appointments</div>
                                </div>
                            </div>
                        </div>

                        @if($vehicle->notes)
                            <div class="mt-4 p-3 bg-gray-50 rounded-md">
                                <p class="text-sm text-gray-700">{{ Str::limit($vehicle->notes, 100) }}</p>
                            </div>
                        @endif
                    </div>
                </div>
            @endforeach
        </div>
    @else
        <div class="bg-white rounded-lg shadow">
            <div class="text-center py-12">
                <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 11.172V5l-1-1z"></path>
                </svg>
                <h3 class="mt-2 text-sm font-medium text-gray-900">No vehicles registered</h3>
                <p class="mt-1 text-sm text-gray-500">Contact us to add your vehicles to your account.</p>
            </div>
        </div>
    @endif
</div>
