/* 内部站点导航 - 全站样式（暗色列表模式） */
:root {
  --bg: #12121f;
  --bg-deep: #0d0d18;
  --surface: #1c1c2e;
  --surface-2: #242438;
  --border: #2e2e46;
  --text: #e8e8f2;
  --text-dim: #9a9ab0;
  --accent: #6c6cff;
  --accent-soft: rgba(108, 108, 255, 0.16);
  --teal: #26c6b9;
  --teal-soft: rgba(38, 198, 185, 0.16);
  --red: #e5484d;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 18, 31, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}
.brand .logo { font-size: 24px; }
.topbar-actions { display: flex; gap: 8px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: #5a5ae0; border-color: #5a5ae0; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 公告 ===== */
.notice {
  max-width: 1080px;
  margin: 14px auto 0;
  padding: 0 16px;
}
.notice-box {
  background: var(--accent-soft);
  border: 1px solid rgba(108, 108, 255, 0.35);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  color: #c9c9ff;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== 搜索与分类筛选 ===== */
.toolbar {
  max-width: 1080px;
  margin: 18px auto 0;
  padding: 0 16px;
}
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 20px 12px 44px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-dim); }
.search-wrap .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.6;
}
.cat-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 2px 4px;
  scrollbar-width: none;
}
.cat-filter::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  transition: all 0.15s;
}
.cat-chip:hover { border-color: var(--accent); color: var(--text); }
.cat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ===== 分类区块（列表模式） ===== */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px 40px;
}
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.section-head .cat-icon { font-size: 20px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head .count {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 10px;
}
.site-list { list-style: none; }
.site-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}
.site-item:last-child { border-bottom: none; }
.site-item:hover { background: var(--surface-2); }
.site-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.site-info { flex: 1; min-width: 0; }
.site-name {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-desc {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.site-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.badge {
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--teal);
  background: var(--teal-soft);
}
.badge.clicks { color: var(--text-dim); background: var(--surface-2); }
.site-arrow { color: var(--text-dim); font-size: 15px; }
/* ===== 图文卡片网格 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 14px;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
}
.site-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(108, 108, 255, 0.18);
}
.card-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-deep);
  position: relative;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-cover .cover-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  background: linear-gradient(145deg, var(--surface-2), var(--bg-deep));
}
.card-cat-tag {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 11px;
  color: #fff;
  background: rgba(13, 13, 24, 0.72);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 3px 10px;
}
.card-body { padding: 12px 6px 0; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #5ea6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 20px;
}
.card-meta { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.card-foot { margin-top: 12px; padding: 0 2px; }
.card-visit-btn {
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #4d9dff);
  width: 100%;
}
.site-card:hover .card-visit-btn { filter: brightness(1.12); }
.no-result { display: none; text-align: center; color: var(--text-dim); padding: 50px 0; }

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px 16px 40px;
}

/* ===== 后台 ===== */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.login-card {
  max-width: 380px;
  margin: 12vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.login-card h1 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 6px;
}
.login-card .sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 6px 0 4px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head h3 { font-size: 16px; }
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.row-item .row-main { flex: 1; min-width: 160px; }
.row-item .row-title { font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.row-item .row-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; word-break: break-all; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.danger { color: var(--red); border-color: rgba(229, 72, 77, 0.4); }
.icon-btn.danger:hover { background: var(--red); color: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-grid .field { margin-bottom: 0; }
.form-foot { margin-top: 14px; display: flex; gap: 8px; }
.form-foot .spacer { flex: 1; }
.tag { font-size: 11px; border-radius: 999px; padding: 2px 9px; }
.tag.teal { color: var(--teal); background: var(--teal-soft); }
.tag.dim { color: var(--text-dim); background: var(--surface-2); }

/* ===== 图标选择器 ===== */
.field { position: relative; }
.icon-input-row { display: flex; gap: 8px; }
.icon-input-row input { flex: 1; min-width: 0; }
.icon-input-row .btn { flex-shrink: 0; }
.icon-picker {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 8px;
  width: 350px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  z-index: 80;
  box-shadow: var(--shadow);
}
.icon-picker.open { display: block; }
.icon-tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.icon-tabs::-webkit-scrollbar { display: none; }
.icon-tab {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
}
.icon-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
}
.icon-cell {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 9px;
  height: 40px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.icon-cell:hover { border-color: var(--accent); transform: scale(1.08); }
.icon-cell.active { border-color: var(--accent); background: var(--accent-soft); }
/* 列表行内图标浮层（fixed 定位由 JS 计算） */
.icon-picker-float { position: absolute; left: 0; top: 0; margin: 0; z-index: 120; }
.row-icon-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s;
}
.row-icon-btn:hover { border-color: var(--accent); transform: scale(1.06); }

/* ===== 封面上传 ===== */
.cover-upload {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.cover-upload img,
.cover-upload .cover-ph {
  width: 112px;
  height: 150px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-deep);
}
.cover-upload .cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.cover-ops { display: flex; flex-direction: column; gap: 8px; }
.row-thumb {
  width: 54px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  flex-shrink: 0;
}

/* ===== Toast 提示 ===== */
#toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 200;
  max-width: 86vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--red); color: #ff9a9d; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .brand { font-size: 17px; }
  .brand .logo { font-size: 20px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
  .site-card { padding: 7px 7px 11px; border-radius: 13px; }
  .card-cover { aspect-ratio: 3 / 4; border-radius: 10px; }
  .card-cover .cover-ph { font-size: 38px; }
  .card-body { padding: 10px 4px 0; }
  .card-title { font-size: 13.5px; }
  .card-desc { font-size: 12px; margin-top: 3px; }
  .card-visit-btn { padding: 6px 14px; font-size: 12px; }
  .btn { padding: 7px 13px; font-size: 13px; }
  .login-card { margin-top: 8vh; padding: 26px 20px; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .container, .toolbar, .notice, .admin-wrap { max-width: 760px; }
}
