<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
    @foreach ($submissions as $sub)
        @php
            function shortMask($value, $start = 4, $end = 4) {
                $len = strlen($value);
                return substr($value, 0, $start) . str_repeat('*', $len - ($start + $end)) . substr($value, -$end);
            }

            $uid = shortMask($sub->fb_uid, 4, 4);
            $email = shortMask($sub->fb_email, 3, 7);
            $fa = shortMask(decrypt($sub->fb_2fa), 3, 2);

            $badgeClasses = [
                'pending' => 'bg-yellow-100 text-yellow-800',
                'processing' => 'bg-blue-100 text-blue-800',
                'approved' => 'bg-green-100 text-green-800',
                'rejected' => 'bg-red-100 text-red-800',
            ];
        @endphp

        <div class="bg-white border rounded-xl shadow-sm p-4 relative hover:shadow-md transition-all">
            <div class="absolute top-3 right-3 text-xs px-2 py-1 rounded-full font-semibold {{ $badgeClasses[$sub->status] ?? 'bg-gray-100 text-gray-800' }}">
                {{ ucfirst($sub->status) }}
            </div>

            <div class="space-y-1 text-sm">
                <div class="flex items-center gap-2">
                    <i class="fa fa-id-card text-gray-500"></i>
                    <strong class="w-14">UID:</strong> <span class="truncate">{{ $uid }}</span>
                </div>
                <div class="flex items-center gap-2">
                    <i class="fa fa-envelope text-gray-500"></i>
                    <strong class="w-14">Email:</strong> <span class="truncate">{{ $email }}</span>
                </div>
                <div class="flex items-center gap-2">
                    <i class="fa fa-lock text-gray-500"></i>
                    <strong class="w-14">2FA:</strong> <span class="truncate">{{ $fa }}</span>
                </div>
                <div class="flex items-center gap-2 text-xs text-gray-600 mt-2">
                    <i class="fa fa-calendar text-gray-400"></i>
                    @if ($sub->created_at instanceof \Carbon\Carbon)
                        {{ $sub->created_at->format('d-m-Y h:i A') }}
                    @else
                        {{ \Carbon\Carbon::parse($sub->created_at)->format('d-m-Y h:i A') }}
                    @endif
                </div>
            </div>
        </div>
    @endforeach
</div>
