{% extends "base.html" %}
{% load static %}

{% block title %}{{ project_name }} | Strong Protection{% endblock %}

{% block head %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
    :root {
        --primary-bg: #0f172a;
        --secondary-bg: #1e293b;
        --accent-blue: #38bdf8;
        --accent-green: #22c55e;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --border-color: #334155;
        --glass-bg: rgba(30, 41, 59, 0.7);
    }

    body {
        background-color: var(--primary-bg);
        color: var(--text-main);
        font-family: 'Inter', sans-serif;
        margin: 0;
        min-height: 100vh;
        background-image: 
            radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.05) 0%, transparent 40%),
            radial-gradient(circle at 90% 80%, rgba(34, 197, 94, 0.05) 0%, transparent 40%);
    }

    .navbar {
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-color);
        padding: 1rem 2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .logo {
        font-weight: 700;
        font-size: 1.25rem;
        color: var(--accent-blue);
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .logo span { color: var(--text-main); }

    .hero {
        text-align: center;
        padding: 4rem 2rem 2rem;
    }

    .hero h1 {
        font-size: 3rem;
        margin-bottom: 1rem;
        background: linear-gradient(to right, var(--accent-blue), var(--accent-green));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        font-weight: 800;
    }

    .hero p {
        color: var(--text-muted);
        max-width: 600px;
        margin: 0 auto 2rem;
        font-size: 1.1rem;
    }

    .editor-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 2rem 4rem;
    }

    @media (max-width: 768px) {
        .editor-container { grid-template-columns: 1fr; }
    }

    .editor-pane {
        background: var(--secondary-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

    .editor-header {
        padding: 0.75rem 1rem;
        background: rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-muted);
    }

    textarea {
        background: transparent;
        border: none;
        color: #e2e8f0;
        font-family: 'JetBrains Mono', monospace;
        padding: 1rem;
        resize: none;
        height: 400px;
        outline: none;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .btn-obfuscate {
        grid-column: span 2;
        background: linear-gradient(to right, var(--accent-blue), #2563eb);
        color: white;
        border: none;
        padding: 1rem 2rem;
        border-radius: 8px;
        font-weight: 700;
        font-size: 1.1rem;
        cursor: pointer;
        transition: all 0.2s;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-top: -1rem;
        box-shadow: 0 4px 14px 0 rgba(56, 189, 248, 0.39);
    }

    @media (max-width: 768px) { .btn-obfuscate { grid-column: span 1; } }

    .btn-obfuscate:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
        filter: brightness(1.1);
    }

    .btn-obfuscate:active { transform: translateY(0); }

    .copy-btn {
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-muted);
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-size: 0.75rem;
        cursor: pointer;
    }

    .copy-btn:hover { color: var(--text-main); border-color: var(--text-muted); }

    .badge {
        padding: 0.2rem 0.5rem;
        border-radius: 4px;
        font-size: 0.7rem;
        text-transform: uppercase;
    }
    .badge-blue { background: rgba(56, 189, 248, 0.1); color: var(--accent-blue); }
    .badge-green { background: rgba(34, 197, 94, 0.1); color: var(--accent-green); }

    footer {
        text-align: center;
        padding: 2rem;
        color: var(--text-muted);
        font-size: 0.875rem;
        border-top: 1px solid var(--border-color);
    }
</style>
{% endblock %}

{% block content %}
<nav class="navbar">
    <a href="/" class="logo">VM-<span>LUAU</span></a>
    <div>
        <a href="/admin/" style="color: var(--text-muted); text-decoration: none; font-size: 0.875rem;">Admin Access</a>
    </div>
</nav>

<section class="hero">
    <h1>Next-Gen Luau Protection</h1>
    <p>Secure your Roblox scripts with our custom Virtual Machine obfuscation. Harder to reverse-engineer, impossible to ignore.</p>
</section>

<form method="POST" class="editor-container">
    {% csrf_token %}
    <div class="editor-pane">
        <div class="editor-header">
            <span>INPUT.LUAU</span>
            <span class="badge badge-blue">Source</span>
        </div>
        <textarea name="code" placeholder="-- Paste your Luau code here..." required>{{ input_code }}</textarea>
    </div>

    <div class="editor-pane">
        <div class="editor-header">
            <span>PROTECTED.LUAU</span>
            <button type="button" class="copy-btn" onclick="copyOutput()">Copy Code</button>
        </div>
        <textarea id="output-area" readonly placeholder="-- Obfuscated code will appear here...">{{ output_code }}</textarea>
    </div>

    <button type="submit" class="btn-obfuscate">Obfuscate Script</button>
</form>

<footer>
    &copy; 2026 {{ agent_brand }} | Built with Django & VM Technology
</footer>

<script>
    function copyOutput() {
        const output = document.getElementById('output-area');
        output.select();
        document.execCommand('copy');
        alert('Copied to clipboard!');
    }
</script>
{% endblock %}
