{% extends "base.html" %}

{% block title %}{{ title }} - Admin{% endblock %}

{% block content %}
<div class="bbs-header">
    <h1><i class="bi bi-palette"></i> {{ title }}</h1>
</div>

<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">{{ title }}</div>
            <div class="card-body">
                <form method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    {{ form.hidden_tag() }}

                    <div class="mb-3">
                        {{ form.name.label(class="form-label") }}
                        {{ form.name(class="form-control") }}
                        {% for error in form.name.errors %}
                            <div class="text-danger">{{ error }}</div>
                        {% endfor %}
                    </div>

                    <div class="mb-3">
                        {{ form.display_name.label(class="form-label") }}
                        {{ form.display_name(class="form-control") }}
                    </div>

                    <div class="mb-3">
                        {{ form.description.label(class="form-label") }}
                        {{ form.description(class="form-control", rows="2") }}
                    </div>

                    <div class="mb-3">
                        {{ form.css_variables.label(class="form-label") }}
                        {{ form.css_variables(class="form-control font-monospace", rows="10") }}
                        <small>JSON object of CSS variable overrides, e.g. {"--theme-primary": "#00ff00", "--theme-bg": "#000000"}</small>
                        {% for error in form.css_variables.errors %}
                            <div class="text-danger">{{ error }}</div>
                        {% endfor %}
                    </div>

                    <div class="mb-3 form-check">
                        {{ form.is_default(class="form-check-input") }}
                        {{ form.is_default.label(class="form-check-label") }}
                    </div>

                    <div class="mb-3 form-check">
                        {{ form.is_active(class="form-check-input") }}
                        {{ form.is_active.label(class="form-check-label") }}
                    </div>

                    <div class="d-flex gap-2">
                        {{ form.submit(class="btn btn-primary") }}
                        <a href="{{ url_for('admin.themes') }}" class="btn btn-secondary">Cancel</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
