/* ============================================================
   AIHub Community v3 — 令牌化双主题 + App 外壳
   主题挂在 <html data-aihc-theme="dark-premium|warm">
   ============================================================ */

/* ---- 主题令牌 ---- */
html[data-aihc-theme="dark-premium"] {
  --bg: #0f1013;
  --surface: #16181d;
  --surface-2: #1c1f26;
  --text: #e7e9ee;
  --text-muted: #9aa3b2;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --accent: #6d7cff;
  --accent-weak: rgba(109,124,255,.14);
  --accent-grad: linear-gradient(120deg, #6d7cff, #22d3ee);
  --danger: #f0616d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --glow: 0 0 0 1px var(--border), 0 8px 30px rgba(109,124,255,.10);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: Georgia, "Songti SC", "SimSun", serif;
  color-scheme: dark;
}
html[data-aihc-theme="warm"] {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f2ec;
  --text: #1a1a1a;
  --text-muted: #6b6b66;
  --border: #eae7e0;
  --border-strong: #ddd8cd;
  --accent: #b8563f;
  --accent-weak: rgba(184,86,63,.10);
  --accent-grad: linear-gradient(120deg, #b8563f, #d99a5b);
  --danger: #c0392b;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 4px 18px rgba(0,0,0,.06);
  --glow: 0 0 0 1px var(--border), 0 6px 20px rgba(0,0,0,.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: Georgia, "Songti SC", "SimSun", serif;
  color-scheme: light;
}

/* ---- 基础 ---- */
body.aihc-app {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body.aihc-app * { box-sizing: border-box; }
body.aihc-app a { color: inherit; text-decoration: none; }
body.aihc-app img { max-width: 100%; }

/* ---- 顶栏 ---- */
.aihc-topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.aihc-topbar-in {
  max-width: 1360px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 16px;
}
.aihc-burger { display: none; background: none; border: 0; color: var(--text); font-size: 20px; cursor: pointer; }
.aihc-logo { display: flex; align-items: center; font-weight: 700; font-size: 18px; }
.aihc-logo img { height: 28px; }
.aihc-logo span { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aihc-search { flex: 1; max-width: 480px; }
.aihc-search input {
  width: 100%; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 14px;
}
.aihc-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.aihc-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.aihc-act {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
  border-radius: 10px; color: var(--text-muted); font-size: 15px; cursor: pointer;
  transition: background .15s, color .15s;
}
.aihc-act:hover { background: var(--surface); color: var(--text); }
.aihc-write { color: var(--text); background: var(--accent-weak); }
.aihc-write:hover { box-shadow: var(--glow); }
.aihc-login { background: var(--accent); color: #fff; border-radius: 999px; }
.aihc-avatar-wrap { position: relative; }
.aihc-avatar-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.aihc-avatar-btn img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); display: block; }
.aihc-menu {
  position: absolute; right: 0; top: 46px; min-width: 168px; display: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 6px; z-index: 60;
}
.aihc-menu.open { display: block; }
.aihc-menu a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--text); }
.aihc-menu a:hover { background: var(--surface-2); }

/* ---- 三栏 ---- */
.aihc-shell {
  max-width: 1360px; margin: 0 auto; padding: 22px 20px 60px;
  display: grid; grid-template-columns: 232px minmax(0,1fr) 300px; gap: 24px; align-items: start;
}
.aihc-shell.no-left { grid-template-columns: minmax(0,1fr) 300px; }
.aihc-shell.no-right { grid-template-columns: 232px minmax(0,1fr); }
.aihc-shell.no-left.no-right { grid-template-columns: minmax(0, 860px); justify-content: center; }
.aihc-app.aihc-wide .aihc-shell { max-width: 960px; }

.aihc-left { position: sticky; top: 82px; }
.aihc-right { position: sticky; top: 82px; }
.aihc-main { min-width: 0; }

/* 左栏导航 */
.aihc-left { position: sticky; top: 82px; }
.aihc-nav { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.aihc-nav-group { font-size: 11px; color: var(--text-muted); padding: 14px 10px 6px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.aihc-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-size: 15px; font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.aihc-nav-item .i {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 9px; background: var(--surface-2); font-size: 15px; flex: none;
}
.aihc-nav-item:hover { background: var(--surface-2); }
.aihc-nav-item.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.aihc-nav-item.active .i { background: var(--accent); color: #fff; }
.aihc-nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.aihc-nav-add {
  margin-top: 6px; background: transparent; border: 1px dashed var(--border-strong); color: var(--text-muted);
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; transition: all .15s; text-align: left;
}
.aihc-nav-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }

/* 右栏精选卡片 */
.aihc-cards { display: flex; flex-direction: column; gap: 12px; }
.aihc-cards-group { font-size: 13px; color: var(--text-muted); margin: 4px 0; }
.aihc-card-feat {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: box-shadow .18s, transform .18s;
}
.aihc-card-feat:hover { box-shadow: var(--glow); transform: translateY(-2px); }
.aihc-card-feat-img { display: block; height: 118px; background-size: cover; background-position: center; background-color: var(--surface-2); }
.aihc-card-feat-title { display: block; padding: 11px 14px; font-size: 14px; font-weight: 600; }

/* ---- 页脚 ---- */
.aihc-footer {
  border-top: 1px solid var(--border); padding: 24px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px; line-height: 1.7;
  display: flex; gap: 8px 18px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.aihc-footer a { color: var(--accent); }
.aihc-footer a:hover { text-decoration: underline; }
.aihc-footer-license a { text-decoration: underline dotted; }

/* ---- 响应式 ---- */
@media (max-width: 1120px) {
  .aihc-shell { grid-template-columns: 220px minmax(0,1fr); }
  .aihc-shell .aihc-right, .aihc-shell.no-left .aihc-right { display: none; }
  .aihc-shell.no-left { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 820px) {
  .aihc-burger { display: inline-block; }
  .aihc-shell { grid-template-columns: minmax(0,1fr); padding: 16px 14px 50px; }
  .aihc-left {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 70;
    background: var(--surface); border-right: 1px solid var(--border); padding: 70px 14px 20px;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  body.aihc-drawer-open .aihc-left { transform: none; }
  body.aihc-drawer-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 65; }
  .aihc-search { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
