<div>
    @if($participant->status === 'active')
    <button wire:click="openFreeze" class="px-3 py-2.5 text-xs bg-blue-100 text-blue-700 rounded-lg hover:bg-blue-200">
        {{ __('تجميد') }}
    </button>
    @elseif($participant->status === 'frozen')
    <button wire:click="openUnfreeze" class="px-3 py-2.5 text-xs bg-green-100 text-green-700 rounded-lg hover:bg-green-200">
        {{ __('إلغاء التجميد') }}
    </button>
    @endif

    @if($showModal)
    <div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" wire:click.self="$set('showModal', false)">
        <div class="bg-white rounded-xl shadow-xl w-full max-w-md p-4 sm:p-6">
            <div class="flex items-center justify-between mb-4">
                <h3 class="text-lg font-bold text-gray-800">
                    {{ $action === 'freeze' ? __('تجميد المشترك') : __('إلغاء تجميد المشترك') }}
                </h3>
                <button wire:click="$set('showModal', false)" class="flex items-center justify-center w-8 h-8 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 active:bg-gray-200 transition-colors" aria-label="إغلاق">
                    <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="M6 18L18 6M6 6l12 12"/></svg>
                </button>
            </div>
            <p class="text-sm text-gray-600 mb-4">
                {{ $action === 'freeze'
                    ? __('سيتم تعليق جميع الأنشطة للمشترك. يمكن إلغاء التجميد لاحقاً.')
                    : __('سيتم إعادة تنشيط المشترك واستئناف أنشطته.')
                }}
            </p>
            <div class="mb-4">
                <label class="block text-sm text-gray-600 mb-1">{{ __('السبب') }} *</label>
                <textarea wire:model="reason" rows="3" class="w-full rounded-lg border-gray-300 text-sm py-2.5"
                          placeholder="{{ __('أدخل سبب الإجراء') }}"></textarea>
                @error('reason') <p class="text-xs text-red-500 mt-1">{{ $message }}</p> @enderror
            </div>
            <div class="flex flex-col-reverse sm:flex-row gap-3 sm:justify-end">
                <button wire:click="$set('showModal', false)" class="w-full sm:w-auto px-4 py-2.5 text-sm text-gray-600 hover:text-gray-800 active:bg-gray-200 rounded-lg">
                    {{ __('إلغاء') }}
                </button>
                <button wire:click="confirm" wire:loading.attr="disabled"
                        class="w-full sm:w-auto px-4 py-2.5 text-sm text-white rounded-lg {{ $action === 'freeze' ? 'bg-blue-600 hover:bg-blue-700 active:bg-blue-800' : 'bg-green-600 hover:bg-green-700 active:bg-green-800' }} disabled:opacity-50">
                    <span wire:loading.remove wire:target="confirm">{{ __('تأكيد') }}</span>
                    <span wire:loading wire:target="confirm">{{ __('جارٍ...') }}</span>
                </button>
            </div>
        </div>
    </div>
    @endif
</div>
