{% extends "base.html" %}
{% block content %}
    <section class="grid-3">
        <article class="panel">
            <h2>{{ current_user.username }}</h2>
            <p class="muted">Level {{ current_user.level }} • {{ current_user.xp }} xp</p>
            <p class="muted">Wallet: ${{ current_user.wallet_money }} • Bank: ${{ current_user.bank_money }}</p>
            <p class="muted">Inventory slots in use: {{ inventory_count }}</p>
        </article>
        <article class="panel">
            <h2>Equipment</h2>
            <p class="muted">Weapon: {{ current_user.weapon_item.name if current_user.weapon_item else "Fists" }}</p>
            <p class="muted">Armor: {{ current_user.armor_item.name if current_user.armor_item else "None" }}</p>
            <p class="muted">Home: {{ current_user.home_item.name if current_user.home_item else "Street" }}</p>
        </article>
        <article class="panel">
            <h2>Derived Combat</h2>
            <p class="muted">Damage range: {{ current_user.weapon_damage_min }} - {{ current_user.weapon_damage_max }}</p>
            <p class="muted">Armor reduction: {{ current_user.effective_armor_reduction }}</p>
            <p class="muted">Max life: {{ current_user.max_life }}</p>
        </article>
    </section>

    <section class="grid-2">
        <article class="panel">
            <h2>Recent Combat</h2>
            {% if combat_logs %}
                <ul class="log-list">
                    {% for log in combat_logs %}
                        <li>
                            <strong>{{ log.summary }}</strong>
                            <p class="muted mini">{{ format_ts(log.created_at) }}</p>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p class="muted">No combat logs yet.</p>
            {% endif %}
        </article>
        <article class="panel">
            <h2>Item Transactions</h2>
            {% if market_logs %}
                <ul class="log-list">
                    {% for log in market_logs %}
                        <li>
                            <strong>{{ log.reason|replace('_', ' ')|title }}</strong>
                            <p class="muted mini">{{ log.item_name }} x{{ log.quantity }} • {{ format_ts(log.created_at) }}</p>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p class="muted">No recent item movement.</p>
            {% endif %}
        </article>
    </section>
{% endblock %}
