/* Notion 风格简洁样式（v2：含商城 / 播放器 / 手机适配） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --text: #37352f; --text-light: #787774; --bg: #ffffff; --bg-sub: #f7f6f3;
  --border: #e9e9e7; --accent: #2383e2; --accent-dark: #1a72c8;
  --danger: #eb5757; --success: #219653; --gold: #d9730d; --radius: 6px;
}
body {
  font-family: ui-sans-serif, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  background: var(--bg-sub); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 14px; font-size: 14px; font-family: inherit; transition: background .15s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: #ececea; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: #b85f08; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; outline: none; max-width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(35,131,226,.15); }
label { font-size: 13px; color: var(--text-light); display: block; margin-bottom: 4px; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); z-index: 20;
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand .logo { width: 26px; height: 26px; background: var(--text); color: #fff; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.nav { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav a { padding: 5px 12px; border-radius: var(--radius); color: var(--text-light); font-size: 14px; }
.nav a:hover { background: var(--bg-sub); }
.nav a.active { color: var(--text); background: var(--bg-sub); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-light); flex-shrink: 0; }
.cart-badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 5px; margin-left: 2px; line-height: 16px; display: inline-block; }

/* 容器 */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }
.container.narrow { max-width: 720px; }
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--text-light); font-size: 14px; margin-bottom: 20px; }
.muted { color: var(--text-light); font-size: 12.5px; }
.price { color: var(--gold); font-weight: 700; }
.price .unit { font-size: 13px; font-weight: 400; }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tab { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-size: 14px; color: var(--text-light); }
.tab:hover { background: var(--bg-sub); }
.tab.active { background: var(--text); border-color: var(--text); color: #fff; }

/* 内容卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; background: #fff; }
.card:hover { box-shadow: 0 4px 18px rgba(15,15,15,.09); transform: translateY(-1px); }
.card .cover { height: 150px; background: var(--bg-sub); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .cover .ph { font-size: 34px; opacity: .45; }
.card .cover .lockbar { position: absolute; left: 0; bottom: 0; right: 0; background: rgba(55,53,47,.78); color: #fff; font-size: 12px; padding: 4px 10px; text-align: center; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
.card .desc { font-size: 13px; color: var(--text-light); flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-light); flex-wrap: wrap; }
.card .actions { display: flex; gap: 8px; margin-top: 4px; align-items: center; }
.badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; color: #fff; }
.badge.type { background: var(--bg-sub); color: var(--text-light); border: 1px solid var(--border); }
.empty { text-align: center; color: var(--text-light); padding: 60px 0; }
.lock-tip { font-size: 12.5px; color: var(--gold); display: flex; align-items: center; gap: 4px; }

/* 列表（购物车 / 我的） */
.list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-size: 15px; font-weight: 500; }

/* 结算栏 */
.checkout-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-top: 18px;
  position: sticky; bottom: 12px; background: #fff; box-shadow: 0 4px 20px rgba(15,15,15,.06);
}
.total-amount { font-size: 20px; font-weight: 700; color: var(--gold); }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,15,15,.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 440px; padding: 24px; max-height: 92vh; overflow: auto; }
.modal.wide { max-width: 980px; height: 88vh; display: flex; flex-direction: column; }
.modal h2 { font-size: 19px; margin-bottom: 14px; }
.modal .form-row { margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.viewer-frame { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fbfbfa; }
.viewer-media { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #0f0f0f; border-radius: 8px; padding: 16px; overflow: auto; }
.viewer-media video { max-width: 100%; max-height: 60vh; border-radius: 6px; background: #000; }
.viewer-media audio { width: 100%; max-width: 560px; }
.docx-render { flex: 1; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #fbfbfa; padding: 20px; }
.preview-box { flex: 1; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #fbfbfa; }
.preview-box iframe { width: 100%; height: 100%; border: 0; }
.pay-qr { text-align: center; padding: 12px 0; }
.pay-qr img { width: 240px; height: 240px; border: 1px solid var(--border); border-radius: 8px; }
.sunpay-tip { background: #fdf6ec; border: 1px solid #f5ddb8; color: #8a5a00; border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.7; }

/* 提示条 */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 999; display: none; max-width: 86vw; text-align: center; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }

/* 登录页 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-sub); padding: 20px; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 38px; width: 100%; max-width: 380px; box-shadow: 0 8px 40px rgba(15,15,15,.06); }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; text-align: center; }
.auth-card .sub { color: var(--text-light); font-size: 13px; text-align: center; margin-bottom: 24px; }
.auth-card .form-row { margin-bottom: 14px; }
.auth-card input { width: 100%; }
.auth-card .btn-primary { width: 100%; padding: 10px; margin-top: 6px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--text-light); margin-top: 18px; }

/* 管理后台 */
.admin-layout { display: flex; max-width: 1240px; margin: 0 auto; align-items: flex-start; }
.admin-nav { width: 190px; padding: 28px 0 0 20px; flex-shrink: 0; position: sticky; top: 60px; }
.admin-nav .nav-item { padding: 7px 12px; border-radius: var(--radius); cursor: pointer; color: var(--text-light); font-size: 14px; margin-bottom: 2px; }
.admin-nav .nav-item.active { background: var(--bg-sub); color: var(--text); font-weight: 600; }
.admin-main { flex: 1; padding: 28px 24px 80px; min-width: 0; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; color: var(--text-light); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tr:hover td { background: var(--bg-sub); }
.section { margin-bottom: 34px; }
.section > h2 { font-size: 18px; margin-bottom: 12px; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.form-inline .field { display: flex; flex-direction: column; }
.code-pill { background: var(--bg-sub); border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-family: Consolas, monospace; font-size: 12.5px; }
.codes-box { background: var(--bg-sub); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-top: 12px; font-family: Consolas, monospace; font-size: 13px; line-height: 1.9; user-select: all; }
.chip { display: inline-block; background: var(--bg-sub); border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; margin: 1px; font-size: 12px; }
.chip-on { background: #fff4e5; border-color: #f5c98a; color: #b26a00; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12.5px; color: var(--text-light); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- 手机端适配 ---------------- */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .brand { font-size: 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; margin-left: 0; }
  .nav a { padding: 5px 10px; font-size: 13.5px; }
  .userbox { font-size: 13px; gap: 6px; }
  .container { padding: 18px 14px 70px; }
  .page-title { font-size: 21px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card .cover { height: 132px; }
  .card .actions { flex-wrap: wrap; }
  .modal { padding: 18px; max-height: 94vh; }
  .modal.wide { height: 92vh; max-height: 92vh; }
  .admin-layout { flex-direction: column; }
  .admin-nav { width: 100%; display: flex; gap: 6px; overflow-x: auto; padding: 12px 14px 0; position: static; }
  .admin-nav .nav-item { white-space: nowrap; margin-bottom: 0; }
  .admin-main { padding: 16px 14px 70px; }
  table.grid { display: block; overflow-x: auto; white-space: nowrap; }
  .checkout-bar { flex-direction: column; align-items: stretch; gap: 10px; position: static; }
  .viewer-media video { max-height: 46vh; }
}
