/* ============================================================
   没毛羊 | 专注全网线报活动资讯  —  Notion 风格（前台 + 后台）
   背景 #f7f6f3 · 文字 #37352f · 边框 #e5e7eb
   强调 #2eaadc · 危险 #eb5757 · 成功 #0f7b6c
   交互：hover #efedea / active #e3e1db，仅颜色过渡 150ms
   ============================================================ */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f7f6f3;
  color: #37352f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  font-size: 15px;
}
.container { max-width: 780px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶栏 ---------- */
.top { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 48px; }
.logo {
  font-size: 18px; font-weight: 700; color: #37352f; text-decoration: none;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top nav { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.top nav a {
  color: #37352f; text-decoration: none; font-size: 14px;
  padding: 6px 10px; border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}
.top nav a:hover { background: #efedea; }
.top nav a.active { color: #2eaadc; font-weight: 500; }

main { padding: 22px 0 36px; }

/* ---------- 列表头 ---------- */
.list-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; }
.list-head h1 { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.total { color: #9b9791; font-size: 13px; }

/* ---------- 帖子列表 ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item {
  display: flex; gap: 12px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: background-color .15s ease;
}
.post-item:hover { background: #fbfaf8; }
.post-thumb { flex: 0 0 88px; border-radius: 6px; overflow: hidden; align-self: flex-start; }
.post-thumb img { width: 88px; height: 62px; object-fit: cover; display: block; background: #efedea; }
.post-main { flex: 1; min-width: 0; }
.post-title {
  font-size: 16px; font-weight: 600; color: #37352f; text-decoration: none; display: block; line-height: 1.45;
  transition: color .15s ease;
}
.post-title:hover { color: #2eaadc; }
.post-summary {
  color: #6b7280; font-size: 13px; margin-top: 3px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.post-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; color: #9b9791; font-size: 12px; }
.badge {
  background: #eff6ff; color: #2eaadc; border-radius: 4px;
  padding: 1px 8px; font-size: 12px; font-weight: 500;
  text-decoration: none; display: inline-block;
}
a.badge:hover { opacity: 0.82; }

/* ---------- 详情页 ---------- */
.detail {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 24px 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  margin-top: 15px;
}
.detail h1 { font-size: 22px; margin: 0 0 12px; line-height: 1.4; font-weight: 700; letter-spacing: -0.01em; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 14px; color: #9b9791; font-size: 13px;
  padding-bottom: 14px; border-bottom: 1px solid #efedea;
}
.detail-meta a { color: #2eaadc; text-decoration: none; }
.detail-body { padding-top: 26px; font-size: 15px; word-break: break-word; color: #37352f; }
.detail-body a { color: #2eaadc; }
.back { margin-top: 18px; font-size: 14px; }
.back a { color: #37352f; text-decoration: none; padding: 6px 10px; border-radius: 6px; transition: background-color .15s ease; }
.back a:hover { background: #efedea; }

/* ---------- 帖子图片 ---------- */
.post-images {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px;
  margin-top: 20px; padding-top: 16px; border-top: 1px dashed #e5e7eb;
}
.post-images a { display: block; }
.post-images img { width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; display: block; background: #efedea; }

/* ---------- 分页 ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; }
.pager a, .pager .cur {
  display: inline-block; min-width: 32px; padding: 5px 11px; text-align: center;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  color: #37352f; text-decoration: none; font-size: 13px;
  transition: background-color .15s ease, color .15s ease;
}
.pager a:hover { background: #efedea; }
.pager .cur { background: #2eaadc; border-color: #2eaadc; color: #fff; }

.empty {
  background: #fff; border: 1px dashed #e5e7eb; border-radius: 8px;
  padding: 44px 20px; text-align: center; color: #9b9791; font-size: 14px;
}
.muted { color: #b8b4ad; }

.foot { border-top: 1px solid #e5e7eb; padding: 20px 0; color: #9b9791; font-size: 12px; text-align: center; margin-top: 24px; }

@media (max-width: 520px) {
  .post-item { padding: 12px; }
  .detail { padding: 18px 16px; }
  .post-thumb { flex-basis: 76px; }
  .post-thumb img { width: 76px; height: 54px; }
}

/* ============================================================
   后台样式（与前台同一套 Notion 语言）
   ============================================================ */
.admin-nav { display: flex; gap: 2px; align-items: center; font-size: 14px; }
.admin-nav a {
  color: #37352f; text-decoration: none; padding: 6px 10px; border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}
.admin-nav a:hover { background: #efedea; }
.admin-nav a.active { color: #2eaadc; font-weight: 500; }
.admin-nav .logout { color: #9b9791; }

.panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px 22px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.panel h2 { font-size: 17px; margin: 0 0 14px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; }
.stat b { display: block; font-size: 23px; color: #2eaadc; font-weight: 700; }
.stat span { color: #9b9791; font-size: 12px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #efedea; vertical-align: middle; }
.table th { color: #6b7280; font-weight: 500; }
.table tr:hover td { background: #fbfaf8; }
.table td.title-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn, button.btn {
  display: inline-block; background: #2eaadc; color: #fff; border: none;
  padding: 7px 16px; border-radius: 6px; font-size: 13px; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease;
}
.btn:hover, button.btn:hover { background: #2598c6; }
.btn-ghost { background: transparent; color: #37352f; border: 1px solid #e5e7eb; }
.btn-ghost:hover { background: #efedea; color: #37352f; }
.btn-danger { background: #eb5757; }
.btn-danger:hover { background: #e0453f; }
.btn-sm { padding: 3px 10px; font-size: 12px; }

input[type=text], input[type=password], input[type=number], select, textarea, input[type=file] {
  width: 100%; box-sizing: border-box; padding: 8px 11px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px; color: #37352f;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #2eaadc; box-shadow: 0 0 0 2px rgba(46,170,220,0.25);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
label.f-label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 5px; color: #37352f; }
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.check-line input { width: auto; }
.tip { color: #9b9791; font-size: 12px; margin-top: 4px; }
.notice { border-radius: 6px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.notice.ok { background: #f0f7f4; color: #0f7b6c; }
.notice.err { background: #fdf0ef; color: #eb5757; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filters input { width: 220px; }
a.th-link { color: #37352f; text-decoration: none; }
a.th-link:hover { color: #2eaadc; }

/* 后台图片管理 */
.img-manage { display: flex; flex-wrap: wrap; gap: 12px; }
.img-item {
  display: flex; flex-direction: column; gap: 5px; align-items: center;
  font-size: 12px; color: #6b7280; cursor: pointer;
}
.img-item img { width: 96px; height: 68px; object-fit: cover; border: 1px solid #e5e7eb; border-radius: 6px; display: block; }
.img-item input { width: auto; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* 广告位 */
.ad-box { margin: 16px 0; text-align: center; overflow: hidden; border-radius: 8px; }
.ad-box img { max-width: 100%; height: auto; display: inline-block; border-radius: 8px; }
.ad-box a { display: inline-block; }
.panel h2 small { font-weight: 400; font-size: 12px; }
.on { color: #0f7b6c; font-size: 12px; }
.off { color: #eb5757; font-size: 12px; }
.link-btn { background: none; border: none; color: #2eaadc; cursor: pointer; padding: 0; font-size: 14px; text-decoration: underline; }
.link-btn:hover { color: #1d7fa8; }
.alert-error { background: #fdf0ef; color: #eb5757; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.alert-ok { background: #f0f7f4; color: #0f7b6c; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.page-title { font-size: 22px; margin: 20px 0 14px; }

/* 广告按钮 + 链接复制 */
.ad-btn {
  display: inline-block; background: #2eaadc; color: #fff; border-radius: 8px;
  padding: 10px 30px; font-size: 15px; font-weight: 500; text-decoration: none;
}
.ad-btn:hover { background: #1d7fa8; color: #fff; }
.ad-btn-off { background: #e8e6e1; color: #9b9791; cursor: default; }
.ad-btn-sm {
  display: inline-block; background: #2eaadc; color: #fff; border-radius: 6px;
  padding: 4px 16px; font-size: 13px;
}
.ad-preview { margin-bottom: 4px; }
.ad-preview img {
  width: 120px; height: auto; max-height: 64px; object-fit: cover;
  border: 1px solid #e5e7eb; border-radius: 6px;
}
.url-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.url-text {
  font-size: 11px; color: #6b7280; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.btn-copy { font-size: 12px; padding: 3px 10px; white-space: nowrap; cursor: pointer; }
.img-item { align-items: flex-start; }
.img-del {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: #6b7280; cursor: pointer; margin-top: 4px;
}

/* 自定义页面 */
.custom-page {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 24px 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  margin-top: 20px;
}
.custom-page h1 { font-size: 22px; margin: 0 0 16px; font-weight: 700; }
.custom-page-body { font-size: 15px; color: #37352f; word-break: break-word; line-height: 1.7; }
.custom-page-body img { max-width: 100%; height: auto; border-radius: 6px; }
.custom-page-body a { color: #2eaadc; }

/* ---------- 图文卡片（无标题帖，京东线报专用） ---------- */
.post-item.card-post { position: relative; flex-direction: column; align-items: stretch; gap: 10px; }
.card-cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-post .post-meta { position: relative; z-index: 2; margin-top: 0; }
.card-imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.card-imgs img {
  width: 140px; height: 105px; object-fit: cover; border-radius: 6px;
  background: #efedea; display: block;
}
.card-text {
  color: #37352f; font-size: 14px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}

/* 分类标签：当前所在分类高亮（细描边提示"已在此分类"）+ 点击区域加大 */
.badge { padding: 2px 10px; line-height: 1.6; cursor: pointer; }
.badge.active {
  box-shadow: 0 0 0 1.5px currentColor inset;
  opacity: 1;
}

/* ---------- 图片灯箱 ---------- */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
}
.lb-img-wrap { max-width: 92vw; max-height: 86vh; }
.lb-img {
  max-width: 92vw; max-height: 86vh; object-fit: contain;
  border-radius: 4px; box-shadow: 0 4px 30px rgba(0,0,0,0.5);
  background: transparent;
}
.lb-img.lb-loading { opacity: 0.35; }
.lb-close, .lb-prev, .lb-next {
  position: fixed; z-index: 10000;
  background: rgba(255,255,255,0.12); color: #fff;
  border: none; border-radius: 50%;
  width: 44px; height: 44px; font-size: 22px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background-color .15s ease;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.3); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.lb-count {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.85); font-size: 13px; background: rgba(0,0,0,0.45);
  padding: 3px 12px; border-radius: 20px;
}

/* 图文卡片内文字链接：可点击（高于整卡覆盖层） */
.card-post .card-text a {
  position: relative; z-index: 2; color: #2eaadc; word-break: break-all;
}

/* ---------- 电脑端（≥768px）：帖子两列布局 ---------- */
@media (min-width: 768px) {
  .post-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }
  .post-item {
    margin-bottom: 0;
    height: 100%;
  }
  /* 列表中的广告占满整行 */
  .post-list .ad-box {
    grid-column: 1 / -1;
    margin: 0 0 0;
  }
  /* 图文卡片两列下：图片自适应 */
  .post-item.card-post { gap: 12px; }
  .card-imgs img { width: 33.33%; height: auto; aspect-ratio: 4/3; }
}

/* ---------- 电脑端页面加宽 ---------- */
@media (min-width: 1024px) {
  .container { max-width: 1080px; }
}

/* ---------- 后台（电脑端更舒展） ---------- */
.admin-wrap { max-width: 1024px; }
/* 表单控件统一宽度 */
.f-input { display: block; width: 100%; max-width: 560px; box-sizing: border-box; }
.form .f-input { margin-bottom: 0; }
/* 后台导航小屏换行 */
@media (max-width: 640px) {
  .admin-nav { flex-wrap: wrap; row-gap: 4px; }
  .admin-nav a { padding: 4px 8px; }
}
/* 后台统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; transition: background-color .15s ease; }
.stat-card:hover { background: #f7f6f3; }
.stat-num { display: block; font-size: 26px; font-weight: 700; color: #37352f; line-height: 1.2; letter-spacing: -0.5px; }
.stat-label { display: block; font-size: 12px; color: #9b9791; margin-top: 4px; }
/* 统计表格迷你柱状条 */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cell-bar { position: relative; padding-right: 8px !important; }
.cell-bar .bar-bg { position: absolute; left: 0; top: 2px; bottom: 2px; width: 0; background: rgba(46,170,220,.10); border-radius: 0 4px 4px 0; pointer-events: none; }
.cell-bar .bar-v { position: relative; z-index: 1; }
/* 手机端后台 */
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-wrap { padding: 0 10px; }
  .top-in { flex-direction: column; align-items: flex-start; gap: 8px; }
  .admin-nav { overflow-x: auto; width: 100%; white-space: nowrap; padding-bottom: 4px; }
}

/* 广告类型选项卡 */
.ad-type-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.ad-type-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border: 1px solid #e5e7eb; border-radius: 6px;
  font-size: 13px; cursor: pointer; background: #fff; color: #37352f;
  transition: background-color .15s ease, border-color .15s ease;
}
.ad-type-tab input { display: none; }
.ad-type-tab:hover { background: #f7f6f3; }
.ad-type-tab.on { background: #eef6fb; border-color: #2eaadc; color: #2eaadc; font-weight: 500; }
