<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
    <div class="p-4 sm:p-6 border-b border-gray-200 flex flex-col sm:flex-row sm:items-center justify-between gap-2">
        <h3 class="text-base sm:text-lg font-semibold text-gray-800">{{ __('سجل التسجيل') }} ({{ $totalCount }})</h3>
    </div>

    @if($enrollments->isEmpty())
    <div class="p-8 text-center text-sm text-gray-500">{{ __('لا يوجد تسجيلات') }}</div>
    @else
    <div class="divide-y divide-gray-100">
        @foreach($enrollments as $enrollment)
        <div class="p-3 sm:p-4 hover:bg-gray-50">
            <div class="flex items-start sm:items-center justify-between gap-2">
                <div class="min-w-0 flex-1">
                    <p class="text-sm font-medium text-gray-800 truncate">
                        {{ $enrollment->trainingGroup?->program?->name_ar ?? '-' }}
                    </p>
                    <p class="text-xs text-gray-500 mt-1">
                        {{ $enrollment->trainingGroup?->name_ar ?? '-' }}
                        &bull; <span dir="ltr">{{ $enrollment->created_at->format('Y-m-d') }}</span>
                    </p>
                </div>
                <span class="px-2 py-1 text-xs rounded-full font-medium shrink-0
                    @switch($enrollment->status)
                        @case('active') bg-green-100 text-green-700 @break
                        @case('completed') bg-blue-100 text-blue-700 @break
                        @case('cancelled') bg-red-100 text-red-700 @break
                        @case('expired') bg-gray-100 text-gray-600 @break
                        @case('pending') bg-yellow-100 text-yellow-700 @break
                        @case('waitlisted') bg-purple-100 text-purple-700 @break
                        @default bg-gray-100 text-gray-600
                    @endswitch
                ">{{ __($enrollment->status) }}</span>
            </div>
        </div>
        @endforeach
    </div>

    @if($totalCount > 5)
    <div class="p-3 border-t border-gray-200 text-center">
        <button wire:click="toggleShowAll" class="text-sm text-blue-600 hover:text-blue-800 py-2">
            {{ $showAll ? __('عرض أقل') : __('عرض الكل') . " ({$totalCount})" }}
        </button>
    </div>
    @endif
    @endif
</div>
