:root {
  --bg: #0a0b0d;
  --panel: #14171c;
  --panel-2: #1a1e24;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f1f3f5;
  --muted: #99a1ab;
  --accent: #e10600;
  --accent-2: #ff4d3d;
  --accent-soft: rgba(225, 6, 0, 0.14);
  --ok: #45d07a;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  --mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

code { font-family: var(--mono); font-size: 12.5px; background: rgba(255, 255, 255, 0.07); padding: 2px 6px; border-radius: 4px; }

/* ---------------- 通用控件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
  transition: 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 8px 20px rgba(225, 6, 0, 0.26); }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--line); color: #d3d8de; }
.btn-ghost:hover { border-color: var(--line-strong); color: #fff; }
.btn-danger { background: rgba(225, 6, 0, 0.12); border-color: rgba(225, 6, 0, 0.4); color: #ff7b6f; }
.btn-danger:hover { background: rgba(225, 6, 0, 0.24); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.06em; }

input[type="text"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  background: #0d0f13;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ---------------- 登录 ---------------- */

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(225, 6, 0, 0.2), transparent 55%),
    linear-gradient(120deg, #06070a, #0d1015 60%, #14090a);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(20, 23, 28, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 38px 34px 28px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  position: relative;
}
.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 34px;
  right: 34px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.login-logo { width: 52px; height: 52px; color: var(--accent); margin-bottom: 18px; filter: drop-shadow(0 0 16px rgba(225, 6, 0, 0.5)); }
.login-logo svg { width: 100%; height: 100%; }
.login-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: 0.02em; }
.login-sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.24em; color: var(--muted); margin: 0 0 26px; }
.login-status { min-height: 20px; font-size: 13px; margin: 12px 0 0; color: var(--accent-2); }
.login-back { display: block; text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); text-decoration: none; }
.login-back:hover { color: #fff; }

/* ---------------- 后台框架 ---------------- */

.admin-app { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 26px;
  background: rgba(12, 14, 17, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-brand { display: flex; align-items: center; gap: 12px; }
.app-logo { width: 34px; height: 34px; color: var(--accent); flex: none; }
.app-logo svg { width: 100%; height: 100%; }
.app-brand strong { display: block; font-size: 15px; letter-spacing: 0.04em; }
.app-brand small { display: block; font-size: 12px; color: var(--muted); }
.app-actions { display: flex; gap: 10px; }

.app-body { display: flex; flex: 1; align-items: flex-start; }

.app-sidebar {
  width: 228px;
  flex: none;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 60px;
  align-self: flex-start;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.app-sidebar nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  color: #c3c9d1;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: 0.18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item.active { background: var(--accent-soft); border-left-color: var(--accent); color: #fff; font-weight: 600; }

.badge { background: var(--accent); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 7px; font-family: var(--mono); }
.sidebar-tip { font-size: 12px; color: #6e767f; margin: 20px 8px 0; line-height: 1.7; }

.app-main { flex: 1; padding: 30px clamp(18px, 3vw, 40px) 70px; min-width: 0; }

.panel { display: none; }
.panel.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel-title { font-size: 22px; margin: 0 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); letter-spacing: 0.02em; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card h3 { margin: 0 0 16px; font-size: 16px; letter-spacing: 0.04em; display: flex; align-items: center; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.card-note { color: var(--muted); font-size: 13px; margin: -6px 0 16px; }
.count { font-family: var(--mono); font-size: 12px; color: var(--accent-2); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }

.panel-footer { display: flex; gap: 12px; align-items: center; margin-top: 6px; }

/* ---------------- 概览 ---------------- */

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; top: 0; left: 0; width: 40px; height: 3px; background: var(--accent); }
.kpi strong { display: block; font-family: var(--mono); font-size: 26px; letter-spacing: -0.02em; }
.kpi span { font-size: 12.5px; color: var(--muted); letter-spacing: 0.1em; }
.tips { margin: 0; padding-left: 20px; color: #c3c9d1; font-size: 14px; }
.tips li { margin-bottom: 8px; }

/* ---------------- 重复项编辑器 ---------------- */

.rep-list { display: flex; flex-direction: column; gap: 12px; }

.rep-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 4px;
  position: relative;
}
.rep-fields { flex: 1; min-width: 0; display: grid; gap: 0 16px; }
.rep-fields.cols-1 { grid-template-columns: 1fr; }
.rep-fields.cols-2 { grid-template-columns: 1fr 1fr; }
.rep-fields.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.rep-fields .field { margin-bottom: 12px; }
.rep-fields .field > span { font-size: 12px; }

.rep-remove {
  flex: none;
  align-self: flex-start;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(225, 6, 0, 0.35);
  background: rgba(225, 6, 0, 0.1);
  color: #ff7b6f;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: 0.18s;
}
.rep-remove:hover { background: var(--accent); color: #fff; }

.rep-add {
  margin-top: 4px;
  padding: 10px 16px;
  width: 100%;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: #c3c9d1;
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: 0.18s;
}
.rep-add:hover { border-color: var(--accent); color: #fff; background: var(--accent-soft); }
.rep-empty { color: var(--muted); font-size: 13px; padding: 8px 0 14px; }

/* ---------------- 图集 ---------------- */

.drop-zone {
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 18px;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone p { margin: 0 0 6px; }
.drop-hint { font-size: 12.5px; color: var(--muted); }
.upload-meta { margin: 0; }
.upload-status { font-size: 13px; min-height: 20px; margin: 6px 0 0; color: var(--muted); }
.upload-status.ok { color: var(--ok); }
.upload-status.err { color: var(--accent-2); }

/* 背景视频面板 */
.video-preview {
  display: block;
  width: 100%;
  max-width: 560px;
  margin-top: 14px;
  border-radius: 10px;
  background: #000;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  cursor: pointer;
}

.check-line input { width: auto; margin: 0; }

.field input[type="range"] { padding: 0; background: none; border: none; }

.field > span em { font-style: normal; color: var(--text); font-weight: 600; }

.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.photo-admin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }

.photo-admin {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.photo-admin img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #000; }
.photo-admin-body { padding: 12px; }
.photo-admin-body .field { margin-bottom: 8px; }
.photo-admin-body .field > span { font-size: 11.5px; }
.photo-admin-body input { padding: 7px 9px; font-size: 13px; }
.photo-admin-actions { display: flex; gap: 8px; margin-top: 10px; }
.photo-admin-actions .btn { flex: 1; }

/* ---------------- 留言 ---------------- */

.message-list { display: flex; flex-direction: column; gap: 12px; }
.message-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.message-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.message-head strong { font-size: 15px; }
.message-head .meta { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.message-body { color: #ccd2d9; font-size: 14px; white-space: pre-wrap; word-break: break-word; margin: 0 0 12px; }
.message-contact { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

/* ---------------- 密码 ---------------- */

.pwd-form { max-width: 460px; }
.pwd-status { font-size: 13.5px; min-height: 20px; margin: 12px 0 0; }
.pwd-status.ok { color: var(--ok); }
.pwd-status.err { color: var(--accent-2); }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #16191f;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--ok);
  color: #fff;
  padding: 13px 24px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: 0.3s ease;
  z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { border-left-color: var(--accent); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .app-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px;
  }
  .app-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav-item { width: auto; border-radius: 8px; border-left: 0; border-bottom: 3px solid transparent; padding: 8px 14px; }
  .nav-item.active { border-left: 0; border-bottom-color: var(--accent); }
  .sidebar-tip { display: none; }
  .grid-2, .rep-fields.cols-2, .rep-fields.cols-3 { grid-template-columns: 1fr; }
}

/* 保证 hidden 属性始终生效（否则会被 .admin-app 的 display:flex 覆盖） */
[hidden] { display: none !important; }
