{% extends "admin/base.html" %}

{% block title %}Stats Management{% endblock %}

{% block extra_styles %}
<style>
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 24px;
    }
    .stat-card {
        background: #1a1a1a;
        border: 1px solid #333;
        border-radius: 16px;
        padding: 24px;
    }
    .stat-card-header {
        font-family: var(--font-display);
        font-size: 20px;
        color: var(--white);
        margin-bottom: 16px;
    }
    .form-group {
        margin-bottom: 16px;
    }
    .form-label {
        display: block;
        color: var(--gray-300);
        margin-bottom: 6px;
        font-family: var(--font-body);
        font-size: 14px;
    }
    .form-input {
        width: 100%;
        padding: 10px 12px;
        background: #0d0d0d;
        border: 1px solid #333;
        border-radius: 8px;
        color: #fff;
        font-size: 14px;
    }
    .form-input:focus {
        outline: none;
        border-color: #3b82f6;
    }
    .btn {
        padding: 10px 20px;
        border-radius: 8px;
        border: none;
        font-family: var(--font-body);
        font-size: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .btn-primary {
        background: var(--blue);
        color: var(--white);
    }
    .btn-primary:hover {
        background: var(--blue-light);
        transform: translateY(-2px);
    }
</style>
{% endblock %}

{% block content %}
<h1 class="admin-header">Stats Management</h1>

<div class="stats-grid">
    {% for stat in stats %}
    <div class="stat-card">
        <h3 class="stat-card-header">{{ stat.key }}</h3>
        <form method="POST" action="{{ url_for('update_stat') }}">
            <input type="hidden" name="id" value="{{ stat.id }}">
            <div class="form-group">
                <label class="form-label">Value</label>
                <input type="text" name="value" class="form-input" value="{{ stat.value }}" required>
            </div>
            <div class="form-group">
                <label class="form-label">Label</label>
                <input type="text" name="label" class="form-input" value="{{ stat.label }}" required>
            </div>
            <button type="submit" class="btn btn-primary">Update</button>
        </form>
    </div>
    {% endfor %}
</div>
{% endblock %}
