@extends('layouts.site')

@section('meta')
    <meta name="description" content="Certificate Verification - {{ $certificate->certificate_number }}">
@endsection

@section('content')
{{-- Hero Section --}}
<div class="bg-gradient-to-r from-green-600 to-green-700 shadow-lg">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div class="flex items-center gap-6">
            <div class="hidden md:flex w-20 h-20 rounded-xl shadow-lg bg-white/20 items-center justify-center flex-shrink-0">
                <i class="fas fa-certificate text-white text-3xl"></i>
            </div>
            <div>
                <h1 class="text-3xl md:text-4xl font-serif font-bold text-white">Certificate Verification</h1>
                <p class="text-green-100 mt-2">This certificate has been verified as authentic.</p>
            </div>
        </div>
    </div>
</div>

{{-- Breadcrumb --}}
<div class="bg-gray-50 border-b border-gray-200">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3">
        <nav class="flex items-center space-x-2 text-sm text-gray-600" aria-label="Breadcrumb">
            <a href="{{ url('/') }}" class="hover:text-green-600 transition flex items-center">
                <i class="fas fa-home mr-1"></i>Home
            </a>
            <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
            <a href="{{ route('public.training.index') }}" class="hover:text-green-600 transition">Training Programs</a>
            <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
            <span class="text-gray-900 font-medium">Certificate Verified</span>
        </nav>
    </div>
</div>

<section class="py-12 bg-gray-50">
    <div class="container max-w-4xl mx-auto px-4">
        <div class="max-w-4xl mx-auto">
            {{-- Verification Success --}}
            <div class="bg-white rounded-2xl shadow-lg overflow-hidden mb-8">
                {{-- Status Bar --}}
                <div class="bg-green-500 text-white p-4 flex items-center justify-center gap-3">
                    <i class="fas fa-check-circle text-2xl"></i>
                    <span class="font-semibold text-lg">Valid Certificate</span>
                </div>

                {{-- Certificate Preview --}}
                <div class="p-8">
                    <div class="bg-gradient-to-br from-green-50 to-green-100 rounded-xl p-8 border-4 border-green-600 text-center">
                        {{-- Header --}}
                        <div class="mb-6">
                            <i class="fas fa-award text-green-600 text-5xl mb-3"></i>
                            <h2 class="text-2xl font-bold text-gray-800">Certificate of Completion</h2>
                        </div>

                        {{-- Recipient --}}
                        <div class="mb-6">
                            <p class="text-sm text-gray-500 uppercase tracking-wide">This is to certify that</p>
                            <h3 class="text-3xl font-bold text-green-700 my-2">{{ $certificate->user->name }}</h3>
                            <p class="text-sm text-gray-500">has successfully completed</p>
                        </div>

                        {{-- Training --}}
                        <div class="mb-6">
                            <h4 class="text-xl font-semibold text-gray-800">{{ $certificate->trainingPackage->name }}</h4>
                            @if($certificate->trainingPackage->duration_hours)
                                <p class="text-sm text-gray-500 mt-1">{{ $certificate->trainingPackage->duration_hours }} hours of training</p>
                            @endif
                        </div>

                        {{-- Footer Info --}}
                        <div class="flex justify-between pt-4 border-t border-green-200">
                            <div class="text-left">
                                <p class="text-xs text-gray-500">Certificate Number</p>
                                <p class="font-mono font-medium text-gray-800">{{ $certificate->certificate_number }}</p>
                            </div>
                            <div class="text-center">
                                <p class="text-xs text-gray-500">Issue Date</p>
                                <p class="font-medium text-gray-800">{{ $certificate->issue_date->format('M d, Y') }}</p>
                            </div>
                            <div class="text-right">
                                <p class="text-xs text-gray-500">Verification Code</p>
                                <p class="font-mono font-medium text-gray-800">{{ $certificate->verification_code }}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            {{-- Certificate Details --}}
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                {{-- Recipient Info --}}
                <div class="bg-white rounded-xl shadow-sm p-6">
                    <h3 class="font-semibold text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-user text-green-600 mr-2"></i>
                        Recipient Information
                    </h3>
                    <dl class="space-y-3">
                        <div>
                            <dt class="text-xs text-gray-500 uppercase">Full Name</dt>
                            <dd class="text-gray-800 font-medium">{{ $certificate->user->name }}</dd>
                        </div>
                        <div>
                            <dt class="text-xs text-gray-500 uppercase">Certificate Holder</dt>
                            <dd class="text-gray-800">{{ $certificate->user->email }}</dd>
                        </div>
                    </dl>
                </div>

                {{-- Training Info --}}
                <div class="bg-white rounded-xl shadow-sm p-6">
                    <h3 class="font-semibold text-gray-800 mb-4 flex items-center">
                        <i class="fas fa-book text-green-600 mr-2"></i>
                        Training Program
                    </h3>
                    <dl class="space-y-3">
                        <div>
                            <dt class="text-xs text-gray-500 uppercase">Program Name</dt>
                            <dd class="text-gray-800 font-medium">{{ $certificate->trainingPackage->name }}</dd>
                        </div>
                        <div>
                            <dt class="text-xs text-gray-500 uppercase">Duration</dt>
                            <dd class="text-gray-800">{{ $certificate->trainingPackage->duration_hours }} hours</dd>
                        </div>
                    </dl>
                </div>
            </div>

            {{-- Verification Stats --}}
            <div class="bg-white rounded-xl shadow-sm p-6 text-center">
                <div class="flex items-center justify-center gap-2 text-green-600 mb-4">
                    <i class="fas fa-shield-alt text-2xl"></i>
                    <span class="font-semibold text-lg">Verified Certificate</span>
                </div>
                <p class="text-gray-600 mb-4">
                    This certificate was verified on {{ now()->format('F d, Y \a\t H:i') }}
                </p>
                @if($certificate->verification_count > 0)
                    <p class="text-sm text-gray-500">
                        <i class="fas fa-eye mr-1"></i>
                        This certificate has been verified {{ $certificate->verification_count }} time(s)
                    </p>
                @endif
            </div>

            {{-- Back Link --}}
            <div class="text-center mt-8">
                <a href="{{ route('public.training.index') }}" 
                   class="inline-flex items-center text-green-600 hover:text-green-700">
                    <i class="fas fa-arrow-left mr-2"></i>
                    Back to Training Programs
                </a>
            </div>
        </div>
    </div>
</section>
@endsection