{% extends "base.html" %}
{% block content %}
    <section class="grid-3">
        <article class="panel">
            <h2>Street Loop</h2>
            <p class="muted">Quick path: work a shift, run a crime, bank the cash, upgrade gear, then go hunting for a mug.</p>
            <div class="action-row">
                <a href="/job" class="button subtle">Work Job</a>
                <a href="/crimes" class="button subtle">Run Crime</a>
                <a href="/bank" class="button subtle">Use Bank</a>
                <a href="/players" class="button primary">Find Targets</a>
            </div>
        </article>
        <article class="panel">
            <h2>Cash Exposure</h2>
            <h3>${{ current_user.wallet_money }} wallet</h3>
            <p class="muted">Only wallet cash can be mugged. Bank money is safe until you withdraw it.</p>
        </article>
        <article class="panel">
            <h2>Current Condition</h2>
            <p class="muted">Status: {{ current_user.status }}</p>
            <p class="muted">XP: {{ current_user.xp }}</p>
            {% if current_user.job_id %}
                <p class="muted">You have an active job. Use the job page to work the next shift.</p>
            {% else %}
                <p class="muted">You do not have a job yet. Join one for reliable starter income.</p>
            {% endif %}
        </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) }} • {{ log.action_type }} • stolen ${{ log.money_stolen }}</p>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p class="muted">No combat yet.</p>
            {% endif %}
        </article>

        <article class="panel">
            <h2>Crime Feed</h2>
            {% if crime_logs %}
                <ul class="log-list">
                    {% for log in crime_logs %}
                        <li>
                            <strong>{{ log.crime_name }}</strong>
                            <p class="muted mini">{{ log.result }} • ${{ log.reward_money }} • {{ log.reward_xp }} xp • {{ format_ts(log.created_at) }}</p>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p class="muted">No crime results yet.</p>
            {% endif %}
        </article>
    </section>

    <section class="grid-2">
        <article class="panel">
            <h2>Bank Feed</h2>
            {% if bank_logs %}
                <ul class="log-list">
                    {% for log in bank_logs %}
                        <li>
                            <strong>{{ log.action|capitalize }} ${{ log.amount }}</strong>
                            <p class="muted mini">{{ format_ts(log.created_at) }}</p>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p class="muted">No bank activity yet.</p>
            {% endif %}
        </article>

        <article class="panel">
            <h2>Work Feed</h2>
            {% if job_logs %}
                <ul class="log-list">
                    {% for log in job_logs %}
                        <li>
                            <strong>{{ log.job_name }}</strong>
                            <p class="muted mini">${{ log.payout }} • {{ log.xp_reward }} xp • {{ format_ts(log.created_at) }}</p>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p class="muted">No job shifts yet.</p>
            {% endif %}
        </article>
    </section>
{% endblock %}