<x-app-layout>
    <x-slot name="header">
        <div>
            <p class="text-sm font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-400">Growth & Marketing</p>
            <h2 class="mt-1 text-2xl font-bold text-slate-950 dark:text-white">Mentor Settings</h2>
        </div>
    </x-slot>

    <div class="space-y-8">
        <section class="rounded-lg border border-blue-100 bg-white p-6 shadow-sm dark:border-blue-900/50 dark:bg-slate-900">
            <form method="POST" action="{{ route('admin.mentor-settings.update') }}" class="grid gap-4 md:grid-cols-3">
                @csrf
                @method('PATCH')
                <label class="flex items-center gap-2 text-sm font-semibold text-slate-600 dark:text-slate-300"><input type="checkbox" name="mentor_system_enabled" value="1" @checked($settings->mentor_system_enabled) class="rounded border-gray-300 text-blue-600"> Enable mentor system</label>
                <div>
                    <x-input-label value="Mentor Plan Price Placeholder" />
                    <x-text-input name="mentor_plan_price" type="number" step="0.01" class="mt-1 block w-full" value="{{ $settings->mentor_plan_price }}" required />
                </div>
                <div>
                    <x-input-label value="Maximum Students Per Plan" />
                    <x-text-input name="max_students_per_plan" type="number" class="mt-1 block w-full" value="{{ $settings->max_students_per_plan }}" required />
                </div>
                <button class="rounded-lg bg-blue-600 px-4 py-2 text-sm font-bold text-white md:col-span-3">Save Mentor Settings</button>
            </form>
        </section>

        <section class="rounded-lg border border-blue-100 bg-white shadow-sm dark:border-blue-900/50 dark:bg-slate-900">
            <div class="border-b border-blue-100 p-6 dark:border-blue-900/50">
                <h3 class="text-lg font-bold text-slate-950 dark:text-white">Mentors</h3>
            </div>
            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-blue-100 dark:divide-blue-900/50">
                    <thead class="bg-blue-50 dark:bg-blue-950/40">
                        <tr>
                            <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Mentor</th>
                            <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Status</th>
                            <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Students</th>
                            <th class="px-4 py-3 text-right text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Actions</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-blue-50 dark:divide-blue-900/40">
                        @forelse ($mentors as $mentor)
                            <tr>
                                <td class="px-4 py-4 text-sm font-bold text-slate-950 dark:text-white">{{ $mentor->name }}<br><span class="font-normal text-slate-500 dark:text-slate-400">{{ $mentor->email }}</span></td>
                                <td class="px-4 py-4 text-sm capitalize text-slate-600 dark:text-slate-300">{{ $mentor->status }}</td>
                                <td class="px-4 py-4 text-sm text-slate-600 dark:text-slate-300">{{ $mentor->mentor_students_count }}</td>
                                <td class="px-4 py-4 text-right">
                                    <div class="flex justify-end gap-2">
                                        <form method="POST" action="{{ route('admin.mentor-settings.users.approve', $mentor) }}">@csrf @method('PATCH')<button class="rounded-lg bg-blue-600 px-3 py-2 text-xs font-bold text-white">Approve</button></form>
                                        <form method="POST" action="{{ route('admin.mentor-settings.users.block', $mentor) }}">@csrf @method('PATCH')<button class="rounded-lg bg-red-600 px-3 py-2 text-xs font-bold text-white">Block</button></form>
                                    </div>
                                </td>
                            </tr>
                        @empty
                            <tr><td colspan="4" class="px-4 py-10 text-center text-sm text-slate-500 dark:text-slate-400">No mentors yet.</td></tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
            <div class="p-4">{{ $mentors->links() }}</div>
        </section>
    </div>
</x-app-layout>
