<div class="node-result">
  <h5>{{ result.metadata.name }}</h5>
  <p class="text-muted">Type: <code>Split</code> | Split unit: <code>{{ result.metadata.split_unit }}</code> | Chunk size: <code>{{ result.metadata.chunk_size }}</code></p>

  <p><strong>Number of chunks:</strong> {{ result.metadata.num_chunks }}</p>

  {% if result.summary_stats %}
  <h6>Summary Statistics:</h6>
  <table class="table table-sm table-bordered">
    <thead>
      <tr>
        <th>Metric</th>
        <th>Min</th>
        <th>Max</th>
        <th>Mean</th>
        <th>Median</th>
      </tr>
    </thead>
    <tbody>
      {% for metric, stats in result.summary_stats.items() %}
      <tr>
        <td><strong>{{ metric }}</strong></td>
        <td>{{ stats.min }}</td>
        <td>{{ stats.max }}</td>
        <td>{{ "%.1f"|format(stats.mean) }}</td>
        <td>{{ "%.1f"|format(stats.median) }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
  {% endif %}

  {% if result.chunks_df is defined and not result.chunks_df.empty %}
  <h6>Chunk Details:</h6>
  <div style="max-height: 400px; overflow-y: auto;">
    {{ result.chunks_df|df_to_html|safe }}
  </div>
  {% elif result.data is defined and not result.data.empty %}
  <h6>Chunk Details:</h6>
  <div style="max-height: 400px; overflow-y: auto;">
    {{ result.data|df_to_html|safe }}
  </div>
  {% else %}
  <p><em>No chunks generated</em></p>
  {% endif %}
</div>
