<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理 - {% block title %}{% endblock %}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .sidebar { min-height: calc(100vh - 56px); }
        .nav-link.active { background-color: #0d6efd; color: #fff !important; border-radius: 6px; }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <a class="navbar-brand" href="{{ url_for('dashboard') }}">🛡️ 管理后台</a>
        </div>
    </nav>
    <div class="container-fluid">
        <div class="row">
            <nav class="col-md-2 bg-light sidebar py-3">
                <div class="nav flex-column nav-pills">
                    <a class="nav-link text-dark mb-1" href="{{ url_for('dashboard') }}">📊 仪表盘</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('competitions') }}">🏆 杯赛管理</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('competition_apps') }}">📋 杯赛申请</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('teacher_apps') }}">👨‍🏫 教师申请</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('exams') }}">📝 考试管理</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('users') }}">👥 用户管理</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('posts') }}">💬 帖子管理</a>
                    <a class="nav-link text-dark mb-1" href="{{ url_for('notifications') }}">📢 公告管理</a>
                </div>
            </nav>
            <main class="col-md-10 py-4">
                {% with messages = get_flashed_messages(with_categories=true) %}
                {% if messages %}
                {% for category, message in messages %}
                <div class="alert alert-{{ 'danger' if category == 'error' else 'success' }} alert-dismissible fade show" role="alert">
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
                {% endfor %}
                {% endif %}
                {% endwith %}
                {% block content %}{% endblock %}
            </main>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>