<div class="ml-[280px] min-h-screen p-6">

    <!-- HEADER -->
    <div class="flex justify-between items-center mb-6">
        <h2 class="text-2xl font-semibold">Job Openings</h2>

        <div class="flex items-center gap-3">
            <!-- SEARCH -->
            <input type="text" wire:model.debounce.500ms="search" placeholder="Search careers..."
                class="w-64 px-4 py-2 border rounded-lg text-sm
                       focus:ring-1 focus:ring-black focus:outline-none" />

            <!-- ADD -->
            <a href="/console/job-openings/create"
               class="px-5 py-2 rounded-lg bg-black text-white text-sm hover:bg-gray-800">
                + Add Career
            </a>
        </div>
    </div>

    <!-- SUCCESS MESSAGE -->
    @if (session()->has('success'))
        <div
            class="mb-4 px-4 py-3 rounded-lg
                    bg-green-50 border border-green-200
                    text-green-700 text-sm font-medium">
            {{ session('success') }}
        </div>
    @endif

    <!-- TABLE -->
    <div class="bg-white border rounded-xl overflow-hidden">
        <table class="w-full text-sm">
            <thead class="bg-gray-50 border-b text-gray-600">
                <tr class="text-left">
                    <th class="px-4 py-3">Role</th>
                    <th class="px-4 py-3">Experience</th>
                    <th class="px-4 py-3">Location</th>
                    <th class="px-4 py-3">Status</th>
                    <th class="px-4 py-3 text-right">Action</th>
                </tr>
            </thead>

            <tbody>
                @forelse($careers as $career)
                    <tr class="border-b hover:bg-gray-50 align-top">

                        <!-- ROLE -->
                        <td class="px-4 py-3">
                            <div class="leading-tight">
                                <p class="font-semibold text-gray-900">
                                    {{ $career->title }}
                                </p>
                                <p class="text-xs text-gray-400 mt-0.5">
                                    Slug: {{ $career->slug }}
                                </p>
                            </div>
                        </td>

                        <!-- EXPERIENCE -->
                        <td class="px-4 py-3 text-gray-600">
                            {{ $career->experience }}
                        </td>

                        <!-- LOCATION -->
                        <td class="px-4 py-3">
                            {{ $career->location }}
                        </td>

                        <!-- STATUS -->
                        <td class="px-4 py-3">
                            <span
                                class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold
                                {{ $career->status ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500' }}">
                                {{ $career->status ? 'Active' : 'Inactive' }}
                            </span>
                        </td>

                        <!-- ACTION -->
                        <td class="px-4 py-3 text-right">
                            <div class="inline-flex items-center gap-4 text-sm">

                                <!-- VIEW -->
                                <a href="/careers/{{ $career->slug }}" target="_blank"
                                   class="flex items-center gap-1.5 text-gray-600 hover:text-black transition font-medium">
                                    👁 View
                                </a>

                                <!-- EDIT -->
                                <a href="/console/job-openings/{{ $career->id }}/edit"
                                   class="flex items-center gap-1.5 text-blue-600 hover:text-blue-800 transition font-medium">
                                    ✏️ Edit
                                </a>

                            </div>
                        </td>

                    </tr>
                @empty
                    <tr>
                        <td colspan="5" class="px-4 py-8 text-center text-gray-400">
                            No careers found
                        </td>
                    </tr>
                @endforelse
            </tbody>
        </table>
    </div>

</div>
