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

{% block title %}Social Mention - PX360{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="mb-3">
        <a href="{% url 'social:mention_list' %}" class="btn btn-outline-secondary btn-sm">
            <i class="bi bi-arrow-left me-1"></i> Back to Mentions
        </a>
    </div>

    <div class="row">
        <div class="col-lg-8">
            <div class="card">
                <div class="card-header">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <span class="badge bg-primary">{{ mention.get_platform_display }}</span>
                            {% if mention.sentiment == 'positive' %}
                            <span class="badge bg-success">Positive</span>
                            {% elif mention.sentiment == 'negative' %}
                            <span class="badge bg-danger">Negative</span>
                            {% else %}
                            <span class="badge bg-secondary">Neutral</span>
                            {% endif %}
                        </div>
                        <small class="text-muted">{{ mention.posted_at|date:"M d, Y H:i" }}</small>
                    </div>
                </div>
                <div class="card-body">
                    <h6 class="mb-3">@{{ mention.author_username }}</h6>
                    <p class="mb-4">{{ mention.content }}</p>
                    
                    <div class="d-flex gap-4 mb-3">
                        <div>
                            <i class="bi bi-heart text-danger"></i> {{ mention.likes_count }} Likes
                        </div>
                        <div>
                            <i class="bi bi-share text-primary"></i> {{ mention.shares_count }} Shares
                        </div>
                        <div>
                            <i class="bi bi-chat text-success"></i> {{ mention.comments_count }} Comments
                        </div>
                    </div>
                    
                    <a href="{{ mention.post_url }}" target="_blank" class="btn btn-outline-primary">
                        <i class="bi bi-box-arrow-up-right me-1"></i> View Original Post
                    </a>
                </div>
            </div>
        </div>

        <div class="col-lg-4">
            <div class="card mb-3">
                <div class="card-header">
                    <h6 class="mb-0"><i class="bi bi-graph-up me-2"></i>{% trans "Sentiment Analysis" %}</h6>
                </div>
                <div class="card-body">
                    {% if mention.sentiment_score %}
                    <h3 class="mb-2 {% if mention.sentiment == 'positive' %}text-success{% elif mention.sentiment == 'negative' %}text-danger{% endif %}">
                        {{ mention.sentiment_score|floatformat:2 }}
                    </h3>
                    <p class="text-muted mb-0">Sentiment Score</p>
                    {% else %}
                    <p class="text-muted">Not analyzed yet</p>
                    {% endif %}
                </div>
            </div>
            
            {% if mention.px_action %}
            <div class="card">
                <div class="card-header bg-warning text-dark">
                    <h6 class="mb-0"><i class="bi bi-lightning me-2"></i>{% trans "PX Action" %}</h6>
                </div>
                <div class="card-body">
                    <p class="mb-2">Action created from this mention</p>
                    <a href="{% url 'actions:action_detail' mention.px_action.id %}" class="btn btn-sm btn-outline-primary">
                        View Action
                    </a>
                </div>
            </div>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}
