/* ============================================================
   设计概念：导航图表（取"导航"二字的本义）
   配色：深墨蓝 + 冷雾白纸面 + 信标橙 + 港湾青
   类型：Space Grotesk（英文/数字标题）+ 系统中文字体（正文）
        + JetBrains Mono（点击数/频道代码等数据字段）
   签名元素：每个分类的"频道代码"徽标 + 刻度分隔线（频率刻度意象）
   ============================================================ */

:root {
  --ink: #14233b;       /* 主文字 / 头部背景 */
  --ink-soft: #2c3e57;
  --paper: #eef2f6;     /* 页面背景 */
  --card: #ffffff;      /* 卡片背景 */
  --beacon: #e8763c;    /* 信标橙：主强调色 */
  --beacon-dark: #c75f2a;
  --harbor: #2f7a78;    /* 港湾青：辅助强调色（点击/活跃状态） */
  --slate: #5b6b7a;     /* 次要文字 */
  --line: #d8dee6;      /* 分割线 */
  --line-strong: #b9c3cd;
  --radius: 10px;
  --maxw: 1180px;
  --font-display: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--beacon);
  outline-offset: 2px;
}

/* 消息通知条 */
.flash {
  padding: 14px 24px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

.flash-success {
  background: #e6f8f0;
  color: #1b7f6e;
  border-bottom: 1px solid #c3e8e2;
}

.flash-error {
  background: #fde2e2;
  color: #c0392b;
  border-bottom: 1px solid #f5b4b4;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------- 顶部栏 ---------------- */
/* --- 顶部栏替换 --- */
.topbar {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* --- Tab 导航条替换 --- */
.tab-nav-wrapper {
  background: #fff;
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 56px; /* 如果后续修改了头部高度，这里同步微调即可 */
  z-index: 40;
}

.tab-nav {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  padding: 0 24px;
  gap: 0;
  border-bottom: none; /* 外层 wrap 已经有边框了 */
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand svg { display: block; }

/* ---------------- 顶部搜索框 (聚合搜索增强版) ---------------- */
.search {
  flex: 1;
  max-width: 600px; /* 稍微加宽一点，容纳下拉框 */
  display: flex;
  align-items: stretch;
  margin: 0 auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-bottom: 3px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

/* 当搜索框内任何元素获得焦点时，高亮整个容器 */
.search:focus-within {
  background: rgba(255, 255, 255, 0.18);
  border-bottom-color: var(--beacon);
}

.search-engine {
  border: none;
  background: transparent;
  color: #fff;
  padding: 0 8px 0 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
}

/* 下拉菜单里的选项使用深色背景，防止白字看不清 */
.search-engine option {
  background: var(--ink);
  color: #fff;
}

.search-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 8px 4px;
}

.search input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  padding: 9px 14px 9px 10px;
  font-size: 14px;
  min-width: 0;
  outline: none;
}

.search input::placeholder { color: rgba(255, 255, 255, 0.55); }

.search button {
  border: none;
  background: var(--beacon);
  color: #fff;
  padding: 0 18px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-body);
}

.search button:hover { background: var(--beacon-dark); }



.auth-link {
  font-size: 14px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 7px 14px;
  border-radius: 8px;
}

.auth-link:hover { border-color: var(--beacon); color: var(--beacon); }

/* Tab 导航 */


.tab-btn {
  border: none;
  background: transparent;
  color: var(--slate);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  font-family: var(--font-body);
  position: relative;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--beacon);
  border-bottom-color: var(--beacon);
}

.tab-badge {
  display: inline-block;
  background: var(--beacon);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.tab-content {
  display: none;
}

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

/* ---------------- 分类速达条 ---------------- */
/* --- 分类速达条外层包裹（新增：负责全宽背景和吸顶） --- */
.chip-nav-wrapper {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 106px; /* 核心修正：顶部Topbar(56px) + Tab导航(50px) = 106px，使其精准贴在Tab栏下方吸顶 */
  z-index: 35;
}

/* --- 修改后的 .chip-nav（负责内部元素对齐主轴） --- */
.chip-nav {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  overflow-x: auto;
  scrollbar-width: thin;
  /* 移除了原本的 background、border 和 position，完全交由外层 wrapper 控制 */
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
  color: var(--slate);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--harbor);
  background: rgba(47, 122, 120, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.chip:hover, .chip.active {
  border-color: var(--beacon);
  color: var(--ink);
  background: rgba(232, 118, 60, 0.07);
}

/* ---------------- 主内容 ---------------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.cat-section { margin-bottom: 44px; scroll-margin-top: 110px; }

.cat-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.cat-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fff;
  background: var(--ink);
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}

.cat-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}

.cat-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slate);
}

/* 刻度分隔线：呼应"频率刻度"的导航意象 */
.tick-line {
  height: 10px;
  margin: 10px 0 20px;
  background-image: repeating-linear-gradient(
    to right,
    var(--line-strong) 0,
    var(--line-strong) 1px,
    transparent 1px,
    transparent 10px
  );
  background-position: bottom;
  background-size: auto 100%;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* 这里将 230px 改为 200px */
  gap: 14px;
}

/* --- 卡片整体瘦身 --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px; /* 内边距缩小（原为 14px） */
  display: flex;
  flex-direction: column;
  gap: 4px; /* 元素间距缩小（原为 8px） */
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative; 
  overflow: hidden; /* 防止右上角的直角角标溢出卡片的圆角 */
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--beacon);
  box-shadow: 0 6px 18px rgba(20, 35, 59, 0.08);
}

.card-top { 
  display: flex; 
  align-items: center; 
  gap: 8px; /* 原为 10px */ 
}

.card-icon {
  width: 28px; /* 图标等比缩水（原为 36px） */
  height: 28px;
  border-radius: 6px;
  /* 下方的原有属性不用动 */
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-soft);
}

.card-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: #fff;
}

.card-title {
  font-size: 14px; /* 稍微调小半号字 */
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- 新增的角标样式 --- */
.click-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(47, 122, 120, 0.08); /* 采用淡淡的港湾青色背景，不喧宾夺主 */
  color: var(--harbor);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-bottom-left-radius: 6px; /* 仅左下角带圆角，贴合卡片边框 */
  font-weight: 600;
  z-index: 2;
}

.card-desc {
  font-size: 12.5px;
  color: var(--slate);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--harbor);
  display: flex;
  align-items: center;
  gap: 5px;
}

.click-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--harbor);
}

.cat-pill {
  font-family: var(--font-body);
  background: rgba(20, 35, 59, 0.06);
  color: var(--ink-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

mark {
  background: var(--beacon);
  color: #fff;
  padding: 0 2px;
  border-radius: 3px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--slate);
}

.empty-state h2 {
  font-family: var(--font-display);
  color: var(--ink);
}

/* 无搜索结果时的提示 */
.no-result {
  display: none;
  text-align: center;
  padding: 40px 0;
  color: var(--slate);
  font-size: 14px;
}

/* ---------------- 页脚 ---------------- */
footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--slate);
  padding: 24px;
  border-top: 1px solid var(--line);
}
/* 后台导航菜单 */
.admin-nav {
  display: flex;
  gap: 0;
  align-items: center;
}

.nav-link {
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 16px;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-link:hover {
  color: #fff;
}

.nav-link.active {
  color: #fff;
  border-bottom-color: var(--beacon);
}

/* 后台内容区域 */
.admin-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.admin-header h1 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0;
}

.btn-add {
  background: var(--beacon);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-add:hover { background: var(--beacon-dark); }

/* 后台表格 */
.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.admin-table th {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.admin-table tbody tr:hover {
  background: rgba(232, 118, 60, 0.03);
}

.btn-sm {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  margin-right: 6px;
}

.btn-sm-edit {
  color: var(--beacon);
  border-color: var(--beacon);
}

.btn-sm-edit:hover { background: rgba(232, 118, 60, 0.1); }

.btn-sm-delete {
  color: #d32f2f;
  border-color: #d32f2f;
}

.btn-sm-delete:hover { background: rgba(211, 47, 47, 0.1); }

.empty-table {
  text-align: center;
  padding: 40px;
  color: var(--slate);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .chip-nav { padding: 8px 16px; top: 96px; }
  main { padding: 24px 16px 50px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
/* ---------------- 登录 / 注册页 ---------------- */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(20, 35, 59, 0.06);
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 0 0 6px;
}

.auth-sub {
  color: var(--slate);
  font-size: 13px;
  margin: 0 0 22px;
}

.field { margin-bottom: 15px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--paper);
  font-family: var(--font-body);
}

.field input:focus-visible {
  outline: none;
  border-color: var(--beacon);
  box-shadow: 0 0 0 3px rgba(232, 118, 60, 0.15);
  background: #fff;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--beacon);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  margin-top: 6px;
}

.btn-primary:hover { background: var(--beacon-dark); }

.form-msg {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 18px;
  background: #fdeee7;
  color: #b8451f;
}

.form-msg ul { margin: 0; padding-left: 18px; }

.auth-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--slate);
}

.auth-foot a { color: var(--beacon); font-weight: 600; }

.user-greet {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

/* 卡片悬浮提示 */
.card-tooltip {
  position: fixed;
  background: rgba(20, 35, 59, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  max-width: 280px;
  word-wrap: break-word;
  white-space: pre-wrap; /* 新增这一行：允许支持 \n 换行显示 */
  pointer-events: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: tooltipFade 0.2s ease-out;
}

@keyframes tooltipFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}