{% extends "base.html" %}
{% block title %}{{ title }} - Admin - A+ Academy{% endblock %}
{% block extra_css %}
<style>
.admin-sidebar { background: white; border-radius: 20px; box-shadow: var(--soft-shadow); padding: 1.5rem; height: calc(100vh - 140px); position: sticky; top: 100px; }
.admin-nav-link { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text-dark); text-decoration: none; border-radius: 10px; margin-bottom: 8px; transition: all 0.3s ease; }
.admin-nav-link:hover, .admin-nav-link.active { background: rgba(37, 99, 235, 0.1); color: var(--primary-blue); }
</style>
{% endblock %}
{% block content %}
<section style="padding: 120px 0 40px;">
    <div class="container">
        <div class="row g-4">
            <div class="col-lg-3">
                <div class="admin-sidebar">
                    <div class="d-flex align-items-center gap-2 mb-4 pb-3 border-bottom">
                        <i class="bi bi-person-circle text-primary fs-4"></i>
                        <div><div class="fw-bold">{{ current_user.username }}</div><small class="text-muted">Administrator</small></div>
                    </div>
                    <nav>
                        <a href="{{ url_for('admin.dashboard') }}" class="admin-nav-link"><i class="bi bi-speedometer2"></i> Dashboard</a>
                        <a href="{{ url_for('admin.messages') }}" class="admin-nav-link"><i class="bi bi-envelope"></i> Messages</a>
                        <a href="{{ url_for('admin.content') }}" class="admin-nav-link"><i class="bi bi-file-text"></i> Site Content</a>
                        <a href="{{ url_for('admin.admin_subjects') }}" class="admin-nav-link active"><i class="bi bi-book"></i> Subjects</a>
                        <div class="border-top my-3"></div>
                        <a href="{{ url_for('admin.logout') }}" class="admin-nav-link text-danger"><i class="bi bi-box-arrow-right"></i> Logout</a>
                    </nav>
                </div>
            </div>
            <div class="col-lg-9">
                <div class="d-flex justify-content-between align-items-center mb-4">
                    <h4 class="mb-0">{{ title }}</h4>
                    <a href="{{ url_for('admin.admin_subjects') }}" class="btn btn-outline-primary btn-sm"><i class="bi bi-arrow-left"></i> Back</a>
                </div>
                <div class="soft-card p-4">
                    <form method="POST">
                        {{ form.hidden_tag() }}
                        <div class="row g-3">
                            <div class="col-md-6"><div class="mb-3">{{ form.name.label(class="form-label") }}{{ form.name(class="form-control", placeholder="e.g., Physical Sciences") }}</div></div>
                            <div class="col-md-6"><div class="mb-3">{{ form.code.label(class="form-label") }}{{ form.code(class="form-control", placeholder="e.g., PHY10") }}</div></div>
                        </div>
                        <div class="row g-3">
                            <div class="col-md-6"><div class="mb-3">{{ form.grade_level.label(class="form-label") }}{{ form.grade_level(class="form-select") }}</div></div>
                            <div class="col-md-6"><div class="mb-3">{{ form.display_order.label(class="form-label") }}{{ form.display_order(class="form-control", placeholder="0") }}</div></div>
                        </div>
                        <div class="row g-3">
                            <div class="col-md-6"><div class="mb-3">{{ form.icon.label(class="form-label") }}{{ form.icon(class="form-control", placeholder="bi-book") }}<small class="text-muted">Bootstrap Icons class</small></div></div>
                            <div class="col-md-6"><div class="mb-3">{{ form.color.label(class="form-label") }}{{ form.color(class="form-select") }}</div></div>
                        </div>
                        <div class="mb-3">{{ form.description.label(class="form-label") }}{{ form.description(class="form-control", rows=4, placeholder="Enter subject description...") }}</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="soft-btn") }}<a href="{{ url_for('admin.admin_subjects') }}" class="btn btn-outline-secondary">Cancel</a></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}