<div class="node-result">
  <h5>{{ result.metadata.name }}</h5>
  <p class="text-muted">Type: <code>Transform</code></p>

  {% if result.metadata.model_name %}
  <p><strong>Model:</strong> <code>{{ result.metadata.model_name }}</code></p>
  {% endif %}

  {% if result.prompt %}
  <details class="mb-3">
    <summary><strong>Prompt</strong> (click to expand)</summary>
    <div class="mt-2">
      <pre class="bg-light p-3">{{ result.prompt }}</pre>
    </div>
  </details>
  {% endif %}

  {% if result.slot_dataframes %}
  <div class="mb-3">
    <h6>Structured Output:</h6>
    {% for slot_name, df in result.slot_dataframes.items() %}
    <details open class="mb-2">
      <summary><strong>{{ slot_name }}</strong> ({{ df|length }} items)</summary>
      <div class="mt-2">
        {{ df|df_to_html|safe }}
      </div>
    </details>
    {% endfor %}
  </div>
  {% endif %}

  {% if result.response_text %}
  <details class="mb-3">
    <summary><strong>Full Response Text</strong> (click to expand)</summary>
    <div class="card card-body mt-2">
      <div>
{% markdown %}
{{ result.response_text }}
{% endmarkdown %}
      </div>
    </div>
  </details>
  {% endif %}
</div>
