{{-- admin/pages/jobs/index.blade.php --}}
@extends('admin.layouts.app')
@section('title','Jobs')
@section('page-title','Job Listings')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
    <div style="font-size:.82rem;color:#64748b">{{ $jobs->count() }} job listings</div>
    <a href="{{ route('admin.jobs.create') }}" class="btn btn-admin btn-sm px-3"><i class="bi bi-plus-lg me-1"></i>Post New Job</a>
</div>
<div class="card-admin">
    <table class="table table-hover mb-0">
        <thead><tr><th>#</th><th>Title</th><th>Department</th><th>Location</th><th>Type</th><th>Status</th><th style="width:100px">Actions</th></tr></thead>
        <tbody>
            @forelse($jobs as $job)
            <tr>
                <td class="text-muted">{{ $job->id }}</td>
                <td><div class="fw-600" style="color:#0f172a">{{ $job->title }}</div></td>
                <td><span style="font-size:.78rem;color:#64748b">{{ $job->department ?? '—' }}</span></td>
                <td><span style="font-size:.78rem;color:#64748b">{{ $job->location ?? '—' }}</span></td>
                <td><span style="font-size:.78rem;color:#64748b">{{ $job->job_type ?? '—' }}</span></td>
                <td><span class="badge" style="background:{{ $job->is_active ? '#f0fdf4' : '#fee2e2' }};color:{{ $job->is_active ? '#166534' : '#991b1b' }};font-size:.72rem">{{ $job->is_active ? 'Active' : 'Inactive' }}</span></td>
                <td>
                    <div class="d-flex gap-1">
                        <a href="{{ route('admin.jobs.edit', $job->id) }}" class="btn btn-sm" style="background:#eff6ff;color:#1d4ed8;border:none"><i class="bi bi-pencil"></i></a>
                        <form method="POST" action="{{ route('admin.jobs.destroy', $job->id) }}" onsubmit="return confirm('Delete?')">@csrf @method('DELETE')
                            <button class="btn btn-sm" style="background:#fee2e2;color:#991b1b;border:none"><i class="bi bi-trash"></i></button>
                        </form>
                    </div>
                </td>
            </tr>
            @empty
            <tr><td colspan="7" class="text-center py-4 text-muted">No jobs yet.</td></tr>
            @endforelse
        </tbody>
    </table>
</div>
@endsection
