{% extends "base.html" %}
{% block content %}
{% if not shop %}
<section class="panel">
<h2>NPC Shops</h2>
<p class="muted">Browse by category. Shops give the economy its baseline price floor and ceiling.</p>
</section>
<section class="cards">
{% for entry in shops %}
<article class="card">
<h3>{{ entry.label }}</h3>
<p class="muted">{{ entry.count }} items stocked.</p>
<a href="/shops/{{ entry.slug }}" class="button primary">Enter Shop</a>
</article>
{% endfor %}
</section>
{% else %}
<section class="panel">
<div class="action-row" style="justify-content: space-between;">
<div>
<h2>{{ shop.label }}</h2>
<p class="muted">Wallet cash buys stock instantly.</p>
</div>
<a href="/shops" class="button subtle">Back to Shops</a>
</div>
</section>
<section class="cards">
{% for item in items %}
<article class="card">
<h3>{{ item.name }}</h3>
<p class="muted">{{ item.description }}</p>
<p class="muted mini">Buy ${{ item.buy_price }} • Sell ${{ item.sell_price }}</p>
{% if item.weapon_damage_max %}
<p class="muted mini">Damage {{ item.weapon_damage_min }}-{{ item.weapon_damage_max }}</p>
{% endif %}
{% if item.armor_reduction %}
<p class="muted mini">Armor reduction {{ item.armor_reduction }}</p>
{% endif %}
{% if item.home_life_bonus %}
<p class="muted mini">Home life bonus +{{ item.home_life_bonus }}</p>
{% endif %}
<form method="post" class="inline-form">
<input type="hidden" name="item_id" value="{{ item.id }}">
<input type="hidden" name="redirect_shop" value="{{ shop.slug }}">
<input type="number" name="quantity" min="1" value="1">
<button type="submit" class="primary">Buy</button>
</form>
</article>
{% endfor %}
</section>
{% endif %}
{% endblock %}