<x-app-layout>

<x-module-hero
    title="{{ $registration->user->name }}"
    description="{{ $registration->trainingPackage->name }}"
    icon="fa-user-graduate">

    <x-slot name="backButton">
        @can('view training registrations')
            <a href="{{ route('training.registrations.index') }}"
               class="inline-flex items-center gap-2 text-white/80 hover:text-white text-sm transition">
                <i class="fas fa-arrow-left"></i> Back to Registrations
            </a>
        @else
            <a href="{{ route('training.registrations.my') }}"
               class="inline-flex items-center gap-2 text-white/80 hover:text-white text-sm transition">
                <i class="fas fa-arrow-left"></i> Back to My Registrations
            </a>
        @endcan
    </x-slot>

    <x-slot name="tabs">
        @can('view training registrations')
            <a href="{{ route('training.registrations.index') }}"
               class="module-hero-tab {{ request()->routeIs('training.registrations.index') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }}
                      inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium
                      md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                <i class="fas fa-users text-sm"></i> All Registrations
            </a>
            <a href="{{ route('training.registrations.pending') }}"
               class="module-hero-tab {{ request()->routeIs('training.registrations.pending') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }}
                      inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium
                      md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
                <i class="fas fa-clock text-sm"></i> Pending
            </a>
        @endcan
        <a href="{{ route('training.registrations.my') }}"
           class="module-hero-tab {{ request()->routeIs('training.registrations.my') ? 'border-b-2 border-[#1e293b]' : 'opacity-70 hover:opacity-100 transition-opacity' }}
                  inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium
                  md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
            <i class="fas fa-user text-sm"></i> My Registrations
        </a>
        <a href="{{ route('training.registrations.show', $registration) }}"
           class="module-hero-tab border-b-2 border-[#1e293b]
                  inline-flex items-center gap-2 px-4 py-3 text-[#1e293b] text-sm font-medium
                  md:w-auto w-full border-b border-[#cbd5e1] md:border-b-0">
            <i class="fas fa-eye text-sm"></i> Details
        </a>
    </x-slot>

</x-module-hero>

<div class="p-6">

    {{-- Flash Messages --}}
    @if(session('success'))
        <div class="mb-4 p-4 bg-green-100 border border-green-400 text-green-700 rounded-lg flex items-center gap-2">
            <i class="fas fa-check-circle"></i> {{ session('success') }}
        </div>
    @endif
    @if(session('error'))
        <div class="mb-4 p-4 bg-red-100 border border-red-400 text-red-700 rounded-lg flex items-center gap-2">
            <i class="fas fa-exclamation-circle"></i> {{ session('error') }}
        </div>
    @endif

    {{-- Stats Row --}}
    <div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
        <div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
            <div class="text-sm font-bold text-gray-800">{{ $registration->registration_date->format('M d, Y') }}</div>
            <div class="text-xs text-gray-500 mt-1">Registration Date</div>
        </div>
        <div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
            @php
                $statusColors = [
                    'pending'   => 'text-yellow-600',
                    'approved'  => 'text-green-600',
                    'completed' => 'text-blue-600',
                    'rejected'  => 'text-red-600',
                    'cancelled' => 'text-gray-600',
                ];
            @endphp
            <div class="text-sm font-bold {{ $statusColors[$registration->status] ?? 'text-gray-800' }}">
                {{ ucfirst($registration->status) }}
            </div>
            <div class="text-xs text-gray-500 mt-1">Status</div>
        </div>
        <div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
            <div class="text-sm font-bold text-gray-800">
                {{ ucfirst(str_replace('_', ' ', $registration->payment_status)) }}
            </div>
            <div class="text-xs text-gray-500 mt-1">Payment</div>
        </div>
        <div class="bg-white rounded-lg border border-gray-200 p-4 text-center">
            <div class="text-sm font-bold text-gray-800">{{ $registration->attendance_percentage ?? 0 }}%</div>
            <div class="text-xs text-gray-500 mt-1">Attendance</div>
        </div>
    </div>

    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">

        {{-- Main Content --}}
        <div class="lg:col-span-2 space-y-6">

            {{-- Participant Information --}}
            <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                <div class="px-5 py-4 border-b border-gray-200 flex items-center gap-2">
                    <i class="fas fa-user text-green-600"></i>
                    <h3 class="font-semibold text-gray-800">Participant Information</h3>
                </div>
                <div class="p-5">
                    <div class="grid grid-cols-2 gap-4 text-sm">
                        <div>
                            <label class="text-xs text-gray-500 uppercase tracking-wide">Full Name</label>
                            <div class="font-medium text-gray-900 mt-1">{{ $registration->user->name }}</div>
                        </div>
                        <div>
                            <label class="text-xs text-gray-500 uppercase tracking-wide">Email</label>
                            <div class="font-medium text-gray-900 mt-1">{{ $registration->user->email }}</div>
                        </div>
                        @if($registration->user->phone)
                            <div>
                                <label class="text-xs text-gray-500 uppercase tracking-wide">Phone</label>
                                <div class="font-medium text-gray-900 mt-1">{{ $registration->user->phone }}</div>
                            </div>
                        @endif
                        @if($registration->notes)
                            <div class="col-span-2">
                                <label class="text-xs text-gray-500 uppercase tracking-wide">Notes</label>
                                <div class="text-gray-700 mt-1">{{ $registration->notes }}</div>
                            </div>
                        @endif
                        @if($registration->rejection_reason)
                            <div class="col-span-2">
                                <label class="text-xs text-red-500 uppercase tracking-wide">Rejection Reason</label>
                                <div class="text-red-700 mt-1 p-2 bg-red-50 rounded">{{ $registration->rejection_reason }}</div>
                            </div>
                        @endif
                    </div>
                </div>
            </div>

            {{-- Training Package Details --}}
            <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                <div class="px-5 py-4 border-b border-gray-200 flex items-center gap-2">
                    <i class="fas fa-book text-green-600"></i>
                    <h3 class="font-semibold text-gray-800">Training Package</h3>
                </div>
                <div class="p-5">
                    <div class="flex items-start gap-4">
                        @if($registration->trainingPackage->featured_image)
                            <img src="{{ $registration->trainingPackage->featured_image }}"
                                 alt="{{ $registration->trainingPackage->name }}"
                                 class="w-20 h-20 object-cover rounded-lg">
                        @else
                            <div class="w-20 h-20 bg-green-100 rounded-lg flex items-center justify-center">
                                <i class="fas fa-book text-green-600 text-xl"></i>
                            </div>
                        @endif
                        <div>
                            <h4 class="font-semibold text-gray-900">{{ $registration->trainingPackage->name }}</h4>
                            <div class="text-sm text-gray-500 mt-1">
                                {{ $registration->trainingPackage->category->name ?? 'General' }}
                            </div>
                            <div class="text-sm text-gray-500 mt-1">
                                <i class="fas fa-clock mr-1"></i>{{ $registration->trainingPackage->getFormattedDuration() }}
                            </div>
                            <div class="mt-2">
                                @if($registration->trainingPackage->is_free)
                                    <span class="text-green-600 font-semibold text-sm">Free Training</span>
                                @else
                                    <span class="font-semibold text-sm">{{ $registration->trainingPackage->getFormattedFee() }}</span>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            {{-- Completion Details (if completed) --}}
            @if($registration->status === 'completed')
                <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                    <div class="px-5 py-4 border-b border-gray-200 flex items-center gap-2">
                        <i class="fas fa-graduation-cap text-blue-600"></i>
                        <h3 class="font-semibold text-gray-800">Completion Details</h3>
                    </div>
                    <div class="p-5 grid grid-cols-3 gap-4 text-sm">
                        <div class="text-center">
                            <div class="text-2xl font-bold text-green-600">{{ $registration->attendance_percentage ?? 0 }}%</div>
                            <div class="text-xs text-gray-500 mt-1">Attendance</div>
                        </div>
                        @if($registration->score !== null)
                            <div class="text-center">
                                <div class="text-2xl font-bold text-blue-600">{{ $registration->score }}</div>
                                <div class="text-xs text-gray-500 mt-1">Score</div>
                            </div>
                        @endif
                        @if($registration->passed !== null)
                            <div class="text-center">
                                <div class="text-2xl font-bold {{ $registration->passed ? 'text-green-600' : 'text-red-600' }}">
                                    {{ $registration->passed ? 'Passed' : 'Failed' }}
                                </div>
                                <div class="text-xs text-gray-500 mt-1">Result</div>
                            </div>
                        @endif
                    </div>
                </div>
            @endif
        </div>

        {{-- Sidebar --}}
        <div class="space-y-6">

            {{-- Quick Actions --}}
            <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                <div class="px-5 py-4 border-b border-gray-200">
                    <h3 class="font-semibold text-gray-800 text-sm">Quick Actions</h3>
                </div>
                <div class="p-4 space-y-2">

                    @can('approve training registrations')
                        @if($registration->status === 'pending')
                            <form action="{{ route('training.registrations.approve', $registration) }}" method="POST">
                                @csrf
                                <button type="submit"
                                        class="w-full px-4 py-2 bg-green-600 text-white rounded-lg text-sm hover:bg-green-700 transition text-left">
                                    <i class="fas fa-check-circle mr-2"></i> Approve Registration
                                </button>
                            </form>
                            <button type="button"
                                    onclick="document.getElementById('rejectModalShow').classList.remove('hidden')"
                                    class="w-full px-4 py-2 bg-red-600 text-white rounded-lg text-sm hover:bg-red-700 transition text-left">
                                <i class="fas fa-times-circle mr-2"></i> Reject Registration
                            </button>
                        @endif
                    @endcan

                    @can('complete training registrations')
                        @if($registration->status === 'approved')
                            <button type="button"
                                    onclick="document.getElementById('completeModal').classList.remove('hidden')"
                                    class="w-full px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700 transition text-left">
                                <i class="fas fa-graduation-cap mr-2"></i> Mark as Completed
                            </button>
                        @endif
                    @endcan

                    {{-- Payment button — visible to own user or those with payment permission --}}
                    @if($registration->status === 'approved'
                        && !$registration->trainingPackage->is_free
                        && $registration->payment_status !== 'completed'
                        && ($registration->user_id === auth()->id() || auth()->user()->can('view training payments')))
                        <a href="{{ route('training.registrations.payment', $registration) }}"
                           class="block px-4 py-2 bg-yellow-500 text-white rounded-lg text-sm hover:bg-yellow-600 transition">
                            <i class="fas fa-credit-card mr-2"></i> Process Payment
                        </a>
                    @endif

                    @if($registration->status === 'completed' && $registration->certificate)
                        <a href="{{ route('training.certificates.show', $registration->certificate) }}"
                           class="block px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700 transition">
                            <i class="fas fa-certificate mr-2"></i> View Certificate
                        </a>
                    @endif

                    @can('generate training certificates')
                        @if($registration->status === 'completed' && !$registration->certificate_issued && $registration->trainingPackage->generates_certificate)
                            <form action="{{ route('training.certificates.generate', $registration) }}" method="POST">
                                @csrf
                                <button type="submit"
                                        class="w-full px-4 py-2 bg-purple-600 text-white rounded-lg text-sm hover:bg-purple-700 transition text-left">
                                    <i class="fas fa-award mr-2"></i> Generate Certificate
                                </button>
                            </form>
                        @endif
                    @endcan

                    {{-- Cancel own registration --}}
                    @if(in_array($registration->status, ['pending', 'approved'])
                        && ($registration->user_id === auth()->id() || auth()->user()->can('cancel training registrations')))
                        <button type="button"
                                onclick="document.getElementById('cancelModal').classList.remove('hidden')"
                                class="w-full px-4 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm hover:bg-gray-200 transition text-left">
                            <i class="fas fa-ban mr-2"></i> Cancel Registration
                        </button>
                    @endif
                </div>
            </div>

            {{-- Registration Timeline --}}
            <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                <div class="px-5 py-4 border-b border-gray-200">
                    <h3 class="font-semibold text-gray-800 text-sm">Registration Timeline</h3>
                </div>
                <div class="p-4">
                    <div class="space-y-4">
                        <div class="flex items-start gap-3">
                            <div class="w-7 h-7 bg-green-600 rounded-full flex items-center justify-center text-white text-xs flex-shrink-0">
                                <i class="fas fa-check"></i>
                            </div>
                            <div>
                                <div class="text-sm font-medium text-gray-900">Registered</div>
                                <div class="text-xs text-gray-500">{{ $registration->registration_date->format('M d, Y g:i A') }}</div>
                            </div>
                        </div>
                        @if(!in_array($registration->status, ['pending']))
                            <div class="flex items-start gap-3">
                                <div class="w-7 h-7 {{ $registration->status === 'rejected' ? 'bg-red-600' : ($registration->status === 'cancelled' ? 'bg-gray-500' : 'bg-green-600') }} rounded-full flex items-center justify-center text-white text-xs flex-shrink-0">
                                    <i class="fas {{ $registration->status === 'rejected' ? 'fa-times' : ($registration->status === 'cancelled' ? 'fa-ban' : 'fa-check') }}"></i>
                                </div>
                                <div>
                                    <div class="text-sm font-medium text-gray-900">{{ ucfirst($registration->status) }}</div>
                                    @if($registration->approved_at)
                                        <div class="text-xs text-gray-500">{{ $registration->approved_at->format('M d, Y g:i A') }}</div>
                                    @elseif($registration->rejected_at)
                                        <div class="text-xs text-gray-500">{{ $registration->rejected_at->format('M d, Y g:i A') }}</div>
                                    @endif
                                </div>
                            </div>
                        @endif
                        @if($registration->payment_status === 'completed')
                            <div class="flex items-start gap-3">
                                <div class="w-7 h-7 bg-green-600 rounded-full flex items-center justify-center text-white text-xs flex-shrink-0">
                                    <i class="fas fa-dollar-sign"></i>
                                </div>
                                <div>
                                    <div class="text-sm font-medium text-gray-900">Payment Completed</div>
                                    @if($registration->payment_date)
                                        <div class="text-xs text-gray-500">{{ $registration->payment_date->format('M d, Y g:i A') }}</div>
                                    @endif
                                </div>
                            </div>
                        @endif
                        @if($registration->status === 'completed')
                            <div class="flex items-start gap-3">
                                <div class="w-7 h-7 bg-blue-600 rounded-full flex items-center justify-center text-white text-xs flex-shrink-0">
                                    <i class="fas fa-graduation-cap"></i>
                                </div>
                                <div>
                                    <div class="text-sm font-medium text-gray-900">Completed</div>
                                    @if($registration->completion_date)
                                        <div class="text-xs text-gray-500">{{ $registration->completion_date->format('M d, Y g:i A') }}</div>
                                    @endif
                                </div>
                            </div>
                        @endif
                    </div>
                </div>
            </div>

            {{-- Payment Information --}}
            @if(!$registration->trainingPackage->is_free)
                <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                    <div class="px-5 py-4 border-b border-gray-200">
                        <h3 class="font-semibold text-gray-800 text-sm">Payment Information</h3>
                    </div>
                    <div class="p-4 space-y-3 text-sm">
                        <div class="flex justify-between">
                            <span class="text-gray-500">Amount Due</span>
                            <span class="font-semibold">{{ $registration->trainingPackage->getFormattedFee() }}</span>
                        </div>
                        <div class="flex justify-between">
                            <span class="text-gray-500">Status</span>
                            <span class="{{ $registration->payment_status === 'completed' ? 'text-green-600' : 'text-yellow-600' }}">
                                {{ ucfirst(str_replace('_', ' ', $registration->payment_status)) }}
                            </span>
                        </div>
                        @if($registration->amount_paid > 0)
                            <div class="flex justify-between">
                                <span class="text-gray-500">Amount Paid</span>
                                <span class="font-semibold text-green-600">
                                    {{ number_format($registration->amount_paid, 0) }} {{ $registration->trainingPackage->currency }}
                                </span>
                            </div>
                        @endif
                        @if($registration->payment_reference)
                            <div class="flex justify-between">
                                <span class="text-gray-500">Reference</span>
                                <span class="font-mono text-xs">{{ $registration->payment_reference }}</span>
                            </div>
                        @endif
                        @if($registration->payment_method)
                            <div class="flex justify-between">
                                <span class="text-gray-500">Method</span>
                                <span>{{ ucfirst(str_replace('_', ' ', $registration->payment_method)) }}</span>
                            </div>
                        @endif
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

{{-- Reject Modal (for show page) --}}
@can('approve training registrations')
@if($registration->status === 'pending')
<div id="rejectModalShow" class="fixed inset-0 z-50 hidden overflow-y-auto">
    <div class="fixed inset-0 bg-black bg-opacity-50"
         onclick="document.getElementById('rejectModalShow').classList.add('hidden')"></div>
    <div class="relative min-h-screen flex items-center justify-center p-4">
        <div class="relative bg-white rounded-xl shadow-xl max-w-md w-full">
            <div class="flex items-center justify-between px-6 py-4 bg-gradient-to-r from-red-600 to-red-700 rounded-t-xl">
                <h3 class="text-base font-semibold text-white flex items-center gap-2">
                    <i class="fas fa-times-circle"></i> Reject Registration
                </h3>
                <button type="button" onclick="document.getElementById('rejectModalShow').classList.add('hidden')"
                        class="text-white/80 hover:text-white transition"><i class="fas fa-times"></i></button>
            </div>
            <div class="p-6">
                <form action="{{ route('training.registrations.reject', $registration) }}" method="POST">
                    @csrf
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">
                            Rejection Reason <span class="text-red-500">*</span>
                        </label>
                        <textarea name="rejection_reason" rows="3" required
                                  class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-green-500"
                                  placeholder="Please provide a clear reason..."></textarea>
                    </div>
                    <div class="flex justify-end gap-3">
                        <button type="button"
                                onclick="document.getElementById('rejectModalShow').classList.add('hidden')"
                                class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm hover:bg-gray-50 transition">
                            Cancel
                        </button>
                        <button type="submit"
                                class="px-4 py-2 bg-red-600 text-white rounded-lg text-sm hover:bg-red-700 transition">
                            Reject Registration
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endif
@endcan

{{-- Complete Modal --}}
@can('complete training registrations')
@if($registration->status === 'approved')
<div id="completeModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
    <div class="fixed inset-0 bg-black bg-opacity-50"
         onclick="document.getElementById('completeModal').classList.add('hidden')"></div>
    <div class="relative min-h-screen flex items-center justify-center p-4">
        <div class="relative bg-white rounded-xl shadow-xl max-w-md w-full">
            <div class="flex items-center justify-between px-6 py-4 bg-gradient-to-r from-blue-600 to-blue-700 rounded-t-xl">
                <h3 class="text-base font-semibold text-white flex items-center gap-2">
                    <i class="fas fa-graduation-cap"></i> Mark as Completed
                </h3>
                <button type="button" onclick="document.getElementById('completeModal').classList.add('hidden')"
                        class="text-white/80 hover:text-white transition"><i class="fas fa-times"></i></button>
            </div>
            <div class="p-6">
                <form action="{{ route('training.registrations.complete', $registration) }}" method="POST">
                    @csrf
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">
                            Attendance Percentage <span class="text-red-500">*</span>
                        </label>
                        <input type="number" name="attendance_percentage" min="0" max="100" step="0.1"
                               required value="100"
                               class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-green-500">
                    </div>
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Score (optional)</label>
                        <input type="number" name="score" min="0" max="100" step="0.1"
                               class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-green-500">
                    </div>
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Result</label>
                        <select name="passed"
                                class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-green-500">
                            <option value="">Not specified</option>
                            <option value="1">Passed</option>
                            <option value="0">Failed</option>
                        </select>
                    </div>
                    <div class="flex justify-end gap-3">
                        <button type="button"
                                onclick="document.getElementById('completeModal').classList.add('hidden')"
                                class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm hover:bg-gray-50 transition">
                            Cancel
                        </button>
                        <button type="submit"
                                class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700 transition">
                            Mark Completed
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endif
@endcan

{{-- Cancel Modal --}}
@if(in_array($registration->status, ['pending', 'approved'])
    && ($registration->user_id === auth()->id() || auth()->user()->can('cancel training registrations')))
<div id="cancelModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
    <div class="fixed inset-0 bg-black bg-opacity-50"
         onclick="document.getElementById('cancelModal').classList.add('hidden')"></div>
    <div class="relative min-h-screen flex items-center justify-center p-4">
        <div class="relative bg-white rounded-xl shadow-xl max-w-md w-full">
            <div class="flex items-center justify-between px-6 py-4 bg-gradient-to-r from-gray-600 to-gray-700 rounded-t-xl">
                <h3 class="text-base font-semibold text-white flex items-center gap-2">
                    <i class="fas fa-ban"></i> Cancel Registration
                </h3>
                <button type="button" onclick="document.getElementById('cancelModal').classList.add('hidden')"
                        class="text-white/80 hover:text-white transition"><i class="fas fa-times"></i></button>
            </div>
            <div class="p-6">
                <p class="text-sm text-gray-600 mb-4">Are you sure you want to cancel this registration?</p>
                <form action="{{ route('training.registrations.cancel', $registration) }}" method="POST">
                    @csrf
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Reason (optional)</label>
                        <textarea name="cancellation_reason" rows="2"
                                  class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-green-500"
                                  placeholder="Reason for cancellation..."></textarea>
                    </div>
                    <div class="flex justify-end gap-3">
                        <button type="button"
                                onclick="document.getElementById('cancelModal').classList.add('hidden')"
                                class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm hover:bg-gray-50 transition">
                            Keep Registration
                        </button>
                        <button type="submit"
                                class="px-4 py-2 bg-gray-600 text-white rounded-lg text-sm hover:bg-gray-700 transition">
                            Cancel Registration
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endif

@push('scripts')
<script>
    document.addEventListener('keydown', function(e) {
        if (e.key === 'Escape') {
            ['rejectModalShow','completeModal','cancelModal'].forEach(id => {
                document.getElementById(id)?.classList.add('hidden');
            });
        }
    });
</script>
@endpush

</x-app-layout>
