<div>
    <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4 sm:mb-6">
        <h1 class="text-xl sm:text-2xl font-bold text-gray-800">{{ __('تسجيل إيراد خارجي') }}</h1>
        <a href="{{ route('financial.overview') }}" wire:navigate
           class="inline-flex items-center gap-1 text-sm text-gray-600 hover:text-gray-800">
            <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="M11 17l-5-5m0 0l5-5m-5 5h12"/></svg>
            {{ __('النظرة المالية') }}
        </a>
    </div>

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

    <form wire:submit="save" class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 sm:p-6">
        <div class="grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6">
            {{-- Source --}}
            <div>
                <label class="block text-sm text-gray-600 mb-1">{{ __('مصدر الإيراد') }} <span class="text-red-500">*</span></label>
                <input type="text" wire:model="source"
                       class="w-full rounded-lg border-gray-300 text-sm py-2.5"
                       placeholder="{{ __('مثال: النادي الأهلي، شركة راعية') }}">
                @error('source') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
            </div>

            {{-- Amount --}}
            <div>
                <label class="block text-sm text-gray-600 mb-1">{{ __('المبلغ (ج.م)') }} <span class="text-red-500">*</span></label>
                <input type="number" wire:model="amount_display" dir="ltr" step="0.01" min="0"
                       class="w-full rounded-lg border-gray-300 text-sm py-2.5" placeholder="0.00">
                @error('amount_display') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
            </div>

            {{-- Description --}}
            <div class="md:col-span-2">
                <label class="block text-sm text-gray-600 mb-1">{{ __('الوصف') }} <span class="text-red-500">*</span></label>
                <input type="text" wire:model="description"
                       class="w-full rounded-lg border-gray-300 text-sm py-2.5"
                       placeholder="{{ __('مثال: دفعة النادي عن شهر يوليو') }}">
                @error('description') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
            </div>

            {{-- Payment Method --}}
            <div class="md:col-span-2">
                <label class="block text-sm text-gray-600 mb-2">{{ __('طريقة الاستلام') }} <span class="text-red-500">*</span></label>
                <div class="grid grid-cols-2 sm:grid-cols-5 gap-2">
                    <label class="relative cursor-pointer">
                        <input type="radio" wire:model="payment_method" value="cash" class="peer sr-only">
                        <div class="peer-checked:ring-2 peer-checked:ring-green-500 peer-checked:border-green-500 peer-checked:bg-green-50 flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 border-gray-200 hover:border-green-300 transition-all">
                            <svg class="w-7 h-7 text-green-600" 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-xs font-medium text-gray-700">{{ __('كاش') }}</span>
                        </div>
                    </label>
                    <label class="relative cursor-pointer">
                        <input type="radio" wire:model="payment_method" value="bank_transfer" class="peer sr-only">
                        <div class="peer-checked:ring-2 peer-checked:ring-purple-500 peer-checked:border-purple-500 peer-checked:bg-purple-50 flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 border-gray-200 hover:border-purple-300 transition-all">
                            <svg class="w-7 h-7 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 14v3m4-3v3m4-3v3M3 21h18M3 10h18M3 7l9-4 9 4M4 10h16v11H4V10z"/>
                            </svg>
                            <span class="text-xs font-medium text-gray-700">{{ __('تحويل بنكي') }}</span>
                        </div>
                    </label>
                    <label class="relative cursor-pointer">
                        <input type="radio" wire:model="payment_method" value="cheque" class="peer sr-only">
                        <div class="peer-checked:ring-2 peer-checked:ring-amber-500 peer-checked:border-amber-500 peer-checked:bg-amber-50 flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 border-gray-200 hover:border-amber-300 transition-all">
                            <svg class="w-7 h-7 text-amber-600" 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>
                            <span class="text-xs font-medium text-gray-700">{{ __('شيك') }}</span>
                        </div>
                    </label>
                    <label class="relative cursor-pointer">
                        <input type="radio" wire:model="payment_method" value="other" class="peer sr-only">
                        <div class="peer-checked:ring-2 peer-checked:ring-gray-500 peer-checked:border-gray-500 peer-checked:bg-gray-50 flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 border-gray-200 hover:border-gray-300 transition-all">
                            <svg class="w-7 h-7 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z"/>
                            </svg>
                            <span class="text-xs font-medium text-gray-700">{{ __('أخرى') }}</span>
                        </div>
                    </label>
                </div>
                @error('payment_method') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
            </div>

            {{-- Reference Number --}}
            <div>
                <label class="block text-sm text-gray-600 mb-1">{{ __('رقم المرجع / الإيصال') }}</label>
                <input type="text" wire:model="reference_number" dir="ltr"
                       class="w-full rounded-lg border-gray-300 text-sm py-2.5">
                @error('reference_number') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
            </div>

            {{-- Date --}}
            <div>
                <label class="block text-sm text-gray-600 mb-1">{{ __('تاريخ الإيراد') }} <span class="text-red-500">*</span></label>
                <input type="date" wire:model="revenue_date" dir="ltr"
                       class="w-full rounded-lg border-gray-300 text-sm py-2.5">
                @error('revenue_date') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
            </div>

            {{-- Notes --}}
            <div class="md:col-span-2">
                <label class="block text-sm text-gray-600 mb-1">{{ __('ملاحظات') }}</label>
                <textarea wire:model="notes" rows="2"
                          class="w-full rounded-lg border-gray-300 text-sm py-2.5"
                          placeholder="{{ __('أي تفاصيل إضافية...') }}"></textarea>
            </div>
        </div>

        {{-- Submit --}}
        <div class="mt-6 flex justify-end">
            <button type="submit" wire:loading.attr="disabled" wire:target="save"
                    class="inline-flex items-center gap-2 px-6 py-2.5 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700 transition text-sm font-medium disabled:opacity-50">
                <span wire:loading.remove wire:target="save">{{ __('تسجيل الإيراد') }}</span>
                <span wire:loading wire:target="save">{{ __('جارٍ الحفظ...') }}</span>
            </button>
        </div>
    </form>
</div>
