{{ define "content" }}
<h1 class="text-2xl mb-4">URL Lists</h1>
<form method="POST" class="mb-4">
    <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
    <input type="hidden" name="action" value="add">
    <input type="text" name="url" placeholder="Add URL" class="p-2 bg-gray-700 rounded">
    <button type="submit" class="bg-blue-600 p-2 rounded">Add</button>
</form>
<ul class="space-y-2">
    {{ with .PageData }}
    {{ range $i, $url := .URLs }}
    <li class="flex justify-between bg-gray-800 p-2 rounded">
        {{ $url }}
        <div>
            <form method="POST" class="inline">
                <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
                <input type="hidden" name="action" value="toggle">
                <input type="hidden" name="index" value="{{ $i }}">
                <button type="submit" class="bg-yellow-600 p-1 rounded">Toggle</button>
            </form>
            <form method="POST" class="inline">
                <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
                <input type="hidden" name="action" value="remove">
                <input type="hidden" name="index" value="{{ $i }}">
                <button type="submit" class="bg-red-600 p-1 rounded">Remove</button>
            </form>
        </div>
    </li>
    {{ end }}
    {{ end }}
</ul>
{{ end }}