{% load i18n %}
<!-- Stat Cards Partial -->
<div class="row g-3 mb-4">
    {% for stat in stats %}
    <div class="col-md-6 col-lg-3">
        <div class="card stat-card border-start border-{{ stat.color|default:'primary' }} border-4">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-start">
                    <div>
                        <div class="stat-label">{{ stat.label }}</div>
                        <div class="stat-value text-{{ stat.color|default:'primary' }}">
                            {{ stat.value }}
                        </div>
                        {% if stat.change %}
                        <small class="text-{% if stat.change > 0 %}success{% else %}danger{% endif %}">
                            <i class="bi bi-arrow-{% if stat.change > 0 %}up{% else %}down{% endif %}"></i>
                            {% if stat.change < 0 %}{{ stat.change|slice:"1:" }}{% else %}{{ stat.change }}{% endif %}%
                            {{ _("from last period")}}
                        </small>
                        {% endif %}
                    </div>
                    <div class="rounded-circle bg-{{ stat.color|default:'primary' }} bg-opacity-10 p-3">
                        <i class="bi bi-{{ stat.icon }} fs-4 text-{{ stat.color|default:'primary' }}"></i>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% endfor %}
</div>
