{% extends "base.html" %}

{% block title %}Players - Pickleball ELO Tracker{% endblock %}

{% block content %}
<h1 class="pitt-primary text-4xl font-bold mb-8 text-center">👥 Players</h1>

{% include "components/nav.html" %}

{% if players.is_empty() %}
    <div class="alert-info">
        No players yet. <a href="/players/new" class="font-bold hover:underline">Add the first player</a>!
    </div>
{% else %}
    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
        {% for player in players %}
        <div class="card">
            <h3 class="pitt-primary font-bold text-xl mb-2">
                <a href="/players/{{ player.id }}" class="hover:underline">{{ player.name }}</a>
            </h3>
            <div class="text-3xl font-bold pitt-primary mb-4">{{ player.rating_display }}</div>
            {% if player.has_email %}
                <p class="text-sm text-gray-600">📧 {{ player.email }}</p>
            {% endif %}
            <div class="flex gap-2 mt-4">
                <a href="/players/{{ player.id }}" class="btn-primary text-sm">View Profile</a>
                <a href="/players/{{ player.id }}/edit" class="btn-warning text-sm">Edit</a>
            </div>
        </div>
        {% endfor %}
    </div>
{% endif %}
{% endblock %}
