@extends('layout.admin')

@section('content')
<div class="max-w-6xl mx-auto px-2 py-2">
    <h2 class="text-3xl font-bold mb-8 flex items-center gap-2 text-gray-800">
        🕒 Pending Jobs
    </h2>

    @if($jobs->isEmpty())
        <div class="text-center text-gray-500 py-10 text-lg">😴 কোনো Pending Job নেই!</div>
    @else
    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
        @foreach ($jobs as $job)
            <div class="bg-white rounded-2xl border border-gray-200 shadow-md hover:shadow-lg transition-all p-6 flex flex-col justify-between h-full">
                <div>
                    <h3 class="text-xl font-semibold text-gray-900 mb-2">{{ $job->title }}</h3>
                    <p class="text-gray-700 mb-3">{{ $job->description }}</p>

                    <div class="mb-3">
                        <a href="{{ $job->link }}" target="_blank"
                           class="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-blue-600 text-white font-semibold text-sm hover:bg-blue-700 transition">
                            <i class="fas fa-link"></i> Visit Link
                        </a>
                    </div>

                    <div class="grid grid-cols-2 gap-4 text-sm text-gray-600 mb-4">
                        <div class="bg-gray-50 rounded-lg p-3">
                            <span class="block text-xs text-gray-500">Amount</span>
                            <span class="font-bold text-gray-800">{{ $job->amount }}</span>
                        </div>
                        <div class="bg-gray-50 rounded-lg p-3">
                            <span class="block text-xs text-gray-500">Limit</span>
                            <span class="font-bold text-gray-800">{{ $job->limit }}</span>
                        </div>
                    </div>
                </div>

                {{-- এক লাইনে সমান বাটন --}}
                <div class="flex flex-row flex-nowrap gap-3 mt-auto">
                    <form action="{{ route('admin.jobs.approve', $job->id) }}" method="POST" class="flex-1">
                        @csrf
                        <button type="submit"
                                class="w-full inline-flex justify-center items-center gap-2 px-4 py-2 rounded-full bg-green-600 text-white font-semibold shadow hover:bg-green-700 transition">
                            <i class="fas fa-check"></i> Approve
                        </button>
                    </form>
                    <form action="{{ route('admin.jobs.reject', $job->id) }}" method="POST" class="flex-1">
                        @csrf
                        <button type="submit"
                                class="w-full inline-flex justify-center items-center gap-2 px-4 py-2 rounded-full bg-red-600 text-white font-semibold shadow hover:bg-red-700 transition">
                            <i class="fas fa-times"></i> Reject
                        </button>
                    </form>
                </div>
            </div>
        @endforeach
    </div>
    @endif
</div>
@endsection