/* ============================================================
 * 情报资讯网 · 样式（public）
 * 暗色大色块基调 + 霓虹强调色
 * 含：来源徽章、图文左右布局、后台管理样式
 * ============================================================ */

:root {
  --bg:        #0b0e14;
  --bg-soft:   #11161f;
  --bg-card:   #151b27;
  --bg-card-2: #1b2331;
  --line:      #232c3b;
  --txt:       #e6e9ef;
  --txt-dim:   #9aa6b8;
  --txt-faint: #6b7688;
  --accent:    #06b6d4;
  --robot:     #3b82f6;
  --ai:        #a855f7;
  --component: #f59e0b;
  --million:   #ec4899;
  --beacon:    #06b6d4;
  --case:      #10b981;
  --radius:    16px;
  --shadow:    0 8px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased; line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(120deg, #0d1420 0%, #141d2e 60%, #1a1330 100%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; flex: 0 0 auto; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #06b6d4, #a855f7);
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 0 22px rgba(6,182,212,.45);
}
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.brand-sub  { font-size: 12px; color: var(--txt-dim); }
.search-box { flex: 1 1 260px; min-width: 200px; position: relative; }
.search-box input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--txt); padding: 10px 14px 10px 38px; border-radius: 12px;
  font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(6,182,212,.18); }
.search-box::before {
  content: "🔍"; position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); font-size: 14px; opacity: .7;
}
.admin-link {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--line);
  color: var(--txt-dim); font-size: 13px; font-weight: 700;
  transition: color .2s, border-color .2s;
}
.admin-link:hover { color: var(--txt); border-color: var(--accent); }

/* ---------- 主体布局：左侧栏导航 + 内容 ---------- */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px;
  display: flex; align-items: flex-start; gap: 24px;
}
.sidebar {
  flex: 0 0 228px; position: sticky; top: 78px;
}
.sidebar .section-nav {
  max-width: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px; flex-wrap: nowrap;
}
.sidebar .nav-chip {
  width: 100%; justify-content: flex-start; border-radius: 12px;
}
.sidebar .nav-chip:hover { transform: none; }

/* ---------- 版块导航（芯片，移动端转横向滚动条） ---------- */
.section-nav {
  max-width: 1240px; margin: 0 auto; padding: 14px 20px 4px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.nav-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--line);
  color: var(--txt-dim); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .15s, border-color .2s, color .2s, background .2s;
  white-space: nowrap;
}
.nav-chip:hover { transform: translateY(-2px); color: var(--txt); }
.nav-chip .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent));
}
.nav-chip.active {
  color: #fff;
  background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--bg-card));
  border-color: var(--c, var(--accent));
  box-shadow: 0 0 18px color-mix(in srgb, var(--c, var(--accent)) 35%, transparent);
}

/* ---------- 主区 ---------- */
main { flex: 1 1 auto; min-width: 0; padding: 0; }

.hero {
  border-radius: var(--radius); padding: 30px 28px;
  background:
    radial-gradient(900px 300px at 12% -20%, rgba(168,85,247,.25), transparent),
    radial-gradient(700px 300px at 90% 0%, rgba(6,182,212,.22), transparent),
    var(--bg-card);
  border: 1px solid var(--line); margin-bottom: 26px;
}
.hero h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; }
.hero p { margin: 0; color: var(--txt-dim); max-width: 720px; }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; margin: 22px 0 8px;
}
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 800; }
.stat .lbl { font-size: 13px; color: var(--txt-dim); margin-top: 2px; }

.section-title { display: flex; align-items: center; gap: 12px; margin: 34px 0 16px; }
.section-title .bar {
  width: 6px; height: 24px; border-radius: 4px;
  background: var(--c, var(--accent)); box-shadow: 0 0 14px var(--c, var(--accent));
}
.section-title h2 { margin: 0; font-size: 20px; font-weight: 800; }
.section-title .desc { color: var(--txt-dim); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

/* ---------- 卡片 ---------- */
.card {
  position: relative; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; overflow: hidden; cursor: pointer;
  transition: transform .18s, border-color .2s, box-shadow .2s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--c, var(--accent)); opacity: .9;
}
.card:hover {
  transform: translateY(-4px); border-color: var(--c, var(--accent));
  box-shadow: 0 12px 34px rgba(0,0,0,.5),
              0 0 0 1px color-mix(in srgb, var(--c, var(--accent)) 40%, transparent);
}
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-faint); margin-bottom: 10px; flex-wrap: wrap; }
.card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; line-height: 1.45; }
.card .summary {
  margin: 0 0 12px; font-size: 13.5px; color: var(--txt-dim);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .foot { display: flex; flex-wrap: wrap; gap: 6px; }

/* 来源徽章 */
.src-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
}
.src-badge.trusted { color: #34d399; background: rgba(16,185,129,.15); }
.src-badge.normal  { color: #9aa6b8; background: rgba(154,166,184,.12); }
.src-badge.blocked { color: #ff6b6b; background: rgba(255,93,93,.16); }

.pill {
  font-size: 11.5px; color: var(--txt-dim); background: var(--bg-card-2);
  border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px;
}
.hot-flag { margin-left: auto; font-size: 11.5px; font-weight: 800; color: #ff5d5d; }

/* 管理员卡片管理工具（仅管理员可见） */
.card-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 3; }
.ctool {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-card-2); color: var(--txt-dim); cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: .15s; backdrop-filter: blur(2px);
}
.ctool:hover { color: #fff; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 24%, var(--bg-card-2)); }
.ctool.danger:hover { color: #fff; border-color: #ff5d5d; background: rgba(255,93,93,.22); }
/* 可删标签（管理员可点 ✕ 删除） */
.pill.rmtag { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 3px; }
.pill.rmtag b { font-weight: 800; opacity: .5; }
.pill.rmtag:hover { border-color: #ff5d5d; color: #ff8a8a; background: rgba(255,93,93,.12); }
.pill.rmtag:hover b { opacity: 1; }

/* 风向强度条 */
.strength { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; color: var(--txt-dim); }
.strength .track { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-card-2); overflow: hidden; }
.strength .fill { height: 100%; background: linear-gradient(90deg, var(--c, var(--accent)), #fff); border-radius: 999px; }

/* 图文卡片 */
.card.media { display: flex; gap: 14px; align-items: flex-start; }
.card.media.right { flex-direction: row-reverse; }
.card.media .thumb {
  width: 116px; height: 92px; object-fit: cover; border-radius: 10px;
  flex: 0 0 auto; background: var(--bg-card-2);
}
.card.media .body { flex: 1; min-width: 0; }

/* ---------- 详情弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(3,6,12,.72);
  backdrop-filter: blur(4px); display: none; align-items: flex-start;
  justify-content: center; padding: 60px 16px; overflow-y: auto;
}
.overlay.show { display: flex; }
.modal {
  width: min(760px, 100%); background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px; box-shadow: var(--shadow);
}
.modal .meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--txt-faint); margin-bottom: 12px; flex-wrap: wrap; }
.modal h2 { margin: 0 0 14px; font-size: 22px; line-height: 1.4; }
.modal .body { color: var(--txt-dim); font-size: 15px; }
.modal .body img.cover { width: 100%; border-radius: 12px; margin-bottom: 16px; }
.modal .close {
  position: sticky; top: 0; float: right; background: var(--bg-card-2);
  border: 1px solid var(--line); color: var(--txt); width: 34px; height: 34px;
  border-radius: 10px; cursor: pointer; font-size: 16px;
}
.modal .close:hover { border-color: var(--accent); }

.empty { text-align: center; color: var(--txt-faint); padding: 60px 20px; }

footer { border-top: 1px solid var(--line); color: var(--txt-faint); font-size: 12.5px; text-align: center; padding: 22px; }

/* ---------- 后台管理 ---------- */
.admin-wrap { max-width: 1040px; margin: 0 auto; padding: 24px 18px 60px; }
.admin-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.admin-head h1 { font-size: 22px; margin: 0; }
.admin-head .back { margin-left: auto; color: var(--txt-dim); font-size: 13px; }
.panel {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px;
}
.panel h3 { margin: 0 0 14px; font-size: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--txt-dim); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--txt); padding: 10px 12px; border-radius: 10px; font-size: 14px; outline: none;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-card-2); color: var(--txt); cursor: pointer; font-size: 14px; font-weight: 700;
  transition: border-color .2s, background .2s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, #06b6d4, #a855f7); border: none; color: #fff; }
.btn.danger { color: #ff6b6b; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 10px; background: var(--bg-soft);
  border: 1px solid var(--line); color: var(--txt-dim); cursor: pointer; font-size: 13.5px; font-weight: 700;
}
.tab.active { color: #fff; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--bg-card)); }
.list-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px; background: var(--bg-soft);
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-size: 14px; font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--txt-faint); }
.login-box { max-width: 380px; margin: 80px auto; }
.mark-select { display: inline-flex; gap: 6px; }
.mark-select .opt {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-soft); cursor: pointer; font-size: 12px; color: var(--txt-dim);
}
.mark-select .opt.on.trusted { color: #34d399; border-color: #34d399; }
.mark-select .opt.on.normal { color: #9aa6b8; border-color: #9aa6b8; }
.mark-select .opt.on.blocked { color: #ff6b6b; border-color: #ff6b6b; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #11161f; border: 1px solid var(--accent); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; z-index: 200;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .25s;
}
.toast.show { opacity: 1; }

/* ---------- 登录态（顶栏）/ 发布按钮 / 发布弹窗 ---------- */
.auth-box { display: flex; align-items: center; gap: 8px; }
.auth-mini {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-card); color: var(--txt); font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.auth-mini.primary { background: color-mix(in srgb, var(--accent) 22%, var(--bg-card)); border-color: var(--accent); color: #fff; }
.auth-mini:hover { border-color: var(--accent); }
.auth-user { font-size: 13px; color: var(--txt-dim); font-weight: 600; white-space: nowrap; }
.post-btn {
  margin-left: auto; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--c, var(--accent)); background: transparent;
  color: var(--c, var(--accent)); font-size: 13px; font-weight: 700; cursor: pointer;
}
.post-btn:hover { background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); }
.post-modal { max-width: 520px; max-height: 86vh; overflow: auto; }
.post-modal h2 { margin: 0 0 14px; font-size: 18px; }
.post-modal .auth-form { gap: 8px; }
.post-modal label { font-size: 13px; color: var(--txt-dim); font-weight: 600; }
.post-modal label.chk { display: flex; align-items: center; gap: 8px; color: var(--txt); font-weight: 600; }
.post-modal select, .post-modal textarea, .post-modal input[type="text"] {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--txt);
  font-size: 14px; font-family: inherit; box-sizing: border-box;
}
.post-modal textarea { resize: vertical; }

/* ---------- 后台账号管理 ---------- */
.user-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--bg-card); }
.u-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.u-name { font-weight: 700; font-size: 15px; }
.u-role { padding: 5px 8px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); color: var(--txt); }
.u-time { font-size: 12px; color: var(--txt-dim); }
.u-secs { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
.sec-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--txt-dim); cursor: pointer; }
.sec-checks { display: flex; flex-wrap: wrap; gap: 10px; }
.u-secs-note { font-size: 13px; color: var(--txt-dim); }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .site-header { position: static; }
  .header-inner { padding: 12px 14px; }
  .brand-name { font-size: 17px; }
  .hero { padding: 22px 18px; } .hero h1 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .layout { flex-direction: column; gap: 14px; padding: 16px 14px 60px; }
  /* 左栏 → 顶部单行横向滚动条，彻底解决小屏导航过高 */
  .sidebar { flex: none; width: 100%; position: sticky; top: 0; z-index: 45; }
  .sidebar .section-nav {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    padding: 8px 0; gap: 8px; -webkit-overflow-scrolling: touch;
    background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  }
  .sidebar .nav-chip { width: auto; flex: 0 0 auto; }
  .sidebar .nav-chip:hover { transform: none; }
  .card.media { flex-direction: column; }
  .card.media .thumb { width: 100%; height: 160px; }
  .row2 { grid-template-columns: 1fr; }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.card, .stat, .hero { animation: rise .35s ease both; }

/* ============================================================
 * 主题：亮色模式 + 主题切换按钮 + 后台文章分组
 * ============================================================ */

/* ---------- 亮色主题（默认暗色，data-theme=light 覆盖变量） ---------- */
[data-theme="light"] {
  --bg:        #f3f5fa;
  --bg-soft:   #ffffff;
  --bg-card:   #ffffff;
  --bg-card-2: #eef1f7;
  --line:      #e3e8f0;
  --txt:       #1a2233;
  --txt-dim:   #586273;
  --txt-faint: #8b96a8;
}
[data-theme="light"] .site-header {
  background: linear-gradient(120deg, #ffffff 0%, #eef2fb 60%, #f4ecff 100%);
  border-bottom: 1px solid var(--line);
}
/* 亮色下激活态文字改深色，避免白字落在浅色块上看不清 */
[data-theme="light"] .nav-chip.active,
[data-theme="light"] .tab.active { color: var(--txt); }

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--line);
  color: var(--txt); font-size: 18px; cursor: pointer;
  display: grid; place-items: center; line-height: 1;
  transition: border-color .2s, transform .15s, background .2s;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-2px); }

/* ---------- 后台：文章按版块分组 ---------- */
.news-group { margin-bottom: 16px; }
.group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 800; color: var(--txt);
  padding: 8px 12px; border-radius: 10px; margin-bottom: 8px;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--bg-card));
  border: 1px solid var(--line);
  border-left: 4px solid var(--c, var(--accent));
  cursor: pointer; user-select: none; transition: background .15s;
}
.group-head:hover { background: color-mix(in srgb, var(--c, var(--accent)) 26%, var(--bg-card)); }
.group-head .chev {
  display: inline-block; font-size: 11px; line-height: 1; color: var(--txt-dim);
  transition: transform .2s ease; transform: rotate(0deg);
}
.news-group.open .group-head .chev { transform: rotate(90deg); }
.group-head .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent));
}
.group-count {
  margin-left: auto; font-size: 12px; color: var(--txt-dim);
  background: var(--bg-card-2); padding: 1px 9px; border-radius: 999px;
}
.group-items { display: none; }              /* 默认收起 */
.news-group.open .group-items { display: block; }  /* 点击展开 */
.group-items .list-item:last-child { margin-bottom: 0; }
