<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ filename }} - Gherkin</title>
    <link rel="stylesheet" href="/static/prism/prism-tomorrow.min.css">
    <link rel="stylesheet" href="/static/prism/prism-line-numbers.min.css">
    <style>
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: system-ui, -apple-system, sans-serif;
            background: #0f172a;
            color: #e2e8f0;
            line-height: 1.6;
        }
        .container { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; }
        header { margin-bottom: 2rem; }
        .breadcrumb { font-size: 0.9rem; color: #64748b; margin-bottom: 0.5rem; }
        .breadcrumb a { color: #818cf8; text-decoration: none; }
        .breadcrumb a:hover { text-decoration: underline; }
        h1 { font-size: 1.5rem; color: #e2e8f0; }
        .meta {
            display: flex;
            gap: 0.75rem;
            margin-top: 0.75rem;
            font-size: 0.85rem;
            flex-wrap: wrap;
        }
        .meta span {
            background: #1e293b;
            padding: 0.25rem 0.75rem;
            border-radius: 4px;
            color: #94a3b8;
        }
        .meta .lang-es { border-left: 3px solid #f59e0b; }
        .meta .lang-en { border-left: 3px solid #3b82f6; }
        .meta .sample { background: #422006; color: #fbbf24; }
        .content {
            background: #1e293b;
            border-radius: 12px;
            overflow: hidden;
        }
        .content-header {
            background: #334155;
            padding: 0.75rem 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
        }
        .content-header .filename { color: #94a3b8; }
        .content-header .copy-btn {
            background: #475569;
            border: none;
            color: #e2e8f0;
            padding: 0.35rem 0.75rem;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.8rem;
        }
        .content-header .copy-btn:hover { background: #64748b; }
        pre[class*="language-"] {
            margin: 0;
            border-radius: 0;
            font-size: 0.85rem;
            line-height: 1.7;
        }
        code[class*="language-"] {
            font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
        }
        .sidebar {
            margin-top: 2rem;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
        }
        .sidebar-box {
            background: #1e293b;
            border-radius: 8px;
            padding: 1rem;
        }
        .sidebar-box h3 { font-size: 0.8rem; color: #64748b; text-transform: uppercase; margin-bottom: 0.75rem; }
        .sidebar-box a {
            display: block;
            color: #818cf8;
            text-decoration: none;
            padding: 0.35rem 0;
            font-size: 0.9rem;
        }
        .sidebar-box a:hover { text-decoration: underline; }
        footer {
            margin-top: 2rem;
            padding-top: 1rem;
            border-top: 1px solid #334155;
            font-size: 0.85rem;
        }
        footer a { color: #818cf8; text-decoration: none; }
        footer a:hover { text-decoration: underline; }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <div class="breadcrumb">
                <a href="/">Album</a> / <a href="/book/gherkin/">Gherkin</a> / {{ lang }} / {{ user_type }}
            </div>
            <h1>{{ filename.replace('.feature', '').replace('-', ' ').title() }}</h1>
            <div class="meta">
                <span class="lang-{{ lang }}">{{ 'Espanol' if lang == 'es' else 'English' }}</span>
                <span>{{ user_type }}</span>
                <span class="sample">Sample</span>
            </div>
        </header>

        <div class="content">
            <div class="content-header">
                <span class="filename">{{ filename }}</span>
                <button class="copy-btn" onclick="copyContent()">Copy</button>
            </div>
            <pre class="line-numbers"><code id="gherkin-content" class="language-gherkin">{{ content }}</code></pre>
        </div>

        <div class="sidebar">
            <div class="sidebar-box">
                <h3>Source</h3>
                <a href="/book/ops-templates/{{ user_type }}/{{ filename.replace('.feature', '.md') }}">Ops Template</a>
            </div>
            <div class="sidebar-box">
                <h3>Other Language</h3>
                {% if lang == 'es' %}
                <a href="/book/gherkin/en/{{ user_type }}/{{ filename }}">English Version</a>
                {% else %}
                <a href="/book/gherkin/es/{{ user_type }}/{{ filename }}">Spanish Version</a>
                {% endif %}
            </div>
            <div class="sidebar-box">
                <h3>Pipeline</h3>
                <a href="/book/feature-flow/">Feature Flow</a>
            </div>
        </div>

        <footer>
            <a href="/book/gherkin/">&larr; All Gherkin Files</a>
        </footer>
    </div>

    <script src="/static/prism/prism.min.js"></script>
    <script src="/static/prism/prism-gherkin.min.js"></script>
    <script src="/static/prism/prism-line-numbers.min.js"></script>
    <script>
        function copyContent() {
            const content = document.getElementById('gherkin-content').textContent;
            navigator.clipboard.writeText(content);
            const btn = document.querySelector('.copy-btn');
            btn.textContent = 'Copied!';
            setTimeout(() => btn.textContent = 'Copy', 2000);
        }
    </script>
</body>
</html>
