/* 管理界面专用样式（复用 style.css 的配色变量）
 *
 * 登录在独立页面（login.html），管理面板拆成三个：
 *   /admin/overview   概览 + 统计 + 全部新闻 + 清理
 *   /admin/sources    境外源开关 + 手动采集
 *   /admin/password   修改密码
 * 共用 admin-common.js（api 封装 / 顶栏 / 转义）。
 */

.admin-body {
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
}

/* ── 顶部导航 ──────────────────────────── */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.admin-nav a {
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.admin-nav a:hover {
  color: var(--text);
}
.admin-nav a.on {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.admin-nav .spacer {
  flex: 1;
}
.admin-nav .site {
  color: var(--text-faint);
  font-size: 0.8125rem;
}

/* ── 面板 ────────────────────────────────── */
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 24, 32, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.admin-head h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.admin-head .who {
  color: var(--text-faint);
  font-size: 0.75rem;
}

.head-actions {
  display: flex;
  gap: 0.5rem;
}

.admin-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.card.danger {
  border-color: rgba(239, 68, 68, 0.3);
}

.hint {
  color: var(--text-faint);
  font-size: 0.8125rem;
  margin: -0.5rem 0 0.75rem;
}

/* ── 开关 ────────────────────────────────── */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.switch-name {
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.switch-desc {
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.switch-desc .dim {
  color: var(--text-faint);
}

.switch {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
  padding: 0;
}

.switch[aria-checked='true'] {
  background: var(--accent);
  border-color: var(--accent);
}

.switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.switch[aria-checked='true'] .knob {
  transform: translateX(20px);
}

.meta {
  color: var(--text-faint);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.action-row .meta {
  margin-top: 0;
}

.danger-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn.danger-btn {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.btn.danger-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ── 修改密码 ──────────────────────────── */
.pwd-form {
  max-width: 26rem;
}
.pwd-form .field {
  display: block;
  margin-bottom: 0.875rem;
}
.pwd-form .field > span {
  display: block;
  margin-bottom: 0.3125rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
}
.pwd-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
}
.pwd-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.pwd-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pwd-actions .meta {
  margin-top: 0;
}

/* 密码强度指示条 */
.pwd-strength {
  height: 4px;
  margin: -0.5rem 0 0.875rem;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.pwd-strength span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.2s, background 0.2s;
}
.pwd-strength.s1 span { width: 20%;  background: #ef4444; }
.pwd-strength.s2 span { width: 40%;  background: #f97316; }
.pwd-strength.s3 span { width: 60%;  background: #eab308; }
.pwd-strength.s4 span { width: 80%;  background: #84cc16; }
.pwd-strength.s5 span { width: 100%; background: #22c55e; }

/* 说明列表 */
.tips {
  margin: 0;
  padding-left: 1.125rem;
  color: var(--text-dim);
  font-size: 0.8125rem;
  line-height: 1.9;
}

/* ── 概览：快速入口 ────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.quick {
  display: block;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.quick:hover {
  border-color: var(--accent);
  background: rgba(56, 132, 255, 0.07);
  transform: translateY(-2px);
}
.quick .qi { font-size: 1.375rem; line-height: 1.2; }
.quick .qt {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.quick .qd {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ── 统计：趋势柱状图（纯 CSS，无依赖）───── */
.trend {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding: 0.5rem 0;
  overflow-x: auto;
}
.trend .col {
  position: relative;
  flex: 1 1 0;
  min-width: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}
.trend .stack {
  display: flex;
  flex-direction: column-reverse;
  height: 100%;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
}
.trend .seg {
  display: block;
  width: 100%;
  min-height: 0;
}
.trend .seg-public { background: var(--accent); }
.trend .seg-hidden { background: rgba(148, 163, 184, 0.55); }

.trend .lbl {
  margin-top: 0.25rem;
  font-size: 0.625rem;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
}

/* hover 提示 */
.trend .tip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  padding: 0.375rem 0.5rem;
  font-size: 0.6875rem;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--text);
  background: #1c2530;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 10;
}
.trend .col:hover .tip { display: block; }

.legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.legend .sw-public { background: var(--accent); }
.legend .sw-hidden { background: rgba(148, 163, 184, 0.55); }

/* 表格内的横向条 */
.bar-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 130px;
}
.bar {
  display: inline-block;
  height: 8px;
  border-radius: 4px;
  min-width: 2px;
}
.bar-total { background: var(--accent); }
.bar-public { background: var(--accent); }
.bar-hidden { background: rgba(148, 163, 184, 0.55); }
.bar-num {
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* 频道分布横条 */
.ch-bars {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}
.ch-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.ch-name {
  flex: 0 0 7.5rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-row .bar { flex: 1; }
.ch-num {
  flex: 0 0 3.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
  text-align: right;
}

/* 新闻页分页按钮 */
.pager {
  margin-top: 1rem;
  text-align: center;
}
.pager .btn {
  min-width: 12rem;
}

/* 时间范围选择 */
.range-sel {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

/* 新闻搜索框 */
.kw {
  flex: 0 1 200px;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}
.kw:focus { border-color: var(--accent); }
.kw::placeholder { color: var(--text-faint); }

/* 提示文字的三种状态 */
.meta.err { color: #f87171; }
.meta.ok  { color: #4ade80; }
.meta.warn{ color: #fbbf24; }

/* ── 统计卡 ────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.75rem;
}

.stat .n {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.stat .l {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.125rem;
}

.stat .n.ok { color: #4ade80; }
.stat .n.warn { color: #fbbf24; }

/* ── 表格 ────────────────────────────────── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  table-layout: fixed;
}

.tbl th,
.tbl td {
  text-align: left;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tbl th {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tbl tr:last-child td {
  border-bottom: none;
}

.tbl .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.yes { color: #4ade80; }
.no { color: var(--text-faint); }

/* ── 列表 ────────────────────────────────── */
.list-tools {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.list-tools select {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  font-family: inherit;
}

/**
 * 新闻条目样式已移除（2026-10-23）。
 *
 * 管理端新闻页改用与前台**完全相同**的渲染代码（/news-render.js），
 * 条目用 .news-item 类，样式来自 style.css（admin-news.html 已引入）。
 * 好处是两端视觉天然一致，不用维护两份。
 */

/* 频道标签：区分对外/不对外 */
.ch-tag {
  padding: 0.0625rem 0.375rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  background: rgba(255, 255, 255, 0.08);
}

.ch-tag.ch-private {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.empty {
  color: var(--text-faint);
  text-align: center;
  padding: 2rem 0;
  font-size: 0.875rem;
}

@media (max-width: 640px) {
  .admin-main { padding: 1rem; }
  .admin-head { padding: 0.75rem 1rem; }
  .switch-row { flex-direction: column; align-items: flex-start; }
}