{% extends "base.html" %}
{% block title %}Deaths{% endblock %}
{% block page_title %}<i class="bi bi-heartbreak-fill me-2"></i>Deaths{% endblock %}
{% block content %}
<form method="get" class="row g-2 align-items-end mb-3">
    <div class="col-md-3">
        <input type="text" name="player" class="form-control form-control-sm" placeholder="Player…" value="{{ player }}">
    </div>
    <div class="col-md-3">
        <select name="cause" class="form-select form-select-sm">
            <option value="">All Causes</option>
            {% for c in causes %}<option {{ 'selected' if c == cause }}>{{ c }}</option>{% endfor %}
        </select>
    </div>
    <div class="col-auto">
        <button class="btn btn-success btn-sm">Filter</button>
        <a href="{{ url_for('panel.deaths') }}" class="btn btn-outline-secondary btn-sm ms-1">Reset</a>
    </div>
</form>
<div class="card">
    <div class="card-header">{{ total }} deaths</div>
    <div class="card-body p-0">
        <div class="table-responsive">
        <table class="table table-sm table-hover mb-0">
            <thead class="table-dark">
                <tr><th>Time</th><th>Player</th><th>Cause</th><th>Killer</th><th>Killer Type</th><th>Level</th><th>World</th><th>Death Message</th></tr>
            </thead>
            <tbody>
            {% for r in rows %}
            <tr>
                <td class="small text-muted text-nowrap">{{ r.timestamp | fmt_dt }}</td>
                <td class="small fw-semibold">{{ r.player_name }}</td>
                <td><span class="badge bg-danger">{{ r.cause or '—' }}</span></td>
                <td class="small">{{ r.killer_name or '—' }}</td>
                <td class="small text-muted">{{ r.killer_type or '—' }}</td>
                <td class="small">{{ r.exp_level }}</td>
                <td><span class="badge bg-secondary">{{ r.world }}</span></td>
                <td class="small text-muted">{{ r.death_message or '—' }}</td>
            </tr>
            {% else %}
            <tr><td colspan="8" class="text-center text-muted py-4">No deaths</td></tr>
            {% endfor %}
            </tbody>
        </table>
        </div>
    </div>
</div>
{% include "_pagination.html" %}
{% endblock %}
