{#
NPC Dialogue Response partial - displays conversation with current exchange.
Used when job polling returns NPC dialogue results.

Expected context:
- npc_name: Name of the NPC
- character_name: Name of the player character
- conversation_history: List of previous exchanges [{player_line, npc_response}, ...]
- player_line: What the player just said
- dialogue: NPC's current response
- session_id: For any follow-up actions
#}

<div class="npc-dialogue-response">
    <div class="npc-dialogue-header">
        <span class="npc-dialogue-title">{{ npc_name }} says:</span>
    </div>

    <div class="npc-dialogue-content">
        {# Show conversation history if present #}
        {% if conversation_history %}
        <div class="conversation-history">
            {% for exchange in conversation_history[-3:] %}
            <div class="history-exchange">
                <div class="history-player">
                    <span class="speaker player">{{ character_name }}:</span>
                    <span class="text">{{ exchange.player_line }}</span>
                </div>
                <div class="history-npc">
                    <span class="speaker npc">{{ npc_name }}:</span>
                    <span class="text">{{ exchange.npc_response }}</span>
                </div>
            </div>
            {% endfor %}
        </div>
        {% endif %}

        {# Show current exchange #}
        <div class="current-exchange">
            {% if player_line %}
            <div class="player-message">
                <span class="speaker player">{{ character_name }}:</span>
                <span class="text">{{ player_line }}</span>
            </div>
            {% endif %}
            <div class="npc-message">
                <span class="speaker npc">{{ npc_name }}:</span>
                <span class="text">{{ dialogue }}</span>
            </div>
        </div>
    </div>
</div>

{# Trigger sidebar refreshes after NPC dialogue #}
<div hx-get="{{ url_for('game.npcs_accordion', session_id=session_id) }}"
     hx-trigger="load"
     hx-target="#accordion-npcs"
     hx-swap="innerHTML"
     style="display: none;"></div>
