/* 后台样式（叠加在 style.css 之上，同一套终端暗色变量） */

/* 登录卡片 */
.card {
  max-width: 440px;
  margin: 48px auto;
  padding: 32px 30px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.card h2 {
  margin: 0 0 18px;
  font-size: 16px;
  color: var(--accent);
  font-weight: normal;
}
.card h2::before { content: "$ "; color: var(--faint); }
#login-view input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  margin-bottom: 14px;
  transition: border-color .15s;
}
#login-view input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 127, 55, 0.1);
}
@media (prefers-color-scheme: dark) {
  #login-view input:focus, #title-input:focus, #slug-input:focus, #content-input:focus {
    box-shadow: 0 0 0 3px rgba(126, 231, 135, 0.12);
  }
}
#login-view button { width: 100%; padding: 11px; margin-top: 4px; }

.hint { color: var(--faint); font-size: 12px; min-height: 1.2em; }
#login-error, #edit-error { color: var(--danger); }

/* 按钮 */
button, .btn-like {
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all .15s ease;
}
button:hover, .btn-like:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
button:active { transform: translateY(1px); }
button.primary, .btn-like.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
button.primary:hover, .btn-like.primary:hover { filter: brightness(1.1); color: var(--bg); }
#login-view input, #title-input, #slug-input, #content-input { background: var(--bg); }
button[data-act="del"]:hover { border-color: var(--danger); color: var(--danger); }

/* 工具栏 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 0; }
.toolbar h2 {
  margin: 0;
  font-size: 15px;
  color: var(--accent);
  font-weight: normal;
}
.toolbar h2::before { content: "$ "; color: var(--faint); }
.toolbar > div { display: flex; gap: 10px; }

/* 文章管理列表 */
#admin-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#admin-list .post-item {
  animation: rise .4s ease backwards;
  align-items: center;
  padding: 14px 18px;
}
#admin-list .post-title { font-size: 14px; }
#admin-list .ops { display: flex; gap: 8px; }
#admin-list .ops button { padding: 5px 12px; font-size: 12px; }
#admin-list .post-date { margin-left: 10px; }

.draft-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 9px;
  border: 1px solid var(--danger);
  border-radius: 4px;
  background: transparent;
  color: var(--danger);
  font-size: 10.5px;
  vertical-align: 1.5px;
}

/* 编辑器 */
#title-input, #slug-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
#title-input { font-size: 17px; font-weight: 600; }
#slug-input { font-size: 12px; color: var(--muted); }
#title-input:focus, #slug-input:focus, #content-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(126, 231, 135, 0.12);
}

.pub {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 14px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.pub::before { content: "> "; color: var(--faint); }
.pub input { accent-color: var(--accent); width: 14px; height: 14px; }

/* 编辑器：左写右预览 */
#content-input {
  width: 100%;
  min-height: 55vh;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.85 var(--mono);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.preview-pane {
  min-height: 55vh;
  max-height: 70vh;
  overflow-y: auto;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--card);
  font-size: 13.5px;
}
.preview-pane:empty::before {
  content: "> 预览区：左边写的会实时出现在这里_";
  color: var(--faint);
  font-size: 12px;
}
.preview-pane h1::before, .preview-pane h2::before, .preview-pane h3::before { color: var(--accent); }
.preview-pane h1::before { content: "# "; }
.preview-pane h2::before { content: "## "; }
.preview-pane h3::before { content: "### "; }

@media (max-width: 880px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-pane { min-height: 30vh; }
}

/* 图片上传行 */
.editor-ops {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 14px;
}
.editor-ops .hint { color: var(--faint); font-size: 12px; }

/* 站点设置表单 */
.settings-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
}
.settings-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.settings-form input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.settings-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 127, 55, 0.1);
}

input::placeholder, textarea::placeholder { color: var(--faint); opacity: .8; }

@media (max-width: 560px) {
  .card { margin: 32px auto; padding: 26px 20px; }
  .toolbar { flex-wrap: wrap; gap: 10px; }
}

/* ---------- 统计页 ---------- */
.stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stats-cards .stat-num { font-size: 34px; font-weight: 700; color: var(--accent); margin: 4px 0 0; }
.chart-card { margin-bottom: 16px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { width: 100%; max-width: 28px; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; transition: height .3s; }
.bar-col:hover .bar { opacity: 1; }
.bar-num { font-size: 10px; color: var(--muted); height: 14px; }
.bar-day { font-size: 10px; color: var(--muted); margin-top: 4px; }
.top-list { list-style: none; padding: 0; margin: 8px 0 0; }
.top-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.top-list li:last-child { border-bottom: 0; }
.top-n { color: var(--accent); font-weight: 600; }

/* ---------- 媒体库 ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-item { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.media-item img { width: 100%; height: 120px; object-fit: cover; border-radius: 5px; background: var(--bg); }
.media-name { font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 11px; color: var(--muted); margin: 0; }
.media-ops { display: flex; gap: 6px; margin-top: auto; }
.media-ops button { flex: 1; font-size: 12px; padding: 5px 8px; }
.pw-form { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); }
