{% extends 'base.html' %}
{% load form_tags %}
{% block title %}Add Category{% endblock %}

{% block content %}
<div class="flex justify-between items-center mb-6">
  <h1 class="text-2xl font-bold">Add Category</h1>
  <a href="{% url 'inventory:category_list' %}" class="btn btn-ghost btn-sm">← Back</a>
</div>

<div class="card bg-base-100 shadow max-w-md">
  <div class="card-body">
    <form method="post">
      {% csrf_token %}
      {% for field in form %}
        <div class="form-control mb-3">
          <label class="label">
            <span class="label-text">{{ field.label }}</span>
          </label>
          {{ field|daisyui }}
          {% for error in field.errors %}
            <span class="text-error text-sm">{{ error }}</span>
          {% endfor %}
        </div>
      {% endfor %}
      <div class="card-actions justify-end mt-4">
        <a href="{% url 'inventory:category_list' %}" class="btn btn-ghost">Cancel</a>
        <button type="submit" class="btn btn-primary">💾 Save</button>
      </div>
    </form>
  </div>
</div>
{% endblock %}