<?php
// 检测是否在管理后台
if (!defined('ADMIN_HEADER')) {
define('ADMIN_HEADER', true);
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo isset($page_title) ? $page_title . ' - ' : ''; ?>管理后台 - <?php echo $config['site']['name']; ?></title>
    <link href="https://cdn.jsdmirror.com/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdmirror.com/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
<style>
/* 精简版Bootstrap样式 */
* { box-sizing: border-box; }
body { 
    margin: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background-color: #f8f9fa; 
}

/* 导航栏样式 - 固定在最上层 */
.navbar { 
    background:  #244061; 
    padding: 0.5rem 1rem; 
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030; /* 确保在最上层 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 56px;
}

/* 滚动公告栏样式 - 固定在导航栏下方 */
.announcement-bar {
    position: fixed;
    top: 56px; /* 导航栏高度 */
    left: 0;
    right: 0;
    background: linear-gradient(to bottom,  #366092, #B8CCE4); 
    color: red; 
    padding: 10px; 
    white-space: nowrap; 
    overflow: hidden; 
    display: flex; 
    align-items: center;
    z-index: 1029; /* 在导航栏下方，但在其他内容上方 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 56px;
}

/* 主内容容器 - 添加顶部间距 */
.main-container {
    margin-top: 112px; /* 导航栏高度 + 公告栏高度 */
    min-height: calc(100vh - 112px);
}

/* 侧边栏样式 */
.sidebar { 
    background: #343a40; 
    min-height: calc(100vh - 112px);
}

/* 其他样式保持不变 */
.navbar-brand { color: #fff; font-weight: 500; }
.navbar-text { color: rgba(255,255,255,.75); }
.btn-outline-light { border-color: rgba(255,255,255,.5); color: rgba(255,255,255,.75); }
.btn-outline-light:hover { background-color: rgba(255,255,255,.1); color: #fff; }

.nav-link { color: rgba(255,255,255,.75); padding: 0.75rem 1rem; border-radius: 0.25rem; }
.nav-link:hover, .nav-link.active { background: #495057; color: #fff; text-decoration: none; }
.nav-link.active { background: #007bff; }

.card { background: #fff; border: 1px solid rgba(0,0,0,.125); border-radius: 0.25rem; margin-bottom: 1rem; }
.card-header { background: #f8f9fa; padding: 0.75rem 1.25rem; border-bottom: 1px solid rgba(0,0,0,.125); font-weight: 500; }
.card-body { padding: 1.25rem; }

.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-control, .form-select { display: block; width: 100%; padding: 0.375rem 0.75rem; border: 1px solid #ced4da; border-radius: 0.25rem; }
.form-control:focus, .form-select:focus { border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25); }
.form-text { font-size: 0.875rem; color: #6c757d; }

.btn { display: inline-block; padding: 0.375rem 0.75rem; border: 1px solid transparent; border-radius: 0.25rem; text-decoration: none; cursor: pointer; }
.btn-primary { background: #0d6efd; border-color: #0d6efd; color: #fff; }
.btn-primary:hover { background: #0b5ed7; border-color: #0a58ca; }
.btn-danger { background: #dc3545; border-color: #dc3545; color: #fff; }
.btn-danger:hover { background: #bb2d3b; border-color: #b02a37; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; }

.container-fluid { width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; }
.row { display: flex; flex-wrap: wrap; margin-right: -15px; margin-left: -15px; }
.col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.p-0 { padding: 0; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.me-3 { margin-right: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.d-flex { display: flex; }
.d-none { display: none; }
.d-grid { display: grid; }
.gap-2 { gap: 0.5rem; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-self-center { align-self: center; }
.flex-column { flex-direction: column; }
.w-100 { width: 100%; }

.text-center { text-align: center; }
.text-muted { color: #6c757d; }
.text-white { color: #fff; }
.fs-1 { font-size: 2.5rem; }

.alert { padding: 0.75rem 1.25rem; border: 1px solid transparent; border-radius: 0.25rem; margin-bottom: 1rem; }
.alert-success { color: #0f5132; background: #d1e7dd; border-color: #badbcc; }
.alert-danger { color: #721c24; background: #f8d7da; border-color: #f5c6cb; }

.list-group { display: flex; flex-direction: column; padding-left: 0; margin-bottom: 0; }
.list-group-item { position: relative; display: block; padding: 0.75rem 1.25rem; background: #fff; border: 1px solid rgba(0,0,0,.125); }
.list-group-item:first-child { border-top-left-radius: 0.25rem; border-top-right-radius: 0.25rem; }
.list-group-item:last-child { border-bottom-left-radius: 0.25rem; border-bottom-right-radius: 0.25rem; }

.table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem; border-top: 1px solid #dee2e6; }
.table thead th { border-bottom: 2px solid #dee2e6; }

.bi::before { display: inline-block; font-family: bootstrap-icons; font-style: normal; font-weight: normal; margin-right: 0.5rem; }
.bi-speedometer2::before { content: "\F569"; }
.bi-gear::before { content: "\F3E5"; }
.bi-list-ul::before { content: "\F24F"; }
.bi-database::before { content: "\F1C0"; }
.bi-link-45deg::before { content: "\F370"; }
.bi-megaphone::before { content: "\F453"; }
.bi-palette::before { content: "\F3EA"; }
.bi-arrow-repeat::before { content: "\F130"; }
.bi-file-text::before { content: "\F35A"; }
.bi-folder::before { content: "\F3D8"; }

.badge {
display: inline-block;
padding: 0.25em 0.4em;
font-size: 0.75em;
font-weight: 500;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25rem;
}
.bg-primary { background: #0d6efd; color: #fff; }
.bg-secondary { background: #6c757d; color: #fff; }

.border-primary { border: 2px solid #0d6efd !important; }

.stats-card {
transition: transform 0.2s;
cursor: pointer;
}

.row {
display: flex;
flex-wrap: wrap;
margin-right: -10px;
margin-left: -10px;
}
.col-md-3, .col-md-4, .col-md-6, .col-md-8 {
padding-right: 10px;
padding-left: 10px;
}

@media (max-width: 768px) {
.col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-10 {
flex: 0 0 100%;
max-width: 100%;
}
}

code {
background: #f8f9fa;
padding: 0.2em 0.4em;
border-radius: 0.25rem;
font-size: 0.875em;
color: #d63384;
}

ul {
margin-top: 0;
margin-bottom: 1rem;
}

@media (max-width: 768px) {
.col-md-2, .col-md-6, .col-md-10 { flex: 0 0 100%; max-width: 100%; }
.sidebar { min-height: auto; }
.main-container { margin-top: 112px; }
}

.nav-tabs {
border-bottom: 1px solid #dee2e6;
}

.nav-tabs .nav-link {
margin-bottom: -1px;
background: none;
border: 1px solid transparent;
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
color: #495057;
padding: 0.5rem 1rem;
text-decoration: none;
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
border-color: #e9ecef #e9ecef #dee2e6;
isolation: isolate;
color: #495057;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
color: #495057;
background-color: #fff;
border-color: #dee2e6 #dee2e6 #fff;
}

.nav-tabs .nav-link.disabled {
color: #6c757d;
background-color: transparent;
border-color: transparent;
}

.tab-content {
padding: 1rem;
border: 1px solid #dee2e6;
border-top: none;
border-radius: 0 0 0.25rem 0.25rem;
background: #fff;
}

.tab-content > .tab-pane {
display: none;
}

.tab-content > .active {
display: block;
}

.form-check-input {
width: 1em;
height: 1em;
margin-top: 0.25em;
vertical-align: top;
background-color: #fff;
background-repeat: no-repeat;
background-position: center;
background-size: contain;
border: 1px solid rgba(0, 0, 0, 0.25);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}

.form-check-input[type=checkbox] {
border-radius: 0.25em;
}

.form-check-input:active {
filter: brightness(90%);
}

.form-check-input:focus {
border-color: #86b7fe;
outline: 0;
box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-check-input:checked {
background-color: #0d6efd;
border-color: #0d6efd;
}

.form-check-input:checked[type=checkbox] {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-switch {
padding-left: 2.5em;
}

.form-switch .form-check-input {
width: 2em;
margin-left: -2.5em;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
background-position: left center;
border-radius: 2em;
transition: background-position 0.15s ease-in-out;
}

.form-switch .form-check-input:focus {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2386b7fe'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
background-position: right center;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.form-check-label {
cursor: pointer;
}

.stats-card.bg-primary { background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important; }
.stats-card.bg-success { background: linear-gradient(135deg, #198754 0%, #157347 100%) !important; }
.stats-card.bg-warning { background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%) !important; }
.stats-card.bg-info { background: linear-gradient(135deg, #0dcaf0 0%, #0bb5d4 100%) !important; }

.btn-outline-primary { color: #0d6efd; border-color: #0d6efd; }
.btn-outline-primary:hover { color: #fff; background-color: #0d6efd; border-color: #0d6efd; }

.btn-outline-success { color: #198754; border-color: #198754; }
.btn-outline-success:hover { color: #fff; background-color: #198754; border-color: #198754; }

.btn-outline-info { color: #0dcaf0; border-color: #0dcaf0; }
.btn-outline-info:hover { color: #fff; background-color: #0dcaf0; border-color: #0dcaf0; }

.form-group { margin-bottom: 1rem; }

.border-top { border-top: 1px solid rgba(255,255,255,.1) !important; }

.sidebar::-webkit-scrollbar {
width: 6px;
}

.sidebar::-webkit-scrollbar-track {
background: #2c3034;
}

.sidebar::-webkit-scrollbar-thumb {
background: #495057;
border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
background: #6c757d;
}

/* 滚动公告栏动画 */
@keyframes scrollText {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
</style>
</head>
<body>
<!-- 导航栏 - 固定在最上层 -->
<nav class="navbar">
<div class="container-fluid">
<span class="navbar-brand"><?php echo $page_title; ?> - 管理后台</span>
<div class="d-flex">
<span class="navbar-text me-3">
欢迎，<?php echo $_SESSION['admin_username']; ?>
</span>
<a href="logout.php" class="btn btn-outline-light btn-sm">退出</a>
</div>
</div>
</nav>

<!-- 滚动公告栏 - 固定在导航栏下方 -->
<div class="announcement-bar">
    <span style="margin-right: 12px; font-size: 18px;">📢</span>
    <div style="overflow: hidden; flex: 1;">
  <div style="display: inline-block; animation: scrollText 50s linear infinite;">
    文煞CMS(API版本)，本系统由文煞研发，您可以免费使用，但是请保留版权信息，这是作者得创作署名权，请勿侵犯！作者微信公众号"文煞站长笔记网"，作者博客：www.wsbjw.cn。作者为广大用户提供免费虚拟主机、大容量虚拟主机、云服务器/VPS20元月/起！感谢大家得支持！
  </div>
  <!-- 复制一份文字用于无缝衔接滚动 -->
  <div style="display: inline-block; margin-left: 20px; animation: scrollText 50s linear infinite;">
    文煞CMS(API版本)，本系统由文煞研发，您可以免费使用，但是请保留版权信息，这是作者得创作署名权，请勿侵犯！作者微信公众号"文煞站长笔记网"，作者博客：www.wsbjw.cn。作者为广大用户提供免费虚拟主机、大容量虚拟主机、云服务器/VPS20元月/起！感谢大家得支持！
  </div>
  </div>
</div>

<!-- 主内容区域 -->
<div class="main-container">
<?php } else { ?>
<!-- 导航栏内容 -->
<nav class="navbar">
<div class="container-fluid">
<span class="navbar-brand"><?php echo $config['site']['name']; ?> - 管理后台</span>
<div class="d-flex">
<span class="navbar-text me-3">
欢迎，<?php echo $_SESSION['admin_username']; ?>
</span>
<a href="logout.php" class="btn btn-outline-light btn-sm">退出</a>
</div>
</div>
</nav>

<!-- 滚动公告栏 -->
<div class="announcement-bar">
    <span style="margin-right: 12px; font-size: 18px;">📢</span>
    <div style="overflow: hidden; flex: 1;">
  <div style="display: inline-block; animation: scrollText 50s linear infinite;">
    文煞CMS(API版本)，本系统由文煞研发，您可以免费使用，但是请保留版权信息，这是作者得创作署名权，请勿侵犯！作者微信公众号"文煞站长笔记网"，作者博客：www.wsbjw.cn。作者为广大用户提供免费虚拟主机、大容量虚拟主机、云服务器/VPS20元月/起！感谢大家得支持！
  </div>
  <!-- 复制一份文字用于无缝衔接滚动 -->
  <div style="display: inline-block; margin-left: 20px; animation: scrollText 50s linear infinite;">
    文煞CMS(API版本)，本系统由文煞研发，您可以免费使用，但是请保留版权信息，这是作者得创作署名权，请勿侵犯！作者微信公众号"文煞站长笔记网"，作者博客：www.wsbjw.cn。作者为广大用户提供免费虚拟主机、大容量虚拟主机、云服务器/VPS20元月/起！感谢大家得支持！
  </div>
  </div>
</div>

<!-- 主内容区域 -->
<div class="main-container">
<?php } ?>