/* style.css —— 管理后台深色主题样式。原生 CSS，无外链字体/图标库。 */

/* ----------------------- 主题变量 ----------------------- */
:root {
  --bg: #0b0d10;          /* 页面背景 */
  --card: #15181e;        /* 卡片背景 */
  --border: #232732;      /* 边框 */
  --text: #e6e9ef;        /* 主文字 */
  --muted: #8b93a7;       /* 次要文字 */
  --accent: #f59e0b;      /* 强调暖橙 */
  --success: #22c55e;     /* 成功 */
  --danger: #ef4444;      /* 危险 */
  --blue: #3b82f6;        /* 蓝色辅助 */
  --radius: 10px;
}

/* ----------------------- 基础 ----------------------- */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a {
  color: var(--accent);
  text-decoration: none;
}
h3 {
  margin: 0;
}

/* ----------------------- 布局 ----------------------- */
#app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.nav {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--muted);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}
.nav-item.active {
  color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  border-left-color: var(--accent);
}
.nav-item svg {
  flex: 0 0 auto;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.topbar-title {
  font-size: 15px;
  font-weight: 600;
}
.content {
  padding: 20px;
  overflow-x: auto;
}

/* ----------------------- 按钮 ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: filter 0.15s, background 0.15s;
}
.btn:hover {
  filter: brightness(1.15);
}
.btn:active {
  filter: brightness(0.95);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 600;
}
.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #04210f;
  font-weight: 600;
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #2a0808;
  font-weight: 600;
}
.btn-ghost {
  background: transparent;
}
.btn-block {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
}

/* ----------------------- 卡片 / 面板 ----------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card[data-hash] {
  cursor: pointer;
}
.stat-card[data-hash]:hover {
  border-color: var(--accent);
}
.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
}
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ----------------------- 表格 ----------------------- */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}
.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ----------------------- badge ----------------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-gray {
  background: #2a2e38;
  color: var(--muted);
}
.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #93b8ff;
}
.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: #7ee2a8;
}
.badge-orange {
  background: rgba(245, 158, 11, 0.15);
  color: #f7c462;
}
.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #f59797;
}

/* ----------------------- 审核卡片 ----------------------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.cat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cat-body {
  padding: 12px;
}
.cat-title {
  font-weight: 600;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}
.cat-meta .price {
  color: var(--accent);
  font-weight: 700;
}
.cat-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* ----------------------- 图片 / 占位 ----------------------- */
.thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #0b0d10;
}
.img-ph {
  width: 100%;
  height: 150px;
  background: repeating-linear-gradient(
    45deg,
    #1b1f27,
    #1b1f27 10px,
    #15181e 10px,
    #15181e 20px
  );
  display: flex;
  align-items: center;
  justify-content: center;
}
.ev {
  display: inline-block;
  margin-right: 6px;
}
.ev-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
}
.ev-text {
  color: var(--muted);
  font-size: 12px;
  margin-right: 6px;
}

/* ----------------------- 表单 ----------------------- */
.form-row {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 13px;
}
.form-control {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
.select {
  padding: 8px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}
.config-form {
  max-width: 460px;
}
.form-actions {
  margin-top: 6px;
}

/* ----------------------- 登录 ----------------------- */
.login-wrap {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 360px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.login-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 22px;
}
.login-err {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}

/* ----------------------- 加载 / 空态 ----------------------- */
.loading,
.empty {
  color: var(--muted);
  padding: 28px;
  text-align: center;
}
.muted {
  color: var(--muted);
}

/* ----------------------- 模态框 ----------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  width: 420px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.modal-msg {
  color: var(--muted);
  margin: 0 0 12px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ----------------------- Toast ----------------------- */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-info {
  background: #2a2e38;
  color: var(--text);
  border: 1px solid var(--border);
}
.toast-success {
  background: rgba(34, 197, 94, 0.95);
  color: #04210f;
}
.toast-error {
  background: rgba(239, 68, 68, 0.95);
  color: #2a0808;
}

/* ----------------------- 响应式：<900px 侧边栏收为顶部横条 ----------------------- */
@media (max-width: 900px) {
  #app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand {
    border-bottom: none;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }
  .nav-item {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 8px 14px;
    white-space: nowrap;
  }
  .nav-item.active {
    border-left: none;
    border-bottom-color: var(--accent);
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .cards {
    grid-template-columns: 1fr;
  }
}
