<x-layouts.app title="Technicians">
    <div class="space-y-6">
        <div class="flex items-center justify-between">
            <div>
                <h1 class="text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-100">Technicians</h1>
                <p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Manage your technician workforce</p>
            </div>
        </div>
        
        <!-- Quick Actions -->
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            <div class="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl p-6">
                <div class="flex items-center">
                    <div class="flex-shrink-0">
                        <div class="w-8 h-8 bg-blue-100 rounded-md flex items-center justify-center">
                            <svg class="w-5 h-5 text-blue-600" 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" />
                            </svg>
                        </div>
                    </div>
                    <div class="ml-4">
                        <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Technician Management</h3>
                        <p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Full technician profiles and skills tracking</p>
                    </div>
                </div>
                <div class="mt-4">
                    <a href="{{ route('technician.management') }}" class="inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
                        Manage Technicians
                    </a>
                </div>
            </div>
            
            <div class="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl p-6">
                <div class="flex items-center">
                    <div class="flex-shrink-0">
                        <div class="w-8 h-8 bg-green-100 rounded-md flex items-center justify-center">
                            <svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14l9-5-9-5-9 5 9 5z" />
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z" />
                            </svg>
                        </div>
                    </div>
                    <div class="ml-4">
                        <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Skills & Certifications</h3>
                        <p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Track skills and certification status</p>
                    </div>
                </div>
                <div class="mt-4">
                    <a href="{{ route('technician.skills') }}" class="inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors">
                        View Skills
                    </a>
                </div>
            </div>
            
            <div class="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl p-6">
                <div class="flex items-center">
                    <div class="flex-shrink-0">
                        <div class="w-8 h-8 bg-purple-100 rounded-md flex items-center justify-center">
                            <svg class="w-5 h-5 text-purple-600" 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" />
                            </svg>
                        </div>
                    </div>
                    <div class="ml-4">
                        <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Performance Reports</h3>
                        <p class="mt-1 text-sm text-zinc-600 dark:text-zinc-400">View performance metrics and analytics</p>
                    </div>
                </div>
                <div class="mt-4">
                    <a href="{{ route('technician.reports') }}" class="inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-purple-600 hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-colors">
                        View Reports
                    </a>
                </div>
            </div>
        </div>
        
        <!-- Quick Stats -->
        <div class="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl p-6">
            <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-4">Quick Overview</h3>
            <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
                <div class="text-center p-4 border rounded-lg">
                    <div class="text-2xl font-bold text-blue-600">{{ \App\Models\Technician::count() }}</div>
                    <div class="text-sm text-zinc-500">Total Technicians</div>
                </div>
                <div class="text-center p-4 border rounded-lg">
                    <div class="text-2xl font-bold text-green-600">{{ \App\Models\Technician::where('status', 'active')->count() }}</div>
                    <div class="text-sm text-zinc-500">Active</div>
                </div>
                <div class="text-center p-4 border rounded-lg">
                    <div class="text-2xl font-bold text-orange-600">{{ \App\Models\Technician::where('status', 'on_leave')->count() }}</div>
                    <div class="text-sm text-zinc-500">On Leave</div>
                </div>
                <div class="text-center p-4 border rounded-lg">
                    <div class="text-2xl font-bold text-purple-600">{{ \App\Models\TechnicianSkill::distinct('technician_id')->count() }}</div>
                    <div class="text-sm text-zinc-500">With Skills</div>
                </div>
            </div>
        </div>
        
        <!-- Recent Activity -->
        <div class="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl p-6">
            <h3 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-4">Recent Activity</h3>
            <div class="space-y-4">
                @if(\App\Models\Technician::exists())
                    @foreach(\App\Models\Technician::with(['skills', 'performances'])->latest()->take(5)->get() as $technician)
                        <div class="flex items-center space-x-4 p-3 border rounded-lg">
                            <div class="w-10 h-10 bg-zinc-100 rounded-full flex items-center justify-center">
                                <span class="text-sm font-medium text-zinc-600">
                                    {{ strtoupper(substr($technician->first_name, 0, 1) . substr($technician->last_name, 0, 1)) }}
                                </span>
                            </div>
                            <div class="flex-1">
                                <div class="font-medium">{{ $technician->full_name }}</div>
                                <div class="text-sm text-zinc-500">
                                    {{ $technician->employee_id }} • {{ ucfirst($technician->status) }}
                                    @if($technician->skills->count() > 0)
                                        • {{ $technician->skills->count() }} skills
                                    @endif
                                </div>
                            </div>
                            <div class="text-sm text-zinc-400">
                                {{ $technician->created_at->diffForHumans() }}
                            </div>
                        </div>
                    @endforeach
                @else
                    <div class="text-center py-8 text-zinc-500">
                        <p>No technicians found. Start by adding your first technician.</p>
                        <div class="mt-4">
                            <a href="{{ route('technician.management') }}" class="inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
                                Add Technician
                            </a>
                        </div>
                    </div>
                @endif
            </div>
        </div>
    </div>
</x-layouts.app>
