{% extends "core/base.html" %}
{% load static %}

{% block title %}Add Category - SwiftPOS{% endblock %}
{% block topbar_title %}New Expense Category{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-lg-8 col-xl-6">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <div>
                <h4 class="fw-bold mb-1">Create Category</h4>
                <div class="text-muted small">Define a new category for operating expenses</div>
            </div>
            <a href="{% url 'analytics:expense_category_list' %}" class="btn btn-outline-secondary btn-sm rounded-pill px-3">
                <i class="fas fa-arrow-left me-1"></i> Back
            </a>
        </div>
        
        <div class="card border-0 shadow-sm" style="border-radius: 16px;">
            <div class="card-body p-4">
                <form method="post">
                    {% csrf_token %}
                    
                    <div class="row g-4">
                        {% for field in form %}
                            <div class="col-12">
                                <label class="form-label small fw-bold text-dark mb-2" for="{{ field.id_for_label }}">
                                    {{ field.label }} {% if field.field.required %}<span class="text-danger">*</span>{% endif %}
                                </label>
                                
                                {{ field }}
                                
                                {% if field.help_text %}
                                    <div class="form-text small mt-1" style="color:var(--sp-text-muted);">{{ field.help_text }}</div>
                                {% endif %}
                                {% for error in field.errors %}
                                    <div class="text-danger small mt-1 fw-medium"><i class="fas fa-exclamation-circle me-1"></i>{{ error }}</div>
                                {% endfor %}
                            </div>
                        {% endfor %}
                    </div>
                    
                    <hr class="my-4" style="border-color: #eee;">
                    
                    <div class="d-flex justify-content-end gap-2">
                        <a href="{% url 'analytics:expense_category_list' %}" class="btn btn-light btn-sm rounded-pill px-4 text-dark fw-medium">Cancel</a>
                        <button type="submit" class="btn btn-primary btn-sm rounded-pill px-4 fw-medium shadow-sm">
                            <i class="fas fa-save me-1"></i> Save Category
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
