{% extends 'base.html' %}

{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
    <h1 class="h2">GCode Preview: {{ file.original_filename }}</h1>
    <a href="{{ url_for('main.files') }}" class="btn btn-secondary btn-sm">Back to Files</a>
</div>

<div class="card shadow-sm mb-4">
    <div class="card-header bg-info text-dark d-flex justify-content-between">
        <span>File Info</span>
        <span>Total Lines: {{ line_count }}</span>
    </div>
    <div class="card-body">
        <p class="card-text text-muted mb-1">Below is a text preview of the generated GCode (first 500 lines).</p>
        <pre class="bg-dark text-light p-3 rounded" style="max-height: 500px; overflow-y: auto; font-size: 13px;"><code>{{ content }}</code></pre>
    </div>
    <div class="card-footer">
        <a href="{{ url_for('main.download_gcode', file_id=file.id) }}" class="btn btn-primary">Download Full GCode File</a>
    </div>
</div>
{% endblock %}