<div>
    {{-- Header --}}
    <div class="flex items-center justify-between mb-6">
        <div>
            <h1 class="text-xl sm:text-2xl font-bold text-gray-800">{{ __('تحصيل مدفوعات') }}</h1>
            <p class="text-sm text-gray-500 mt-1">{{ __('تحصيل مدفوعات من فواتير مستحقة') }}</p>
        </div>
        <a href="{{ route('receptionist.dashboard') }}" wire:navigate
           class="inline-flex items-center gap-2 px-4 py-2 text-gray-600 bg-gray-100 rounded-lg hover:bg-gray-200 text-sm font-medium transition-colors">
            <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"/>
            </svg>
            {{ __('العودة للاستقبال') }}
        </a>
    </div>

    {{-- Flash Messages --}}
    @if(session('error'))
    <div class="mb-4 p-4 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm">
        {{ session('error') }}
    </div>
    @endif

    {{-- Step Indicator --}}
    @if($currentStep < 5)
    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 mb-6">
        <div class="flex items-center justify-between">
            @php
                $steps = [
                    1 => 'بحث عن المشترك',
                    2 => 'الفواتير المستحقة',
                    3 => 'تحديد المبلغ',
                    4 => 'تأكيد',
                ];
            @endphp
            @foreach($steps as $num => $label)
            <div class="flex items-center {{ !$loop->last ? 'flex-1' : '' }}">
                <button wire:click="goToStep({{ $num }})"
                        @if($num >= $currentStep) disabled @endif
                        class="flex items-center gap-2 {{ $num < $currentStep ? 'cursor-pointer' : 'cursor-default' }}">
                    <div class="w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold transition-colors
                        {{ $num === $currentStep ? 'bg-amber-600 text-white' : '' }}
                        {{ $num < $currentStep ? 'bg-green-500 text-white' : '' }}
                        {{ $num > $currentStep ? 'bg-gray-200 text-gray-500' : '' }}">
                        @if($num < $currentStep)
                            <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"/>
                            </svg>
                        @else
                            {{ $num }}
                        @endif
                    </div>
                    <span class="text-xs font-medium hidden sm:inline
                        {{ $num === $currentStep ? 'text-amber-600' : '' }}
                        {{ $num < $currentStep ? 'text-green-600' : '' }}
                        {{ $num > $currentStep ? 'text-gray-400' : '' }}">
                        {{ __($label) }}
                    </span>
                </button>
                @if(!$loop->last)
                <div class="flex-1 h-0.5 mx-3 {{ $num < $currentStep ? 'bg-green-500' : 'bg-gray-200' }}"></div>
                @endif
            </div>
            @endforeach
        </div>
    </div>
    @endif

    {{-- Step Content --}}
    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 sm:p-6">
        {{-- Step 1: Search Participant --}}
        @if($currentStep === 1)
        <div>
            <h2 class="text-lg font-semibold text-gray-800 mb-6">{{ __('بحث عن المشترك') }}</h2>

            {{-- Search Input --}}
            <div class="mb-6">
                <input type="text" wire:model.live.debounce.300ms="search"
                       class="w-full px-4 py-3 min-h-16 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500 text-lg"
                       placeholder="{{ __('بحث بالاسم، الهاتف، الرقم القومي، أو رقم المشترك...') }}">
            </div>

            {{-- Selected Participant Indicator --}}
            @if($selected_participant_id)
            <div class="mb-4 p-4 bg-amber-50 border border-amber-200 rounded-xl flex items-center justify-between">
                <div class="flex items-center gap-3">
                    <div class="w-10 h-10 rounded-full bg-amber-200 flex items-center justify-center">
                        <svg class="w-5 h-5 text-amber-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
                        </svg>
                    </div>
                    <span class="font-medium text-amber-800">{{ $selected_participant_name }}</span>
                </div>
                <button wire:click="$set('selected_participant_id', null)" class="text-amber-600 hover:text-amber-800 text-sm">
                    {{ __('تغيير') }}
                </button>
            </div>
            @endif

            {{-- Search Results --}}
            @if(strlen($search) >= 2 && !$selected_participant_id)
            <div class="space-y-2" wire:loading.class="opacity-50">
                @forelse($searchResults as $result)
                <button wire:click="selectParticipant({{ $result->id }}, '{{ $result->person?->name_ar }}')"
                        class="w-full p-4 min-h-16 border border-gray-200 rounded-xl text-start hover:border-amber-300 hover:bg-amber-50 transition-all flex items-center justify-between">
                    <div>
                        <p class="font-medium text-gray-800">{{ $result->person?->name_ar }}</p>
                        <div class="flex items-center gap-3 mt-1 text-xs text-gray-500">
                            @if($result->participant_number)
                            <span dir="ltr">{{ $result->participant_number }}</span>
                            @endif
                            @if($result->person?->phone)
                            <span dir="ltr">{{ $result->person->phone }}</span>
                            @endif
                        </div>
                    </div>
                    <span class="px-2 py-0.5 text-xs rounded-full
                        {{ $result->status->value === 'active' ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-600' }}">
                        {{ $result->status->value === 'active' ? __('نشط') : __($result->status->value) }}
                    </span>
                </button>
                @empty
                <div class="text-center py-8 text-gray-500">
                    <svg class="w-12 h-12 mx-auto text-gray-300 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
                    </svg>
                    <p>{{ __('لا توجد نتائج') }}</p>
                </div>
                @endforelse
            </div>
            @elseif(strlen($search) < 2 && !$selected_participant_id)
            <div class="text-center py-8 text-gray-400">
                <svg class="w-16 h-16 mx-auto text-gray-200 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
                </svg>
                <p class="text-sm">{{ __('اكتب حرفين على الأقل للبحث') }}</p>
            </div>
            @endif

            @error('selected_participant_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror

            <div class="flex justify-end mt-8">
                <button wire:click="nextStep" wire:loading.attr="disabled"
                        @if(!$selected_participant_id) disabled @endif
                        class="inline-flex items-center gap-2 px-6 py-3 min-h-16 bg-amber-600 text-white rounded-lg hover:bg-amber-700 text-base font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
                    <span wire:loading.remove wire:target="nextStep">{{ __('التالي') }}</span>
                    <span wire:loading wire:target="nextStep">{{ __('جارٍ...') }}</span>
                    <svg class="w-5 h-5 rotate-180" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                    </svg>
                </button>
            </div>
        </div>
        @endif

        {{-- Step 2: Outstanding Invoices --}}
        @if($currentStep === 2)
        <div>
            <h2 class="text-lg font-semibold text-gray-800 mb-6">{{ __('الفواتير المستحقة') }}</h2>

            @if($invoices->isEmpty())
            <div class="text-center py-12 text-gray-500">
                <svg class="w-16 h-16 mx-auto text-gray-300 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
                </svg>
                <p class="text-lg font-medium">{{ __('لا يوجد فواتير مستحقة') }}</p>
                <p class="text-sm mt-1">{{ __('هذا المشترك ليس عليه أي مستحقات') }}</p>
            </div>
            @else
            <div class="space-y-3">
                @foreach($invoices as $invoice)
                <label class="relative cursor-pointer block">
                    <input type="radio" wire:model.live="selected_invoice_id" value="{{ $invoice->id }}" class="peer sr-only">
                    <div class="p-5 min-h-16 border border-gray-200 rounded-xl transition-all
                                peer-checked:border-amber-500 peer-checked:bg-amber-50 peer-checked:shadow-sm
                                hover:border-gray-300">
                        <div class="flex items-center justify-between">
                            <div>
                                <p class="font-bold text-gray-800">{{ $invoice->number }}</p>
                                <p class="text-sm text-gray-500 mt-1">{{ $invoice->notes ?? __('فاتورة اشتراك') }}</p>
                                @if($invoice->due_date)
                                <p class="text-xs mt-1 {{ $invoice->due_date->isPast() ? 'text-red-600 font-medium' : 'text-gray-400' }}">
                                    {{ __('تاريخ الاستحقاق') }}: <span dir="ltr">{{ $invoice->due_date->format('Y-m-d') }}</span>
                                </p>
                                @endif
                            </div>
                            <div class="text-end">
                                <p class="text-lg font-bold text-gray-800" dir="ltr">
                                    {{ number_format($invoice->due_amount / 100, 2) }} {{ __('ج.م') }}
                                </p>
                                @if($invoice->paid_amount > 0)
                                <p class="text-xs text-green-600">
                                    {{ __('مدفوع') }}: <span dir="ltr">{{ number_format($invoice->paid_amount / 100, 2) }}</span>
                                </p>
                                @endif
                                @php
                                    $statusColors = [
                                        'sent' => 'blue',
                                        'partially_paid' => 'amber',
                                        'overdue' => 'red',
                                    ];
                                    $statusLabels = [
                                        'sent' => 'مرسلة',
                                        'partially_paid' => 'مدفوعة جزئيًا',
                                        'overdue' => 'متأخرة',
                                    ];
                                    $statusValue = $invoice->status->value ?? $invoice->status;
                                    $color = $statusColors[$statusValue] ?? 'gray';
                                @endphp
                                <span class="inline-block mt-1 px-2 py-0.5 text-xs rounded-full bg-{{ $color }}-100 text-{{ $color }}-700">
                                    {{ __($statusLabels[$statusValue] ?? $statusValue) }}
                                </span>
                            </div>
                        </div>
                    </div>
                </label>
                @endforeach
            </div>
            @endif

            @error('selected_invoice_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror

            {{-- Upcoming Installments & Renewals --}}
            @if($upcomingPayments->isNotEmpty())
            <div class="mt-6 p-4 bg-indigo-50 border border-indigo-200 rounded-xl">
                <h3 class="text-sm font-semibold text-indigo-800 mb-3 flex items-center gap-2">
                    <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="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
                    </svg>
                    {{ __('مواعيد قادمة') }}
                </h3>
                <div class="space-y-2">
                    @foreach($upcomingPayments->take(5) as $upcoming)
                    <div class="flex items-center justify-between py-2 px-3 bg-white rounded-lg border border-indigo-100">
                        <div class="flex items-center gap-2">
                            @if($upcoming['type'] === 'installment')
                            <span class="w-2 h-2 rounded-full bg-amber-500"></span>
                            @else
                            <span class="w-2 h-2 rounded-full bg-green-500"></span>
                            @endif
                            <span class="text-sm text-gray-800">{{ $upcoming['label'] }}</span>
                        </div>
                        <div class="flex items-center gap-3">
                            @if($upcoming['amount'])
                            <span class="text-sm font-medium text-gray-700" dir="ltr">{{ number_format($upcoming['amount'] / 100, 2) }} {{ __('ج.م') }}</span>
                            @endif
                            @if($upcoming['type'] === 'renewal' && $upcoming['due_date']->isPast())
                            <button wire:click="generateRenewalForEnrollment({{ $upcoming['enrollment_id'] }})"
                                    wire:loading.attr="disabled"
                                    class="text-xs px-3 py-1 rounded-lg bg-green-600 text-white hover:bg-green-700 font-medium transition-colors">
                                <span wire:loading.remove wire:target="generateRenewalForEnrollment({{ $upcoming['enrollment_id'] }})">{{ __('إنشاء فاتورة') }}</span>
                                <span wire:loading wire:target="generateRenewalForEnrollment({{ $upcoming['enrollment_id'] }})">{{ __('جارٍ...') }}</span>
                            </button>
                            @else
                            <span class="text-xs px-2 py-0.5 rounded-full {{ $upcoming['due_date']->isPast() ? 'bg-red-100 text-red-700' : ($upcoming['due_date']->isToday() ? 'bg-amber-100 text-amber-700' : 'bg-gray-100 text-gray-600') }}" dir="ltr">
                                {{ $upcoming['due_date']->format('Y-m-d') }}
                            </span>
                            @endif
                        </div>
                    </div>
                    @endforeach
                </div>
            </div>
            @endif

            <div class="flex justify-between mt-8">
                <button wire:click="previousStep"
                        class="inline-flex items-center gap-2 px-6 py-3 min-h-16 text-gray-600 bg-gray-100 rounded-lg hover:bg-gray-200 text-base font-medium transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                    </svg>
                    {{ __('السابق') }}
                </button>
                <button wire:click="nextStep" wire:loading.attr="disabled"
                        @if(!$selected_invoice_id) disabled @endif
                        class="inline-flex items-center gap-2 px-6 py-3 min-h-16 bg-amber-600 text-white rounded-lg hover:bg-amber-700 text-base font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
                    <span wire:loading.remove wire:target="nextStep">{{ __('التالي') }}</span>
                    <span wire:loading wire:target="nextStep">{{ __('جارٍ...') }}</span>
                    <svg class="w-5 h-5 rotate-180" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                    </svg>
                </button>
            </div>
        </div>
        @endif

        {{-- Step 3: Amount & Method --}}
        @if($currentStep === 3)
        <div>
            <h2 class="text-lg font-semibold text-gray-800 mb-6">{{ __('تحديد المبلغ وطريقة الدفع') }}</h2>

            {{-- Invoice Summary --}}
            @if($selectedInvoice)
            <div class="p-4 bg-gray-50 rounded-xl border border-gray-200 mb-6">
                <div class="flex items-center justify-between">
                    <span class="text-gray-600">{{ __('الرصيد المستحق') }}</span>
                    <span class="text-xl font-bold text-gray-800" dir="ltr">
                        {{ number_format($selectedInvoice->due_amount / 100, 2) }} {{ __('ج.م') }}
                    </span>
                </div>
            </div>
            @endif

            <div class="space-y-6">
                {{-- Amount Input --}}
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-2">{{ __('المبلغ المراد تحصيله') }}</label>
                    <div class="relative">
                        <input type="number" wire:model="payment_amount_display" dir="ltr" step="0.01" min="0.01"
                               class="w-full px-4 py-4 min-h-16 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500 text-2xl font-bold text-center"
                               placeholder="0.00">
                        <span class="absolute top-1/2 -translate-y-1/2 end-4 text-gray-400 text-sm">{{ __('ج.م') }}</span>
                    </div>
                    @error('payment_amount_display') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror

                    @if($selectedInvoice)
                    <button wire:click="payFullAmount" class="mt-2 text-sm text-amber-600 hover:text-amber-800 font-medium">
                        {{ __('دفع كامل المبلغ المستحق') }}
                    </button>
                    @endif
                </div>

                {{-- Payment Method --}}
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-3">{{ __('طريقة الدفع') }}</label>
                    <div class="grid grid-cols-3 gap-3">
                        <label class="relative cursor-pointer">
                            <input type="radio" wire:model="payment_method" value="cash" class="peer sr-only">
                            <div class="p-4 min-h-16 flex flex-col items-center justify-center gap-2 border border-gray-300 rounded-xl transition-all
                                        peer-checked:border-green-500 peer-checked:bg-green-50 peer-checked:text-green-700
                                        hover:border-gray-400">
                                <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2m2 4h10a2 2 0 002-2v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6a2 2 0 002 2zm7-5a2 2 0 11-4 0 2 2 0 014 0z"/>
                                </svg>
                                <span class="text-sm font-medium">{{ __('نقدي') }}</span>
                            </div>
                        </label>
                        <label class="relative cursor-pointer">
                            <input type="radio" wire:model="payment_method" value="card" class="peer sr-only">
                            <div class="p-4 min-h-16 flex flex-col items-center justify-center gap-2 border border-gray-300 rounded-xl transition-all
                                        peer-checked:border-blue-500 peer-checked:bg-blue-50 peer-checked:text-blue-700
                                        hover:border-gray-400">
                                <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/>
                                </svg>
                                <span class="text-sm font-medium">{{ __('بطاقة') }}</span>
                            </div>
                        </label>
                        <label class="relative cursor-pointer">
                            <input type="radio" wire:model="payment_method" value="wallet" class="peer sr-only">
                            <div class="p-4 min-h-16 flex flex-col items-center justify-center gap-2 border border-gray-300 rounded-xl transition-all
                                        peer-checked:border-purple-500 peer-checked:bg-purple-50 peer-checked:text-purple-700
                                        hover:border-gray-400">
                                <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 6h18M3 14h18M3 18h18"/>
                                </svg>
                                <span class="text-sm font-medium">{{ __('محفظة') }}</span>
                            </div>
                        </label>
                    </div>
                    @error('payment_method') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
                </div>

                {{-- Notes --}}
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">{{ __('ملاحظات') }} <span class="text-gray-400 text-xs">({{ __('اختياري') }})</span></label>
                    <textarea wire:model="payment_notes" rows="2"
                              class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500"
                              placeholder="{{ __('أي ملاحظات على هذا الدفع...') }}"></textarea>
                </div>
            </div>

            <div class="flex justify-between mt-8">
                <button wire:click="previousStep"
                        class="inline-flex items-center gap-2 px-6 py-3 min-h-16 text-gray-600 bg-gray-100 rounded-lg hover:bg-gray-200 text-base font-medium transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                    </svg>
                    {{ __('السابق') }}
                </button>
                <button wire:click="nextStep" wire:loading.attr="disabled"
                        class="inline-flex items-center gap-2 px-6 py-3 min-h-16 bg-amber-600 text-white rounded-lg hover:bg-amber-700 text-base font-medium transition-colors disabled:opacity-50">
                    <span wire:loading.remove wire:target="nextStep">{{ __('التالي') }}</span>
                    <span wire:loading wire:target="nextStep">{{ __('جارٍ...') }}</span>
                    <svg class="w-5 h-5 rotate-180" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                    </svg>
                </button>
            </div>
        </div>
        @endif

        {{-- Step 4: Confirm --}}
        @if($currentStep === 4)
        <div>
            <h2 class="text-lg font-semibold text-gray-800 mb-6">{{ __('تأكيد الدفع') }}</h2>

            <div class="p-6 bg-gray-50 rounded-xl border border-gray-200 mb-6">
                <div class="space-y-4">
                    <div class="flex items-center justify-between">
                        <span class="text-gray-600">{{ __('المشترك') }}</span>
                        <span class="font-medium text-gray-800">{{ $selected_participant_name }}</span>
                    </div>
                    @if($selectedInvoice)
                    <div class="flex items-center justify-between">
                        <span class="text-gray-600">{{ __('رقم الفاتورة') }}</span>
                        <span class="font-medium text-gray-800" dir="ltr">{{ $selectedInvoice->number }}</span>
                    </div>
                    @endif
                    <div class="flex items-center justify-between">
                        <span class="text-gray-600">{{ __('طريقة الدفع') }}</span>
                        <span class="font-medium text-gray-800">
                            @switch($payment_method)
                                @case('cash') {{ __('نقدي') }} @break
                                @case('card') {{ __('بطاقة') }} @break
                                @case('wallet') {{ __('محفظة') }} @break
                            @endswitch
                        </span>
                    </div>
                    <div class="border-t border-gray-300 pt-4 flex items-center justify-between">
                        <span class="text-lg font-bold text-gray-800">{{ __('المبلغ') }}</span>
                        <span class="text-2xl font-bold text-green-700" dir="ltr">
                            {{ number_format((float)$payment_amount_display, 2) }} {{ __('ج.م') }}
                        </span>
                    </div>
                </div>
            </div>

            <div class="flex justify-between mt-8">
                <button wire:click="previousStep"
                        class="inline-flex items-center gap-2 px-6 py-3 min-h-16 text-gray-600 bg-gray-100 rounded-lg hover:bg-gray-200 text-base font-medium transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
                    </svg>
                    {{ __('السابق') }}
                </button>
                <button wire:click="confirm" wire:loading.attr="disabled"
                        class="inline-flex items-center gap-2 px-8 py-3 min-h-16 bg-green-600 text-white rounded-lg hover:bg-green-700 text-base font-bold transition-colors disabled:opacity-50">
                    <span wire:loading.remove wire:target="confirm">{{ __('تأكيد الدفع') }}</span>
                    <span wire:loading wire:target="confirm">
                        <svg class="animate-spin w-5 h-5" fill="none" viewBox="0 0 24 24">
                            <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/>
                            <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/>
                        </svg>
                    </span>
                    <span wire:loading wire:target="confirm">{{ __('جارٍ تسجيل الدفع...') }}</span>
                </button>
            </div>
        </div>
        @endif

        {{-- Step 5: Receipt / Success --}}
        @if($currentStep === 5)
        <div class="text-center py-8">
            <div class="w-20 h-20 mx-auto bg-green-100 rounded-full flex items-center justify-center mb-6 animate-bounce">
                <svg class="w-10 h-10 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
                </svg>
            </div>

            <h2 class="text-2xl font-bold text-green-700 mb-2">{{ __('تم تسجيل الدفع بنجاح!') }}</h2>
            <p class="text-gray-600 mb-6">{{ __('تم تحصيل المبلغ وتحديث الفاتورة') }}</p>

            {{-- Receipt Summary --}}
            <div class="inline-block bg-gray-50 border border-gray-200 rounded-xl p-6 mb-6 text-start">
                @if($receipt_number)
                <div class="mb-3">
                    <p class="text-xs text-gray-500">{{ __('رقم الإيصال') }}</p>
                    <p class="text-lg font-bold text-gray-800" dir="ltr">{{ $receipt_number }}</p>
                </div>
                @endif
                <div class="mb-3">
                    <p class="text-xs text-gray-500">{{ __('المبلغ المحصل') }}</p>
                    <p class="text-xl font-bold text-green-700" dir="ltr">{{ number_format($paid_amount / 100, 2) }} {{ __('ج.م') }}</p>
                </div>
                <div>
                    <p class="text-xs text-gray-500">{{ __('المشترك') }}</p>
                    <p class="font-medium text-gray-800">{{ $selected_participant_name }}</p>
                </div>
            </div>

            @if($last_payment_uuid)
            <div class="flex justify-center mt-4">
                <x-ui.print-receipt-button :route="route('receipts.payment.print', $last_payment_uuid)" size="lg" />
            </div>
            @endif

            <div class="flex items-center justify-center gap-4 mt-6">
                <a href="{{ route('receptionist.dashboard') }}" wire:navigate
                   class="inline-flex items-center gap-2 px-6 py-3 min-h-16 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 text-base font-medium transition-colors">
                    {{ __('العودة للاستقبال') }}
                </a>
                <a href="{{ route('receptionist.collect-payment') }}" wire:navigate
                   class="inline-flex items-center gap-2 px-6 py-3 min-h-16 bg-amber-600 text-white rounded-lg hover:bg-amber-700 text-base font-medium transition-colors">
                    {{ __('تحصيل آخر') }}
                </a>
            </div>

            {{-- Navigation Links --}}
            <div class="flex items-center justify-center gap-3 mt-4">
                @if($participant_uuid)
                <a href="{{ route('participants.show', $participant_uuid) }}" wire:navigate
                   class="inline-flex items-center gap-2 px-4 py-2.5 min-h-[44px] border border-blue-300 rounded-lg text-sm font-medium text-blue-700 hover:bg-blue-50 active:bg-blue-100 transition-colors">
                    <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="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
                    </svg>
                    {{ __('عرض المشترك') }}
                </a>
                @endif
                @if($invoice_uuid)
                <a href="{{ route('invoices.show', $invoice_uuid) }}" wire:navigate
                   class="inline-flex items-center gap-2 px-4 py-2.5 min-h-[44px] border border-gray-300 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 active:bg-gray-100 transition-colors">
                    <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 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
                    </svg>
                    {{ __('عرض الفاتورة') }}
                </a>
                @endif
            </div>
        </div>
        @endif
    </div>
</div>
