{% load i18n %}
{% if sentiment %}
<div class="card border-{{ badge_class|slice:'3:' }}">
    <div class="card-body">
        <h6 class="card-title">{% trans "AI Sentiment Analysis" %}</h6>
        <div class="text-center mb-3">
            <h1 class="display-4">{{ icon }}</h1>
            <h5 class="{{ badge_class|slice:'3:' }}">
                {% if sentiment.sentiment == 'positive' %}
                    {% trans "Positive" %}
                {% elif sentiment.sentiment == 'negative' %}
                    {% trans "Negative" %}
                {% else %}
                    {% trans "Neutral" %}
                {% endif %}
            </h5>
        </div>
        <dl class="row mb-0">
            <dt class="col-sm-5">{% trans "Score" %}:</dt>
            <dd class="col-sm-7">{{ score_formatted }}</dd>
            
            <dt class="col-sm-5">{% trans "Confidence" %}:</dt>
            <dd class="col-sm-7">{{ confidence_formatted }}</dd>
            
            {% if sentiment.keywords %}
            <dt class="col-sm-5">{% trans "Keywords" %}:</dt>
            <dd class="col-sm-7">
                {% for keyword in sentiment.keywords|slice:":5" %}
                    <span class="badge bg-primary me-1">{{ keyword }}</span>
                {% endfor %}
            </dd>
            {% endif %}
        </dl>
        <a href="{% url 'ai_engine:sentiment_detail' sentiment.id %}" class="btn btn-sm btn-outline-primary mt-2">
            {% trans "View Details" %}
        </a>
    </div>
</div>
{% endif %}
