{# Combat Victory Partial - Swapped into combat log when player wins #}

<div class="combat-result combat-result--victory">
    <div class="combat-result__icon">&#127942;</div>
    <h1 class="combat-result__title">Victory!</h1>
    <p class="combat-result__subtitle">You have defeated your enemies!</p>

    {# Rewards Section #}
    {% if rewards %}
    <div class="combat-rewards">
        <h2 class="rewards-title">Rewards Earned</h2>
        <div class="rewards-list">
            {# Experience #}
            {% if rewards.experience %}
            <div class="reward-item">
                <span class="reward-icon">&#11088;</span>
                <span class="reward-label">Experience Points</span>
                <span class="reward-value reward-value--xp">+{{ rewards.experience }} XP</span>
            </div>
            {% endif %}

            {# Gold #}
            {% if rewards.gold %}
            <div class="reward-item">
                <span class="reward-icon">&#128176;</span>
                <span class="reward-label">Gold</span>
                <span class="reward-value reward-value--gold">+{{ rewards.gold }} gold</span>
            </div>
            {% endif %}

            {# Level Up #}
            {% if rewards.level_ups %}
            {% for character_id in rewards.level_ups %}
            <div class="reward-item">
                <span class="reward-icon">&#127775;</span>
                <span class="reward-label">Level Up!</span>
                <span class="reward-value reward-value--level">New abilities unlocked!</span>
            </div>
            {% endfor %}
            {% endif %}
        </div>

        {# Loot Items - use bracket notation to avoid conflict with dict.items() method #}
        {% if rewards.get('items') %}
        <div class="loot-section">
            <h3 class="loot-title">Items Obtained</h3>
            <div class="loot-list">
                {% for item in rewards.get('items', []) %}
                <div class="loot-item loot-item--{{ item.rarity|default('common') }}">
                    <span>
                        {% if item.type == 'weapon' %}&#9876;
                        {% elif item.type == 'armor' %}&#129523;
                        {% elif item.type == 'consumable' %}&#127863;
                        {% elif item.type == 'material' %}&#128293;
                        {% else %}&#128230;
                        {% endif %}
                    </span>
                    <span>{{ item.name }}</span>
                    {% if item.get('quantity', 1) > 1 %}
                    <span style="color: var(--text-muted);">x{{ item.quantity }}</span>
                    {% endif %}
                </div>
                {% endfor %}
            </div>
        </div>
        {% endif %}
    </div>
    {% endif %}

    {# Action Buttons #}
    <div class="combat-result__actions">
        <a href="{{ url_for('game.play_session', session_id=session_id) }}" class="btn btn-primary">
            Continue Adventure
        </a>
    </div>
</div>
