/* ============================================================
   校园论坛 · 样式表（自有实现，浅色/深色双主题）
   ============================================================ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif,
          "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --bg: #f4f4f7;
  --bg-soft: #ececf2;
  --card: #ffffff;
  --card-2: #f7f7fa;
  --line: #ececf1;
  --line-strong: #dcdce4;
  --text: #14131a;
  --text-2: #55545f;
  --muted: #9a99a6;
  --accent: #ff2748;
  --accent-2: #ff6a4d;
  --green: #16a34a;
  --green-soft: #e8f6ee;
  --shadow-lg: 0 12px 30px rgba(20, 19, 26, .08);
  --radius: 22px;
}
[data-theme="dark"] {
  --bg: #121218;
  --bg-soft: #1b1b23;
  --card: #1d1d26;
  --card-2: #262630;
  --line: #2c2c37;
  --line-strong: #3a3a46;
  --text: #f2f1f6;
  --text-2: #c6c5d0;
  --muted: #858493;
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidenav {
  width: 240px; flex: none; position: sticky; top: 0; height: 100vh;
  padding: 22px 16px; border-right: 1px solid var(--line); background: var(--card);
  overflow-y: auto;
}
.sn-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.sn-logo { display: grid; place-items: center; border-radius: 13px; color: #fff; font-weight: 800;
  background: linear-gradient(140deg, var(--accent-2), var(--accent)); }
.sn-brand-text { font-weight: 800; font-size: 16px; }
.sn-nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.sn-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 14px;
  color: var(--text-2); font-size: 14.5px; }
.sn-item .ic { width: 20px; height: 20px; flex: none; }
.sn-item.on, .sn-item:hover { background: var(--card-2); color: var(--text); }
.sn-label { font-size: 12px; color: var(--muted); margin: 14px 12px 8px; }
.sn-sub .sn-item { font-size: 13.5px; }
.sn-publish { margin: 6px 0 18px; }
.main { flex: 1; max-width: 880px; margin: 0 auto; padding: 26px 22px 110px; }

/* ---------- 底部导航（移动端） ---------- */
.bottomnav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--card); border-top: 1px solid var(--line);
  grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr; align-items: center;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.bn-item { text-align: center; font-size: 12px; color: var(--muted); }
.bn-item.on { color: var(--accent); font-weight: 700; }
.bn-pub { position: relative; display: grid; place-items: center; }
.bn-plus {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  color: #fff; font-size: 26px; font-weight: 600; box-shadow: 0 8px 18px rgba(255, 39, 72, .35);
}
.bn-ai { position: absolute; top: 2px; right: calc(50% - 26px); background: #7c5cff; color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 8px; padding: 1px 5px; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 18px; margin-bottom: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0;
  border-radius: 14px; padding: 11px 18px; font-size: 14.5px; font-weight: 700; background: var(--card-2);
  color: var(--text); }
.btn-primary { background: linear-gradient(140deg, var(--accent-2), var(--accent)); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); }
.btn-danger { background: #fdecef; color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.btn-block { width: 100%; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 15px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-size: 14px; color: var(--text-2); }
.tab.on { background: var(--text); color: var(--bg); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line-strong); background: var(--card-2); color: var(--text);
  border-radius: 14px; padding: 12px 14px; outline: none; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 110px; }

.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar-txt { display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700;
  background: linear-gradient(140deg, #7c5cff, #4d8bff); }
.vip-badge { display: inline-block; background: linear-gradient(140deg, #ffd76a, #ff9a3d); color: #5a3200;
  font-size: 10px; font-weight: 800; border-radius: 7px; padding: 1px 6px; margin-left: 4px; }

/* ---------- 横幅 ---------- */
.hero { border-radius: var(--radius); padding: 24px; color: #fff; margin-bottom: 16px;
  background: linear-gradient(135deg, #2b6cb0, #7c5cff 60%, #ff2748); }
.hero h2 { font-size: 20px; margin-bottom: 6px; }
.hero p { opacity: .9; font-size: 13.5px; }

/* ---------- 帖子 ---------- */
.post-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.post-meta { display: flex; flex-direction: column; }
.post-name { font-weight: 700; font-size: 15px; }
.post-sub { font-size: 12px; color: var(--muted); }
.post-title { font-size: 16.5px; font-weight: 800; margin-bottom: 6px; }
.post-content { font-size: 15px; color: var(--text-2); white-space: pre-wrap; margin-bottom: 10px; }
.post-imgs { margin-bottom: 10px; }
.grid { display: grid; gap: 8px; }
.grid-1 { grid-template-columns: 1fr; max-width: 320px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-item img { width: 100%; height: 110px; object-fit: cover; border-radius: 14px; }
.grid-1 .grid-item img { height: 210px; max-width: 320px; }
.post-video { border-radius: 16px; margin-bottom: 10px; background: #000; }
.post-actions { display: flex; gap: 18px; padding-top: 10px; border-top: 1px solid var(--line); }
.act { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px;
  background: 0; border: 0; }
.act .ic { width: 18px; height: 18px; }
.act.on { color: var(--accent); }
.act button { display: inline-flex; align-items: center; gap: 6px; color: inherit; background: 0; border: 0; font-size: 13px; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; font-size: 14px; }

/* ---------- 评论 ---------- */
.comment { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.comment-body { font-size: 14.5px; color: var(--text-2); }

/* ---------- 钱包 / VIP ---------- */
.wallet-hero { border-radius: var(--radius); padding: 22px; color: #fff; margin-bottom: 16px;
  background: linear-gradient(140deg, #ff4d5e, #ff2748); }
.wallet-hero .bal { font-size: 30px; font-weight: 800; margin: 6px 0; }
.wallet-stats { display: flex; gap: 10px; margin-top: 14px; }
.wallet-stats div { flex: 1; background: rgba(255,255,255,.16); border-radius: 14px; padding: 10px; }
.wallet-stats b { display: block; font-size: 16px; }
.wallet-stats span { font-size: 11.5px; opacity: .9; }
.tx { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.tx:last-child { border-bottom: 0; }
.tx .plus { color: var(--green); font-weight: 700; }
.tx .minus { color: var(--accent); font-weight: 700; }

.vip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.vip-pkg { border: 1px solid var(--line); border-radius: 18px; padding: 16px; text-align: center; }
.vip-pkg.on { border-color: var(--accent); background: #fff5f6; }
.vip-pkg .price { font-size: 22px; font-weight: 800; color: var(--accent); margin: 6px 0; }
.vip-pkg .name { font-weight: 700; }
.vip-card { text-align: center; padding: 26px 18px; }
.vip-card .qr { width: 120px; height: 120px; margin: 14px auto; border-radius: 18px; background: var(--card-2);
  display: grid; place-items: center; font-size: 12px; color: var(--muted); }

/* ---------- 消息 / 聊天 ---------- */
.chat-row { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.chat-row:last-child { border-bottom: 0; }
.chat-row .meta { flex: 1; min-width: 0; }
.chat-row .name { font-weight: 700; }
.chat-row .last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.bubble { max-width: 72%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble.other { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 6px; }
.bubble.redpacket { background: linear-gradient(140deg, #ff6a4d, #ff2748); color: #fff; min-width: 180px; }
.bubble.voice { display: flex; align-items: center; gap: 8px; }
.chat-bar { position: sticky; bottom: 0; display: flex; gap: 10px; padding-top: 12px; background: var(--bg); }

/* ---------- 后台 ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side { width: 220px; background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; }
.admin-main { flex: 1; padding: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat b { font-size: 24px; }
.stat span { display: block; color: var(--muted); font-size: 12.5px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.tag { display: inline-block; border-radius: 8px; padding: 2px 9px; font-size: 12px; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: #fdecef; color: var(--accent); }
.tag.gray { background: var(--card-2); color: var(--muted); }

/* ---------- 提示 ---------- */
.toast { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); background: rgba(20,19,26,.9);
  color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 99; opacity: 0;
  pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .sidenav { display: none; }
  .bottomnav { display: grid; }
  .main { padding: 18px 14px 100px; }
  .admin-side { display: none; }
}
