{% extends "layouts/base.html" %}
{% load i18n static %}

{% block title %}{% trans "Appreciation Categories" %} - {% endblock %}

{% block content %}
<div class="container-fluid py-4">
    <!-- Breadcrumb -->
    <nav aria-label="breadcrumb" class="mb-4">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'appreciation:appreciation_list' %}">{% trans "Appreciation" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% trans "Categories" %}</li>
        </ol>
    </nav>

    <!-- Page Header -->
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h2>
            <i class="bi bi-tags text-primary me-2"></i>
            {% trans "Appreciation Categories" %}
        </h2>
        <a href="{% url 'appreciation:category_create' %}" class="btn btn-primary">
            <i class="bi-plus me-2"></i>
            {% trans "Add Category" %}
        </a>
    </div>

    <!-- Categories List -->
    <div class="card shadow-sm">
        <div class="card-body">
            {% if categories %}
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead class="table-light">
                            <tr>
                                <th>{% trans "Icon" %}</th>
                                <th>{% trans "Name (English)" %}</th>
                                <th>{% trans "Name (Arabic)" %}</th>
                                <th>{% trans "Color" %}</th>
                                <th>{% trans "Count" %}</th>
                                <th class="text-center">{% trans "Actions" %}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for category in categories %}
                                <tr>
                                    <td>
                                        <i class="{{ category.icon }} fa-2x text-primary"></i>
                                    </td>
                                    <td>{{ category.name_en }}</td>
                                    <td dir="rtl">{{ category.name_ar }}</td>
                                    <td>
                                        <span class="badge bg-{{ category.color }}">
                                            {{ category.get_color_display }}
                                        </span>
                                    </td>
                                    <td>{{ category.appreciation_count }}</td>
                                    <td class="text-center">
                                        <a href="{% url 'appreciation:category_edit' category.id %}" class="btn btn-sm btn-outline-primary">
                                            <i class="bi-pencil"></i>
                                        </a>
                                        <a href="{% url 'appreciation:category_delete' category.id %}" class="btn btn-sm btn-outline-danger">
                                            <i class="bi-trash"></i>
                                        </a>
                                    </td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            {% else %}
                <div class="text-center py-5">
                    <i class="bi bi-tags fa-4x text-muted mb-3"></i>
                    <h4 class="text-muted">{% trans "No categories found" %}</h4>
                    <p class="text-muted mb-3">{% trans "Create categories to organize appreciations" %}</p>
                    <a href="{% url 'appreciation:category_create' %}" class="btn btn-primary">
                        <i class="bi-plus me-2"></i>
                        {% trans "Add Category" %}
                    </a>
                </div>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}
