/* ============================================================
   江南武校管理后台 — admin.css
   复用站点色系：墨黑 / 朱红 / 鎏金 / 宣纸白 / 石青
   ============================================================ */

:root {
  --c-ink:      #0B0F14;
  --c-vermilion:#B3202A;
  --c-gold:     #C9A227;
  --c-paper:    #F7F4EE;
  --c-slate:    #2A3B47;
  --c-border:   #D8D2C8;
  --c-muted:    #8A8278;
  --radius:     4px;
  --max-w:      960px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.7;
  color: var(--c-ink);
  background: var(--c-paper);
  min-height: 100vh;
}
a { color: var(--c-vermilion); text-decoration: none; }
a:hover { text-decoration: underline; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .75rem; }
th { font-weight: 600; }

/* ── 登录页 ── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: #fff; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 48px 36px; width: 100%; max-width: 380px;
}
.login-card h1 {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 1.5rem; letter-spacing: .02em;
  color: var(--c-ink); text-align: center; margin-bottom: 1.5rem;
}
.login-card .brand {
  display: block; width: 48px; height: 4px;
  background: var(--c-vermilion); border-radius: 2px;
  margin: 0 auto 1.5rem;
}

/* ── 表单元素 ── */
.field { margin-bottom: 1rem; }
.field label {
  display: block; font-size: .875rem; font-weight: 500;
  color: var(--c-slate); margin-bottom: .25rem;
}
.field input, .field textarea, .field select {
  display: block; width: 100%; padding: .6rem .75rem;
  font-size: 1rem; line-height: 1.5;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: #fff; color: var(--c-ink);
  transition: border-color .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--c-vermilion);
  box-shadow: 0 0 0 2px rgba(179,32,42,.12);
}
.field textarea { resize: vertical; min-height: 120px; }

/* ── 按钮 ── */
.btn {
  display: inline-block; padding: .55rem 1.2rem;
  font-size: .9375rem; font-weight: 500;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: background .2s, opacity .2s;
  line-height: 1.5;
}
.btn-primary   { background: var(--c-vermilion); color: #fff; }
.btn-primary:hover { background: #981a22; text-decoration: none; }
.btn-outline   { background: transparent; color: var(--c-vermilion); border: 1px solid var(--c-vermilion); }
.btn-outline:hover { background: var(--c-vermilion); color: #fff; text-decoration: none; }
.btn-sm        { padding: .35rem .8rem; font-size: .8125rem; }
.btn-danger    { background: #d9534f; color: #fff; }
.btn-danger:hover { background: #c9302c; text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── 顶栏 ── */
.topbar {
  background: var(--c-ink); color: #fff; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; position: sticky; top: 0; z-index: 100;
}
.topbar-title {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 1.125rem; letter-spacing: .02em;
}
.topbar-title span { color: var(--c-gold); }
.topbar-nav { display: flex; gap: 20px; align-items: center; }
.topbar-nav a { color: rgba(255,255,255,.75); font-size: .875rem; }
.topbar-nav a:hover, .topbar-nav a.active { color: #fff; text-decoration: none; }
.topbar-nav .logout { color: var(--c-gold); }

/* ── 主内容区 ── */
.main { max-width: var(--max-w); margin: 0 auto; padding: 32px 24px; }

/* ── 卡片 / 统计 ── */
.stat-row { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 180px;
  background: #fff; border-radius: 6px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.stat-card .num {
  font-family: Georgia, serif; font-size: 2rem;
  color: var(--c-vermilion); line-height: 1;
}
.stat-card .label { font-size: .8125rem; color: var(--c-muted); margin-top: .5rem; }

/* ── 面板 ── */
.panel {
  background: #fff; border-radius: 6px; padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05); margin-bottom: 24px;
}
.panel h2 {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 1.25rem; letter-spacing: .02em;
  color: var(--c-ink); margin-bottom: 1rem;
  padding-bottom: .5rem; border-bottom: 2px solid var(--c-gold);
}

/* ── 表格 ── */
.data-table { width: 100%; font-size: .875rem; }
.data-table th {
  background: var(--c-paper); color: var(--c-slate);
  font-weight: 600; border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
}
.data-table td {
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.data-table tr:hover td { background: rgba(179,32,42,.03); }
.data-table .badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: .75rem; font-weight: 500;
}
.badge-unread  { background: #fce4e4; color: var(--c-vermilion); }
.badge-read    { background: #e8e8e8; color: #666; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-published { background: #d4edda; color: #155724; }
.badge-cancelled { background: #e8e8e8; color: #666; }

/* ── 提示信息 ── */
.flash {
  padding: .75rem 1rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1rem;
}
.flash-ok   { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-err  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── 分页（简单） ── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 1rem; }
.pagination a, .pagination span {
  display: inline-block; padding: .3rem .7rem;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  font-size: .8125rem; color: var(--c-slate);
}
.pagination .current { background: var(--c-vermilion); color: #fff; border-color: var(--c-vermilion); }

/* ── 空状态 ── */
.empty { text-align: center; color: var(--c-muted); padding: 2rem 0; font-size: .9375rem; }

/* ── 响应式 ── */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 10px; }
  /* 手机端：标题不缩、导航横向滚动，禁止把「栏目管理」压成逐字竖排 */
  .topbar-title { font-size: .875rem; flex: 0 0 auto; white-space: nowrap; }
  .topbar-nav {
    flex: 1 1 auto; min-width: 0; gap: 14px;
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-nav a { font-size: .875rem; white-space: nowrap; flex: 0 0 auto; }
  .main { padding: 20px 12px; }
  .stat-row { flex-direction: column; }
  .data-table { font-size: .75rem; }
  .data-table th, .data-table td { padding: .35rem .5rem; }
  /* 横向可滚动表格 */
  .panel { overflow-x: auto; }
  .login-card { padding: 32px 20px; }
}

/* ============================================================
   编辑页：粘性工具条 + 折叠卡片 + 字段分组
   ============================================================ */

/* ── 粘性操作条 ── */
.edit-toolbar {
  position: sticky; top: 56px; z-index: 90;
  background: #fff; border-bottom: 2px solid var(--c-gold);
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.edit-toolbar-left {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.edit-back-link {
  font-size: .875rem; color: var(--c-slate); text-decoration: none;
}
.edit-back-link:hover { text-decoration: underline; }
.edit-page-name {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 1.125rem; font-weight: 600; color: var(--c-ink);
}
.edit-status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: .75rem; font-weight: 500;
}
.edit-status-badge.badge-published { background: #d4edda; color: #155724; }
.edit-status-badge.badge-draft { background: #fff3cd; color: #856404; }
.edit-toolbar-right {
  display: flex; align-items: center; gap: 8px;
}

/* ── 页面信息折叠 ── */
.edit-page-info summary {
  font-size: .9375rem; font-weight: 600; color: var(--c-slate); cursor: pointer;
}
.edit-page-info summary:hover { color: var(--c-ink); }

/* ── 区块卡片列表 ── */
.edit-block-list { margin-top: 1rem; }

.edit-block-card {
  background: #fff; border: 1px solid var(--c-border);
  border-radius: 8px; margin-bottom: 10px; overflow: hidden;
}
.edit-block-card.expanded {
  border-left: 3px solid var(--c-vermilion);
}

.edit-block-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; gap: 8px; flex-wrap: wrap;
  background: var(--c-paper); border-bottom: 1px solid transparent;
  transition: background .2s;
}
.edit-block-card.expanded .edit-block-summary {
  border-bottom-color: var(--c-border);
}
.edit-block-summary-left {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  flex: 1; min-width: 0;
}
.edit-block-seq {
  font-size: .8125rem; font-weight: 700; color: var(--c-muted);
  flex-shrink: 0;
}
.edit-block-type-name {
  font-size: .875rem; font-weight: 600; color: var(--c-vermilion);
  flex-shrink: 0;
}
.edit-block-summary-text {
  font-size: .8125rem; color: var(--c-slate);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.edit-block-summary-right {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.edit-block-summary-right form { display: inline; }

.edit-block-body {
  padding: 16px 20px; border-top: none;
}

/* ── 字段分组 ── */
.field-group {
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 1px dashed #e0e0e0;
}
.field-group:last-child { border-bottom: none; }
.field-group-title {
  font-size: .8125rem; font-weight: 600; color: var(--c-gold);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: .5rem;
}

/* ── 添加区块 ── */
.edit-add-block {
  margin-top: 1rem; padding: 16px; background: #fff;
  border: 1px dashed var(--c-border); border-radius: 8px;
}
.edit-add-block-form {
  display: flex; align-items: end; gap: 8px;
}
.edit-add-block-select {
  padding: .4rem .6rem; font-size: .875rem; border: 1px solid var(--c-border);
  border-radius: 4px; background: #fff; min-height: 36px;
}

/* ── 响应式补充 ── */
@media (max-width: 640px) {
  .edit-toolbar { top: 48px; padding: 8px 12px; }
  .edit-toolbar-left { gap: 6px; }
  .edit-page-name { font-size: .9375rem; }
  .edit-block-summary { padding: 12px 14px; }
  .edit-block-summary-left { flex-wrap: wrap; }
  .edit-block-summary-right { width: 100%; justify-content: flex-end; margin-top: 4px; }
  .edit-block-summary-right .btn { min-height: 44px; }
  .edit-block-body { padding: 12px 14px; }
  .edit-add-block { padding: 12px; }
  .edit-add-block-form { flex-direction: column; align-items: stretch; }
  .edit-add-block-select { width: 100%; min-height: 44px; font-size: .9375rem; }
  .edit-add-block-form .btn { width: 100%; min-height: 44px; }
  .edit-toolbar-right { width: 100%; justify-content: stretch; }
  .edit-toolbar-right .btn { flex: 1; min-height: 44px; text-align: center; }
}

/* 手机端：工具条里的页面名截断成一行（原来会占两行且与站点名重复） */
@media (max-width: 640px) {
  .edit-toolbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .edit-toolbar-left { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; }
  .edit-page-name {
    flex: 1 1 auto; min-width: 0; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  .edit-toolbar-right { flex: 1 1 100%; }
  .edit-toolbar-right .btn { flex: 1 1 auto; }
}

@media (max-width: 640px) {
  /* 「返回页面列表」与「已发布」徽章不许被压成两行 */
  .edit-back-link, .edit-status-badge { white-space: nowrap; flex: 0 0 auto; }
}

/* ============================================================
   左侧功能区导航（2026-12-01 重构）
   ============================================================ */
body { padding-left: 220px; }

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
  background: var(--c-ink); color: #fff;
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 200;
}
.sidebar-brand {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 1.125rem; letter-spacing: .02em;
  padding: 18px 20px; flex: 0 0 auto;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand span { color: var(--c-gold); }
.sidebar-nav { flex: 1 1 auto; padding: 8px 0 16px; }
.nav-group { display: block; }
.nav-group summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 16px 20px 6px; font-size: .72rem; font-weight: 600;
  color: var(--c-gold); letter-spacing: .12em;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before {
  content: "▾"; display: inline-block; margin-right: 6px;
}
.nav-group:not([open]) summary::before { content: "▸"; }
.sidebar-nav a {
  display: block; padding: 8px 20px 8px 26px;
  color: rgba(255,255,255,.72); font-size: .9rem;
  text-decoration: none; border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar-nav a.active {
  background: rgba(179,32,42,.32); color: #fff;
  border-left-color: var(--c-vermilion);
}
.sidebar-footer {
  flex: 0 0 auto; padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: .8125rem;
}
.sidebar-user { color: rgba(255,255,255,.65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer a { color: var(--c-gold); text-decoration: none; white-space: nowrap; }
.sidebar-footer a:hover { text-decoration: underline; }

/* 主内容区让出侧栏并加宽，适应后台表格 */
.main { max-width: 1200px; margin: 0 auto; }
/* 编辑页粘性工具条：原来贴着 56px 顶栏，现在贴视口顶部 */
.edit-toolbar { top: 0; }

/* 窄屏：侧栏退化为顶部横滚导航 */
@media (max-width: 900px) {
  body { padding-left: 0; }
  .sidebar {
    position: static; width: 100%; height: auto; max-height: none;
    flex-direction: row; align-items: center; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
  }
  .sidebar-brand { padding: 10px 14px; font-size: 1rem; border-bottom: none; white-space: nowrap; }
  .sidebar-nav { display: flex; gap: 4px; padding: 6px 10px; }
  .nav-group { display: contents; }
  .nav-group summary { display: none; }
  .sidebar-nav a {
    white-space: nowrap; padding: 6px 12px; font-size: .8125rem;
    border-left: none; border-bottom: 2px solid transparent; border-radius: 4px;
  }
  .sidebar-nav a.active { background: rgba(179,32,42,.32); border-bottom-color: var(--c-vermilion); }
  .sidebar-footer { padding: 8px 14px; border-top: none; }
  .edit-toolbar { top: 0; }
  .main { max-width: none; }
}

/* ============================================================
   统计仪表盘（首页图形）
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.grid-2 .panel { margin-bottom: 0; }
.trend-chart { width: 100%; height: auto; display: block; }

/* 功能分布横条 */
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .875rem; }
.hbar-label { display: flex; align-items: center; gap: 6px; width: 150px; min-width: 0; color: var(--c-slate); }
.hbar-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; background: var(--c-paper); border-radius: 4px; height: 20px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--c-vermilion); border-radius: 4px; }
.hbar-val { width: 40px; text-align: right; color: var(--c-slate); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .grid-2 .panel { margin-bottom: 24px; }
  .hbar-label { width: 120px; }
}
