<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Route {{ route.route_number }} Details</title>
    <link rel="stylesheet" href="../css/style.css">
    <script src="../scripts/cytoscape.min.js"></script>
</head>
<body>

<header>
    <div class="container">
        <h1>Route {{ route.route_number }}</h1>
        <p>Job ID: {{ job_id }}</p>
    </div>
</header>

<div class="container">
    <nav class="navigation">
        <a href="./index.html" class="back-link">&larr; Back to Job Overview</a>
        <div class="nav-links">
            <a href="./route_{{ route.route_number - 1 }}.html" class="nav-button {% if route.route_number == 1 %}disabled{% endif %}">&larr; Previous</a>
            <span>Route {{ route.route_number }} of {{ total_routes }}</span>
            <a href="./route_{{ route.route_number + 1 }}.html" class="nav-button {% if route.route_number == total_routes %}disabled{% endif %}">Next &rarr;</a>
        </div>
    </nav>

    <main>
        <section>
            <h2>Synthesis Tree</h2>
            <div class="cy-controls">
                <span class="cy-controls-label">Zoom:</span>
                <button id="zoom-out" title="Zoom Out">-</button>
                <input type="range" id="zoom-slider" min="0.1" max="2.5" step="0.05" value="1" title="Zoom">
                <button id="zoom-in" title="Zoom In">+</button>
                <span id="zoom-level" class="cy-controls-value">100%</span>

                <span class="cy-controls-label" style="margin-left: 60px;">Pan:</span>
                <button id="pan-left" title="Pan Left">&larr;</button>
                <button id="pan-up" title="Pan Up">&uarr;</button>
                <button id="pan-down" title="Pan Down">&darr;</button>
                <button id="pan-right" title="Pan Right">&rarr;</button>

                <button id="fit-view" title="Fit to View" style="margin-left: 60px;">Fit</button>
                <button id="reset-view" title="Reset View">Reset</button>

                <!-- Spacer to push the following content to the right -->
                <div style="flex-grow: 1;"></div>
                <span class="cy-instructions">Mouse wheel to zoom. Drag to pan.</span>
            </div>
            <div id="cy"></div>
        </section>
    </main>

    <footer>
        <p>Results are generated by Pending AI's Retrosynthesis Engine powered by artificial intelligence, an experimental technology that may occasionally be misleading or incorrect.</p>
    </footer>
</div>

<script id="cytoscape-data" type="application/json">
    {{ cytoscape_elements | tojson | safe }}
</script>
<script src="../scripts/route_viewer.js"></script>

</body>
</html>
