/* 后台管理 · 跟随全站主题 */
@import url("style.css");

body { padding-bottom: 92px; } /* 给底部播放器留空间 */

/* ---------- 批量管理栏 ---------- */
.batch-bar {
  display: none; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.batch-bar.show { display: flex; }
.batch-bar .bb-info { color: var(--text-2); margin-right: 4px; }
.batch-bar .bb-info b { color: var(--text-1); }
.row-chk { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--bg) 0%, var(--surface-2) 100%);
}
.login-card {
  width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 40px 36px; box-shadow: var(--shadow-lg);
}
.login-card .logo { justify-content: center; margin-bottom: 6px; font-size: 20px; }
.login-card .sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display:block; font-size: 13px; font-weight:600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px; font-size: 14px; outline: none; background: var(--surface-2); color: var(--text-1); transition: all .15s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--text-2); background: var(--surface); }
.login-tip { font-size: 12px; color: var(--text-3); text-align:center; margin-top: 16px; }
.btn-block { width: 100%; justify-content: center; margin-top: 6px; }
.login-err { color: var(--danger); font-size: 13px; text-align:center; min-height: 18px; margin-bottom: 4px; }

/* ---------- 后台布局 ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 14px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sidebar .logo { padding: 0 10px 20px; }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  font-size: 14px; color: var(--text-2); transition: all .15s; border: none; background: none; text-align: left;
}
.side-item:hover { background: var(--surface-2); color: var(--text-1); }
.side-item.active { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.sidebar .foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display:flex; flex-direction:column; gap:4px; }
.side-user { padding: 8px 14px; font-size: 12px; color: var(--text-3); }
.side-item .badge-dot {
  margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.side-item .badge-dot.show { display: inline-flex; }

.admin-main { flex: 1; padding: 28px 32px; min-width: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }
.admin-head h1 { font-size: 22px; }
.admin-head .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--hover);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-1);
}
.stat-card .num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .lbl { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---------- 表格 ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  margin-bottom: 18px;
}
.panel-toolbar {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.panel-toolbar input {
  height: 36px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px;
  font-size: 13px; outline: none; background: var(--surface-2); color: var(--text-1); width: 240px;
}
.panel-toolbar input:focus { background: var(--surface); border-color: var(--text-3); }
.panel-toolbar .spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 11px 16px; font-size: 12px; color: var(--text-3); font-weight: 600;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-1); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }
.t-cover { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--track-bg); }
.t-title { font-weight: 600; }
.t-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tag { font-size: 11px; background: var(--hover); padding: 3px 9px; border-radius: 99px; color: var(--text-2); white-space:nowrap; }
.tag.today { background: var(--accent); color: var(--accent-fg); }
.tag.rec { background: var(--gold-bg); color: var(--gold-fg); }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; transition: all .15s;
}
.icon-btn:hover { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.icon-btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.empty-row td { text-align: center; color: var(--text-3); padding: 40px 0; }

/* ---------- 设置面板 ---------- */
.settings-panel { max-width: 620px; }
.settings-panel .panel { padding: 20px 22px; margin-bottom: 18px; }
.settings-panel h3 { font-size: 15px; margin-bottom: 14px; }
.settings-panel p.hint { font-size: 13px; color: var(--text-3); line-height: 1.8; margin-bottom: 14px; }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: var(--mask); z-index: 400;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  width: 520px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: 16px; padding: 26px 28px; box-shadow: var(--shadow-lg);
  position: relative;
}
.modal h2 { font-size: 18px; margin-bottom: 20px; }
.modal .m-sub { font-size: 13px; color: var(--text-3); margin: -14px 0 18px; }
.modal .m-close {
  position: absolute; right: 16px; top: 16px; background: none; border: none;
  font-size: 17px; color: var(--text-3);
}
.modal .m-close:hover { color: var(--text-1); }
.form-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============================================================
   广告管理
   ============================================================ */
.ad-drop {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 26px 20px;
  text-align: center; background: var(--surface-2); transition: all .15s;
}
.ad-drop.drag { border-color: var(--accent); background: var(--hover); }
.ad-drop .big { font-size: 26px; margin-bottom: 8px; }
.ad-drop p { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.ad-drop .sub { font-size: 12px; color: var(--text-3); margin-bottom: 12px; }

.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ad-card {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface);
}
.ad-card .thumb {
  position: relative; height: 132px; background: var(--surface-2); cursor: pointer; overflow: hidden;
}
.ad-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-card .thumb .ph {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-3);
}
.ad-card .thumb .pick-tip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; font-size: 12px; opacity: 0; transition: opacity .15s;
}
.ad-card .thumb:hover .pick-tip { opacity: 1; }
.ad-card .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ad-card .meta input {
  height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px;
  font-size: 12px; background: var(--surface-2); color: var(--text-1); outline: none; width: 100%;
}
.ad-card .meta input:focus { border-color: var(--text-3); background: var(--surface); }
.ad-card .row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ad-card .switch { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.ad-card .ops { display: flex; gap: 4px; }
.ad-card.disabled .thumb img { opacity: .45; filter: grayscale(1); }
.ad-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 40px 0; }

/* ============================================================
   风格皮肤
   ============================================================ */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.theme-card {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer;
  background: var(--surface); transition: all .15s; position: relative;
}
.theme-card:hover { border-color: var(--text-3); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--hover); }
.theme-card .preview {
  height: 84px; border-radius: 8px; overflow: hidden; display: flex; border: 1px solid var(--border);
}
.theme-card .preview .col { flex: 1; display: flex; flex-direction: column; }
.theme-card .preview .bar { height: 16px; }
.theme-card .preview .ln { height: 6px; border-radius: 3px; margin: 8px 8px 0; }
.theme-card .tname { font-size: 13px; font-weight: 700; margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.theme-card .tdesc { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.theme-card .check {
  position: absolute; right: 10px; top: 10px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 800;
  display: none; align-items: center; justify-content: center;
}
.theme-card.active .check { display: flex; }

/* ============================================================
   定制订单
   ============================================================ */
.order-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.order-stat {
  flex: 1; min-width: 130px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.order-stat .n { font-size: 20px; font-weight: 800; }
.order-stat .l { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.order-table td { vertical-align: top; }
.order-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; }
.order-cust .nm { font-weight: 600; }
.order-cust .ph { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.order-addr { font-size: 12px; color: var(--text-2); max-width: 260px; line-height: 1.6; }
.song-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; }
.song-chip { font-size: 11px; background: var(--hover); color: var(--text-2); padding: 2px 7px; border-radius: 6px; }
.song-more { font-size: 11px; color: var(--text-3); align-self: center; }
.status-sel {
  height: 28px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px;
  background: var(--surface-2); color: var(--text-1); padding: 0 6px; outline: none;
}
.st-tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.st-tag.warn { background: #fef3c7; color: #92400e; }
.st-tag.info { background: #e0ecff; color: #1e40af; }
.st-tag.ok { background: #dcfce7; color: #166534; }
.st-tag.muted { background: var(--hover); color: var(--text-3); }
html[data-theme="dark"] .st-tag.warn { background: #3a2f14; color: #fbbf24; }
html[data-theme="dark"] .st-tag.info { background: #1c2b45; color: #93b4f5; }
html[data-theme="dark"] .st-tag.ok { background: #16321f; color: #6ee7a0; }

.order-detail-row td { background: var(--surface-2); }
.order-detail { display: grid; grid-template-columns: 1fr 300px; gap: 20px; padding: 6px 0; }
.order-detail h4 { font-size: 13px; margin-bottom: 8px; color: var(--text-2); }
.order-detail ol { margin: 0; padding-left: 20px; font-size: 12px; color: var(--text-2); line-height: 1.9; }
.order-detail .kv { font-size: 12px; color: var(--text-2); line-height: 1.9; }
.order-detail .kv b { color: var(--text-1); font-weight: 600; }
.order-detail textarea {
  width: 100%; min-height: 70px; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; background: var(--surface); color: var(--text-1); outline: none; resize: vertical;
}
.order-detail .btn { margin-top: 8px; }

/* ---------- 商城设置 ---------- */
.cap-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cap-row { display: flex; align-items: center; gap: 8px; }
.cap-row input[type="text"] { width: 92px; }
.cap-row input[type="number"] { width: 100px; }
.cap-row .unit { font-size: 12px; color: var(--text-3); }
.cap-row label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.cap-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 24px 8px; }
  .sidebar .logo span:last-child, .side-item .txt, .side-user, .side-item .badge-dot { display: none; }
  .admin-main { padding: 20px 16px; }
  .order-detail { grid-template-columns: 1fr; }
}
