/* ============ 管理后台样式 —— 火山引擎简洁蓝白风 ============ */
:root {
  --primary: #1664ff;
  --primary-hover: #0e4ee0;
  --primary-soft: #e8f0ff;
  --bg: #f7f8fa;
  --card: #fff;
  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --line: #e5e6eb;
  --green: #00b42a;
  --red: #f53f3f;
  --orange: #ff7d00;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; font-size: 13px; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }

.admin-layout { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--line); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-logo { padding: 20px 18px; font-size: 16px; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.side-logo .logo-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.side-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.side-nav a { padding: 11px 14px; border-radius: 8px; font-size: 14px; color: var(--text-2); transition: all .15s; }
.side-nav a:hover { background: var(--primary-soft); color: var(--primary); }
.side-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-foot { padding: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.side-foot a { font-size: 13px; color: var(--text-3); }
.side-foot button { color: var(--red); font-size: 13px; text-align: left; padding: 0; }

/* ---------- 主区域 ---------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.admin-topbar h1 { font-size: 16px; font-weight: 600; flex: 1; }
.menu-btn { display: none; font-size: 20px; color: var(--text-2); }
.admin-user { font-size: 13px; color: var(--text-3); }
.admin-content { padding: 20px; max-width: 1100px; width: 100%; margin: 0 auto; }
.page { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 卡片 / 统计 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-card b { display: block; font-size: 26px; font-weight: 600; margin: 6px 0 2px; color: var(--text); }
.stat-card span { font-size: 12.5px; color: var(--text-3); }
.stat-card .ico { font-size: 20px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--text-3); font-weight: 500; font-size: 12.5px; background: var(--bg); }
tr:hover td { background: #fafbfc; }
.tbl-user { display: flex; align-items: center; gap: 8px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600; flex-shrink: 0; }
.tag { font-size: 11.5px; padding: 3px 9px; border-radius: 4px; }
.tag-ok { background: #e8ffea; color: var(--green); }
.tag-warn { background: #fff7e0; color: #b87400; }
.tag-bad { background: #fff1f0; color: var(--red); }
.tag-info { background: var(--primary-soft); color: var(--primary); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; transition: all .15s;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border: 1px solid var(--line); color: var(--text-2); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff1f0; color: var(--red); }
.btn-green { background: #e8ffea; color: var(--green); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; outline: none; color: var(--text);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 260px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { background: #fff; width: 100%; max-width: 440px; border-radius: 12px; padding: 20px; max-height: 88vh; overflow-y: auto; animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.96); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ---------- 分页 / Toast ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 0; font-size: 13px; color: var(--text-3); }
.pager button { padding: 5px 13px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--text-2); }
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: .4; }
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(29,33,41,.92); color: #fff; font-size: 13px; padding: 9px 18px; border-radius: 999px; opacity: 0; transform: translateY(-10px); transition: all .25s; }
.toast.show { opacity: 1; transform: none; }
.toast-success { background: rgba(0,180,42,.95); }
.toast-error { background: rgba(245,63,63,.95); }
.empty { text-align: center; color: var(--text-3); padding: 36px 0; font-size: 13.5px; }
.thumb-sm { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #f2f3f5; border: 1px solid var(--line); }

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .side-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; }
  .menu-btn { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 14px; }
  .admin-topbar { padding: 12px 14px; }
}

/* ===== 图片放大查看（lightbox） ===== */
.lightbox-mask {
  position: fixed; inset: 0; z-index: 999; background: rgba(0, 0, 0, .85);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox-img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 8px 40px rgba(0, 0, 0, .4); }
.lightbox-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer; border: none;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.thumb-sm { cursor: zoom-in; }
