/* ============================================================
   后台管理样式
   ============================================================ */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: #e8edf6;
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(34, 210, 122, 0.08), transparent 55%),
    linear-gradient(180deg, #0a0f1a 0%, #070b12 100%);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
input, textarea, select, button { font-family: inherit; font-size: 14px; }

:root {
  --brand: #22d27a;
  --brand-soft: rgba(34, 210, 122, 0.14);
  --gold: #ffd166;
  --red: #ff5d6c;
  --muted: #8a97ad;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --radius: 14px;
}

/* ---------------- 顶栏 ---------------- */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.admin-bar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16.5px;
}
.admin-brand .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #0e9a57);
  font-size: 18px;
}
.admin-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------------- 通用容器 ---------------- */
.admin-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-head h1 {
  font-size: 24px;
  margin: 0;
  font-weight: 800;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: #e8edf6;
  font-weight: 600;
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #0e9a57);
  border-color: transparent;
  color: #05130c;
  box-shadow: 0 10px 24px -12px rgba(34, 210, 122, 0.9);
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(135deg, var(--brand), #0e9a57); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: rgba(255, 93, 108, 0.4); background: rgba(255, 93, 108, 0.08); }
.btn-danger:hover { background: rgba(255, 93, 108, 0.16); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 38px 34px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}
.login-card .brand-lg {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}
.login-card .brand-lg .logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #0e9a57);
  font-size: 22px;
}
.login-card p.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 26px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #b9c4d6;
  margin-bottom: 7px;
}
.field > label .req { color: var(--red); margin-left: 2px; }
.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.25);
  color: #e8edf6;
  outline: none;
  transition: 0.16s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8a97ad 50%), linear-gradient(135deg, #8a97ad 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* toggle */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  font-weight: 600;
}
.toggle input { display: none; }
.toggle .track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  position: relative;
  transition: 0.2s;
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s;
}
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track::after { transform: translateX(20px); }

/* ---------------- 卡片区 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: "";
  width: 4px; height: 16px; border-radius: 3px;
  background: linear-gradient(var(--brand), #0e9a57);
}

/* ---------------- 仪表盘列表 ---------------- */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.mini-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.mini-stat .n { font-size: 24px; font-weight: 800; }
.mini-stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mini-stat.accent .n { color: var(--brand); }

.post-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 12px;
  transition: 0.16s;
}
.post-row:hover { border-color: var(--border-strong); }
.post-row .thumb {
  width: 92px;
  height: 62px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #0d1b2a, #103a2c);
  display: grid;
  place-items: center;
  font-size: 22px;
}
.post-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-row .info { flex: 1; min-width: 0; }
.post-row .info h3 {
  margin: 0 0 5px;
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-row .meta {
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.badge-pub, .badge-draft {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
}
.badge-pub { background: var(--brand-soft); color: var(--brand); }
.badge-draft { background: rgba(255, 209, 102, 0.15); color: var(--gold); }
.post-row .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------------- 富文本编辑器 ---------------- */
.editor-shell {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  position: sticky;
  top: 62px;
  z-index: 5;
}
.rte-btn {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  border: none;
  background: transparent;
  color: #cdd6e6;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.14s;
}
.rte-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.rte-btn.active { background: var(--brand-soft); color: var(--brand); }
.rte-sep { width: 1px; background: var(--border); margin: 4px 4px; }
.rte-editor {
  min-height: 340px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 20px 22px;
  outline: none;
  font-size: 15.5px;
  line-height: 1.8;
  color: #dbe3ef;
}
.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.rte-editor h2 { font-size: 21px; border-left: 3px solid var(--brand); padding-left: 10px; }
.rte-editor h3 { font-size: 18px; }
.rte-editor img { max-width: 100%; border-radius: 10px; margin: 12px 0; }
.rte-editor blockquote { border-left: 3px solid var(--brand); margin: 12px 0; padding: 8px 16px; background: var(--brand-soft); border-radius: 8px; }
.rte-editor ul, .rte-editor ol { padding-left: 1.5em; }
.rte-editor a { color: var(--brand); }

/* ---------------- 封面上传 ---------------- */
.cover-drop {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: 0.16s;
  color: var(--muted);
}
.cover-drop:hover { border-color: var(--brand); color: #cbd5e5; background: var(--brand-soft); }
.cover-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 420px;
}
.cover-preview img { width: 100%; display: block; }
.cover-preview .remove {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
  font-size: 12px;
}

/* ---------------- 赛事编辑器 ---------------- */
.match-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.16);
}
.match-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.match-editor-head .idx { font-weight: 800; font-size: 14px; color: var(--brand); }
.match-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.match-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ---------------- toast / 提示 ---------------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #11202f;
  border: 1px solid var(--border-strong);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: 0.28s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255, 93, 108, 0.5); color: #ffb4bb; }
.toast.ok { border-color: rgba(34, 210, 122, 0.5); color: #9cf5c4; }

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

/* 编辑器底部保存栏 */
.save-bar {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  padding: 16px 22px;
  background: rgba(10, 15, 26, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 30;
}
.save-bar .status { color: var(--muted); font-size: 13px; }

/* responsive */
@media (max-width: 720px) {
  .field-row, .match-grid-3, .match-grid-2 { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .post-row { flex-wrap: wrap; }
  .post-row .actions { width: 100%; justify-content: flex-end; }
  .post-row .thumb { width: 70px; height: 50px; }
}
