{% extends "base.html" %}

{% block content %}
<div class="content-card">
    <h1>
        {% if mode == "edit" %}
            Frage bearbeiten
        {% else %}
            Neue Frage
        {% endif %}
    </h1>

    <form method="post" class="admin-form">

        <div class="form-group">
            <label>Thema</label>
            <select name="thema_id" required>
                <option value="">-- auswählen --</option>
                {% for t in themen %}
                    <option value="{{ t.id }}"
                        {% if frage.thema_id == t.id %}selected{% endif %}>
                        {{ t.kurztitel }} - {{ t.titel }}
                    </option>
                {% endfor %}
            </select>
        </div>

        <div class="form-group">
            <label>Reihenfolge</label>
            <input type="number"
                name="reihenfolge"
                value="{{ frage.reihenfolge or 0 }}">
        </div>

        <div class="form-group">
            <label>Frage</label>
            <textarea name="text" rows="5" required>{{ frage.text or '' }}</textarea>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn">Speichern</button>
            <a class="btn btn-secondary" href="{{ url_for('admin_questions') }}">Abbrechen</a>
        </div>

    </form>
</div>
{% endblock %}