<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <style>
            html, body {
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
                height: 100%;
                margin: 0;
            }

            .container {
                display: flex;
                flex-direction: column;
                height: 100vh;
            }

            .left-column {
                display: flex;
                flex-direction: row;
                max-height: 40vh;
            }

            .code-box {
                flex: 1.5;
                height: 100%;
                background-color: #f5f5f5;
                padding: 16px;
                overflow: auto;
                border-right: 1px solid #ccc;
                word-wrap: break-word;
                border-bottom: none;
            }

            .error-box {
                flex: 1;
                height: 100%;
                background-color: #f5f5f5;
                padding: 16px;
                overflow: auto;
                color: red;
                box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
            }
            .code-box-header {
                font-weight: bold;
                margin-bottom: 10px;
                padding-bottom: 5px;
                border-bottom: 1px solid #cccccc;
                color: #333;
                font-size: large;
            }

            .error-box-header {
                font-weight: bold;
                margin-bottom: 10px;
                padding-bottom: 5px;
                border-bottom: 1px solid #000000;
                color: #333;
                font-size: large;
            }

            .graph-box-header {
                font-weight: bold;
                margin-bottom: 10px;
                padding-bottom: 5px;
                border-bottom: 1px solid #000000;
                color: #333;
                font-size: large;
            }

            .code-box pre {
                margin: 0;
                padding: 0;
            }

            .code-box code {
                font-family: monospace;
            }

            .graph-view {
                height: 60vh;
                overflow: hidden;
                padding: 16px;
                background-color: #ffffff;
            }
            #graph {
                width: 100%;
                height: 100%;
            }
            .top-bar {
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                color: white;
                padding: 12px 20px;
                display: flex;
                justify-content: space-between;
                align-items: center;
                box-shadow: 0 2px 8px rgba(0,0,0,0.1);
                min-height: 25px;
            }

            .repo-title {
                font-size: 24px;
                font-weight: bold;
                margin: 0;
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            }

            /* GitHub button iframe styling */
            .github-star-button {
                border-radius: 6px;
                overflow: hidden;
            }

            .json-viewer {
                height: 60%;
                width: 100%;
            }

        </style>
    </head>
    <body>
    
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-dark.min.css">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/languages/python.min.js"></script>

        <script>
            document.addEventListener("DOMContentLoaded", function() {
                document.querySelectorAll('pre code').forEach((block) => {
                    hljs.highlightBlock(block);
                });
            });
        </script>
   
        <div class="container">
            <div class="top-bar">
                <h1 class="repo-title">TorchVista</h1>
                <!-- GitHub's official star button -->
                <iframe src="https://ghbtns.com/github-btn.html?user=sachinhosmani&repo=torchvista&type=star&count=true&size=large" 
                        frameborder="0" scrolling="0" width="170" height="30" title="GitHub Star Button"></iframe>
            </div>
            <div class="left-column">

                <div class="code-box" id="codeBox">
                    <div class="code-box-header">Sample code (Not editable)</div>
                    <pre><code class="language-python">${code_contents}</code></pre>
                </div>

                <div class="error-box" id="errorBox">
                    <div class="error-box-header">Error Output (if any)</div>
                ${error_contents}
                </div>

            </div>
    
            <div class="graph-view" id="graphContainer" style="height: 100%">
                <div class="graph-box-header">Visualized Interactive Graph</div>
                ${graph_html}
            </div>
        </div>
    </body>
</html>
