{% extends "base.html" %}

{% block title %}{% if editing %}Edit{% else %}Add{% endif %} Player - Pickleball ELO Tracker{% endblock %}

{% block content %}
<div class="max-w-2xl mx-auto">
    <h1 class="pitt-primary text-4xl font-bold mb-8 text-center">{% if editing %}✏️ Edit Player{% else %}➕ Add Player{% endif %}</h1>
    
    {% include "components/nav.html" %}
    
    <form method="post" class="card">
        <div class="mb-6">
            <label class="block font-bold pitt-primary mb-2">Player Name</label>
            <input type="text" name="name" class="form-input" placeholder="e.g., Andrew" required>
        </div>
        
        <div class="mb-6">
            <label class="block font-bold pitt-primary mb-2">Email (Optional)</label>
            <input type="email" name="email" class="form-input" placeholder="andrew@example.com">
        </div>
        
        {% if editing %}
        <div class="mb-6">
            <label class="block font-bold pitt-primary mb-2">ELO Rating</label>
            <input type="number" name="singles_rating" class="form-input" step="0.1" required>
            <p class="text-sm text-gray-600 mt-2">This is the unified rating for all match types.</p>
        </div>
        {% endif %}
        
        <div class="flex gap-4">
            <button type="submit" class="btn-success flex-1">{% if editing %}💾 Save Changes{% else %}✅ Add Player{% endif %}</button>
            <a href="/players" class="btn-primary flex-1 text-center">Cancel</a>
        </div>
    </form>
</div>
{% endblock %}
