@component('admin/layouts/main')
  @slot('main')
    <h1 class="text-2xl font-bold mb-6">{{ category ? 'Modifier la catégorie' : 'Nouvelle catégorie' }}</h1>
    <form action="{{ category ? `/admin/categories/${category.id}` : '/admin/categories' }}" method="post" class="bg-white p-6 rounded shadow max-w-xl">
      {{{ csrfField() }}}
      <div class="space-y-4">
        <div>
          <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Nom</label>
          <input type="text" name="name" id="name" value="{{ category?.name || '' }}" required
            class="w-full px-3 py-2 border rounded" />
        </div>
        <button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
          Enregistrer
        </button>
      </div>
    </form>
  @endslot
@end
