<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{% block title %}PyGoEdge 面板{% endblock %}</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
  {% block extra_head %}{% endblock %}
  <style>
    .navbar-brand small { font-size: 0.8rem; opacity: .8; }
  </style>
  {% load static %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-4">
  <div class="container-fluid">
    <a class="navbar-brand" href="/domains/">PyGoEdge 面板 <small>Beta</small></a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#topNav" aria-controls="topNav" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="topNav">
      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
        <li class="nav-item"><a class="nav-link" href="/domains/">域名</a></li>
        <li class="nav-item"><a class="nav-link" href="/plans/">套餐</a></li>
        <li class="nav-item"><a class="nav-link" href="/billing/">账单</a></li>
        {% if request.user.is_staff %}
        <li class="nav-item"><a class="nav-link" href="/admin-panel/">运营面板</a></li>
        {% endif %}
        <li class="nav-item"><a class="nav-link" href="/admin/">Django Admin</a></li>
      </ul>
      <div class="d-flex align-items-center text-light">
        {% if request.user.is_authenticated %}
          <span class="me-2">你好，{{ request.user.username }}</span>
          <a class="btn btn-outline-light btn-sm me-2" href="/accounts/profile/">用户中心</a>
          <form method="post" action="/accounts/logout/" class="d-inline">
            {% csrf_token %}
            <button class="btn btn-warning btn-sm" type="submit">退出</button>
          </form>
        {% else %}
          <a class="btn btn-outline-light btn-sm me-2" href="/accounts/login/">登录</a>
          <a class="btn btn-success btn-sm" href="/accounts/register/">注册</a>
        {% endif %}
      </div>
    </div>
  </div>
</nav>

<div class="container">
  {% if messages %}
    {% for message in messages %}
      <div class="alert alert-{{ message.tags }}">{{ message }}</div>
    {% endfor %}
  {% endif %}

  {% block content %}{% endblock %}
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
{% block extra_scripts %}{% endblock %}
</body>
</html>