{% extends 'game/admin/base.html.twig' %}

{% block title %}Edit User — Admin{% endblock %}

{% block admin_body %}
    <div style="margin-bottom: 1.5rem;">
        <a href="{{ path('game_admin_users') }}" style="color: #64748b; text-decoration: none; font-size: 0.9rem;">← Users</a>
    </div>

    <h1 style="margin: 0 0 1.5rem; font-size: 1.5rem; color: #0f172a;">Edit user: {{ user.username }}</h1>

    <div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); padding: 1.5rem; max-width: 500px;">
        {{ form_start(form, {attr: {style: 'display: flex; flex-direction: column; gap: 1.25rem;'}}) }}

            <div>
                {{ form_label(form.email, null, {label_attr: {style: 'display: block; font-weight: 600; margin-bottom: 0.35rem; color: #374151; font-size: 0.875rem;'}}) }}
                {{ form_widget(form.email, {attr: {style: 'width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; box-sizing: border-box;'}}) }}
                {{ form_errors(form.email) }}
            </div>

            <div>
                {{ form_label(form.username, null, {label_attr: {style: 'display: block; font-weight: 600; margin-bottom: 0.35rem; color: #374151; font-size: 0.875rem;'}}) }}
                {{ form_widget(form.username, {attr: {style: 'width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; box-sizing: border-box;'}}) }}
                {{ form_errors(form.username) }}
            </div>

            <div>
                {{ form_label(form.plainPassword, null, {label_attr: {style: 'display: block; font-weight: 600; margin-bottom: 0.35rem; color: #374151; font-size: 0.875rem;'}}) }}
                {{ form_widget(form.plainPassword, {attr: {style: 'width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; box-sizing: border-box;'}}) }}
                {{ form_errors(form.plainPassword) }}
            </div>

            <div>
                {{ form_label(form.roles, null, {label_attr: {style: 'display: block; font-weight: 600; margin-bottom: 0.5rem; color: #374151; font-size: 0.875rem;'}}) }}
                <div style="display: flex; flex-direction: column; gap: 0.4rem;">
                    {{ form_widget(form.roles) }}
                </div>
                {{ form_errors(form.roles) }}
            </div>

            <div style="display: flex; align-items: center; gap: 0.5rem;">
                {{ form_widget(form.isVerified) }}
                {{ form_label(form.isVerified, null, {label_attr: {style: 'font-weight: 600; color: #374151; font-size: 0.875rem; cursor: pointer;'}}) }}
                {{ form_errors(form.isVerified) }}
            </div>

            <div style="display: flex; gap: 0.75rem; margin-top: 0.5rem;">
                <button type="submit" style="
                    padding: 0.6rem 1.25rem;
                    background: #3b82f6;
                    color: #fff;
                    border: none;
                    border-radius: 6px;
                    font-size: 0.9rem;
                    font-weight: 600;
                    cursor: pointer;
                ">Save changes</button>
                <a href="{{ path('game_admin_users') }}" style="
                    padding: 0.6rem 1.25rem;
                    background: #f1f5f9;
                    color: #475569;
                    border-radius: 6px;
                    font-size: 0.9rem;
                    font-weight: 600;
                    text-decoration: none;
                ">Cancel</a>
            </div>

        {{ form_end(form) }}
    </div>
{% endblock %}
