{% extends 'base.html' %}

{% block content %}
<main class="container py-5">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <h1 class="text-center mb-5 fw-bold">Լավագույն 10 Խաղացողները</h1>
            
            <div class="card shadow-lg p-4 border-0 rounded-4">
                <div class="table-responsive">
                    <table class="table table-hover align-middle">
                        <thead class="bg-light">
                            <tr>
                                <th class="py-3">#</th>
                                <th class="py-3">Խաղացող</th>
                                <th class="py-3">Միավոր</th>
                                <th class="py-3">Մակարդակ</th>
                                <th class="py-3">Ամսաթիվ</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for score in top_scores %}
                            <tr>
                                <td class="fw-bold text-primary">{{ forloop.counter }}</td>
                                <td class="fw-bold">{{ score.player_name }}</td>
                                <td><span class="badge bg-success px-3 py-2 fs-6">{{ score.score }}</span></td>
                                <td class="text-muted">{{ score.level.title }}</td>
                                <td class="text-muted">{{ score.date_played|date:"d.m.Y" }}</td>
                            </tr>
                            {% empty %}
                            <tr>
                                <td colspan="5" class="text-center py-4 text-muted">Արդյունքներ դեռ չկան: Եղիր առաջինը!</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="text-center mt-5">
                <a href="{% url 'index' %}" class="btn btn-primary btn-lg px-5 rounded-pill shadow">Խաղալ հիմա</a>
            </div>
        </div>
    </div>
</main>
{% endblock %}
