/* =========================================================
   admin.css —— 后台管理系统样式
   深色风格，与前台保持一致；左侧边栏 + 右侧内容区布局
   ========================================================= */

:root {
  --bg: #0b0e1a;
  --bg-soft: #12162b;
  --card: #161b33;
  --card-2: #1c2240;
  --border: rgba(255, 255, 255, 0.1);
  --text: #e8eaf6;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --primary: #7c5cff;
  --primary-2: #4dd0e1;
  --accent: #ffb86c;
  --danger: #ff5c7a;
  --ok: #4ade80;
  --grad: linear-gradient(135deg, #7c5cff 0%, #4dd0e1 100%);
  --radius: 14px;
  --sidebar-w: 232px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); }
.hidden { display: none !important; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(500px 400px at 20% 20%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(500px 400px at 80% 70%, rgba(77, 208, 225, 0.14), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 42px 38px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.login-card .logo {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.login-card .logo .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--grad);
  margin-right: 8px;
  vertical-align: 2px;
}
.login-card .sub {
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
  margin-bottom: 28px;
}
.login-card .err {
  background: rgba(255, 92, 122, 0.1);
  border: 1px solid rgba(255, 92, 122, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-card .hint {
  margin-top: 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}
.login-card .hint a { color: var(--primary-2); }

/* ---------------- 后台整体布局 ---------------- */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.sidebar .brand {
  font-size: 18px;
  font-weight: 800;
  padding: 4px 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar .brand .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--grad);
}
.sidebar .menu { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sidebar .menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14.5px;
  text-align: left;
  transition: all 0.25s ease;
}
.sidebar .menu button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.sidebar .menu button.active {
  background: rgba(124, 92, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(124, 92, 255, 0.3);
}
.sidebar .logout-btn {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  transition: all 0.25s;
}
.sidebar .logout-btn:hover { color: var(--danger); border-color: rgba(255, 92, 122, 0.4); }

.main {
  flex: 1;
  padding: 28px 32px 60px;
  min-width: 0;
}
.main .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.main .panel-head h2 { font-size: 22px; font-weight: 800; }
.main .panel-head p { color: var(--text-3); font-size: 13px; margin-top: 4px; }

/* ---------------- 表单控件 ---------------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; color: var(--text-2); margin-bottom: 7px; }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.25s, box-shadow 0.25s;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: all 0.25s ease;
}
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(124, 92, 255, 0.4); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }
.btn-danger { background: rgba(255, 92, 122, 0.12); color: var(--danger); border: 1px solid rgba(255, 92, 122, 0.3); }
.btn-danger:hover { background: rgba(255, 92, 122, 0.22); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- 面板卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
}
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* 提示条 */
.toast {
  position: fixed;
  top: 22px; left: 50%;
  transform: translate(-50%, -80px);
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: all 0.35s ease;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { background: #123b26; color: var(--ok); border: 1px solid rgba(74, 222, 128, 0.35); }
.toast.err { background: #3b1220; color: var(--danger); border: 1px solid rgba(255, 92, 122, 0.35); }

/* ---------------- 技能/博客 表格 ---------------- */
.table-card { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.table th {
  text-align: left;
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  vertical-align: middle;
}
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.table .actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.badge-cat { color: var(--accent); background: rgba(255, 184, 108, 0.1); border: 1px solid rgba(255, 184, 108, 0.25); }
.badge-lv {
  color: var(--primary-2);
  background: rgba(77, 208, 225, 0.1);
  border: 1px solid rgba(77, 208, 225, 0.25);
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 14, 0.72);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 30px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.3s ease;
}
.modal.wide { max-width: 820px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-size: 16px;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(255, 92, 122, 0.15); color: var(--danger); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* 编辑器 Tab：编辑 / 预览 */
.editor-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.editor-tabs button {
  padding: 7px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
}
.editor-tabs button.active { background: rgba(124, 92, 255, 0.16); color: #fff; border-color: rgba(124, 92, 255, 0.35); }
.preview-area {
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
}
.preview-area h1, .preview-area h2, .preview-area h3 { margin: 12px 0 8px; }
.preview-area p { margin: 8px 0; color: var(--text-2); }
.preview-area code { background: rgba(124, 92, 255, 0.14); color: var(--accent); padding: 2px 7px; border-radius: 5px; }
.preview-area pre { background: #0d1020; border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 10px 0; }
.preview-area pre code { background: none; color: #c9d4ff; padding: 0; }
.preview-area ul, .preview-area ol { margin: 8px 0 8px 22px; color: var(--text-2); }
.preview-area blockquote { border-left: 3px solid var(--primary); padding: 6px 14px; margin: 10px 0; color: var(--text-2); background: rgba(124, 92, 255, 0.06); }

/* 范围滑块 */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--grad);
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.3);
}

/* ---------------- 联系方式管理 ---------------- */
.contact-row {
  display: grid;
  grid-template-columns: 130px 150px 1fr 80px 100px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  margin-bottom: 10px;
}
.contact-row .c-del { justify-self: end; }
@media (max-width: 900px) {
  .contact-row { grid-template-columns: 1fr 1fr; }
  .contact-row .c-del { justify-self: start; }
}

/* 统计编辑网格 */
.stats-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 14px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .sidebar .brand { padding: 0 8px 0 0; }
  .sidebar .menu { flex-direction: row; overflow-x: auto; flex: 1; }
  .sidebar .menu button { white-space: nowrap; width: auto; padding: 9px 14px; }
  .sidebar .logout-btn { margin-left: auto; }
  .main { padding: 22px 16px 50px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
