{% extends "group_admin/base.html" %}
{% block title %}Delete Player Data{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-12 col-md-7 col-lg-6">
        <div class="card border-danger">
            <div class="card-header bg-danger bg-opacity-75 fw-bold">
                <i class="bi bi-exclamation-triangle-fill me-2"></i>Permanently Delete Player Data
            </div>
            <div class="card-body">
                <p class="mb-3">
                    You are about to <strong>permanently delete all logged data</strong> for:
                </p>

                <div class="alert alert-secondary d-flex align-items-center gap-3 py-2">
                    <img src="https://minotar.net/avatar/{{ player.username }}/48"
                         class="rounded" alt="{{ player.username }}" width="48" height="48"
                         onerror="this.onerror=null;this.src='data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'48\' height=\'48\' viewBox=\'0 0 48 48\'%3E%3Crect width=\'48\' height=\'48\' rx=\'6\' fill=\'%23374151\'/%3E%3Ctext x=\'50%25\' y=\'54%25\' text-anchor=\'middle\' dominant-baseline=\'middle\' font-size=\'22\' font-family=\'monospace\' fill=\'%239ca3af\'%3E%3F%3C/text%3E%3C/svg%3E'">
                    <div>
                        <div class="fw-bold">{{ player.username }}</div>
                        <div class="text-muted small font-monospace">{{ player.uuid }}</div>
                    </div>
                </div>

                <p class="text-danger fw-semibold mt-3 mb-1">
                    <i class="bi bi-exclamation-circle-fill me-1"></i>This action cannot be undone.
                </p>
                <ul class="text-muted small mb-4">
                    <li>Sessions, chat, commands, deaths, teleports</li>
                    <li>Block events, proxy events, inventory events</li>
                    <li>Player stats, entity interactions</li>
                    <li>The player's base record (UUID, username, IP, playtime)</li>
                </ul>

                <form method="post" action="{{ url_for('group_admin.player_delete', uuid=player.uuid) }}">
                    <input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
                    <div class="mb-3">
                        <label for="confirm_name" class="form-label fw-semibold">
                            Type <span class="text-danger font-monospace">{{ player.username }}</span> to confirm:
                        </label>
                        <input type="text" id="confirm_name" name="confirm_name"
                               class="form-control bg-dark text-white border-danger"
                               placeholder="{{ player.username }}" autocomplete="off" required>
                    </div>
                    <div class="d-flex gap-2">
                        <button type="submit" class="btn btn-danger">
                            <i class="bi bi-trash3-fill me-1"></i>Delete All Data
                        </button>
                        <a href="{{ url_for('panel.player_detail', uuid=player.uuid) }}"
                           class="btn btn-outline-secondary">
                            <i class="bi bi-x-lg me-1"></i>Cancel
                        </a>
                    </div>
                </form>
            </div>
        </div>

        <div class="mt-3 text-muted small">
            <i class="bi bi-info-circle me-1"></i>
            This deletion is logged in the audit log as required by Art. 5(2) GDPR (accountability).
            The export function (Art. 20 GDPR) is available on the player detail page.
        </div>
    </div>
</div>
{% endblock %}
