<x-app-layout title="Contact groups">
    <div class="mx-auto max-w-xl">
        <h1 class="text-xl font-semibold text-slate-900">Contact groups</h1>
        <p class="mt-1 text-sm text-slate-600">Reusable invite lists for {{ $organization->name }}</p>

        <form method="POST" action="{{ route('meet.contacts.groups.store') }}" class="mt-6 space-y-4 rounded-2xl border border-slate-200 bg-white p-6">
            @csrf
            <div>
                <label class="block text-sm font-medium text-slate-700">Group name</label>
                <input type="text" name="name" required class="mt-1 w-full rounded-lg border-slate-300 text-sm">
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700">Emails (comma-separated)</label>
                <textarea name="emails" rows="3" class="mt-1 w-full rounded-lg border-slate-300 text-sm"></textarea>
            </div>
            <button type="submit" class="btn-primary w-full">Create group</button>
        </form>

        <ul class="mt-6 divide-y divide-slate-100 rounded-2xl border border-slate-200 bg-white">
            @forelse ($groups as $group)
                <li class="px-6 py-4 text-sm">
                    <p class="font-medium text-slate-900">{{ $group->name }}</p>
                    <p class="text-slate-500">{{ $group->members_count }} contacts</p>
                </li>
            @empty
                <li class="px-6 py-8 text-center text-slate-500">No contact groups yet.</li>
            @endforelse
        </ul>
    </div>
</x-app-layout>
