/* 素材商城样式。
   刻意复用 styles.css 里已有的设计令牌（--bg / --panel / --text / --blue 等），
   视觉上与站内 Pantone、3D Bend 页面保持一致：浅色、白面板、细边框、Apple 味。 */

.materials-page {
  --mt-radius: 10px;
  --mt-radius-lg: 14px;
  --mt-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  min-height: 100vh;
  background: var(--bg, #f4f4f4);
  color: var(--text, #1d1d1f);
}

/* 注意：下面这条「整页链接继承文字色」的规则靠继承生效（特异度 0,1,1），
   会盖掉同样是单类的 .mt-btn-primary / .mt-btn-blue（0,1,0）。
   所以按钮配色必须用 .materials-page .mt-btn-* 提升特异度写，见下面几行。
   否则深色按钮背景上会出现深色文字（"看不见的按钮"）。 */
.materials-page a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */

.mt-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, .08));
}

.mt-topbar-inner {
  max-width: var(--max, 1180px);
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.mt-brand { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
.mt-brand small { font-weight: 400; color: var(--muted, #5f6368); font-size: 12px; }
.mt-topnav { display: flex; align-items: center; gap: 16px; margin-left: 6px; font-size: 14px; }
.mt-topnav a { color: var(--muted, #5f6368); padding: 4px 0; }
.mt-topnav a:hover, .mt-topnav a[aria-current="page"] { color: var(--text, #1d1d1f); }
.mt-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.mt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line, rgba(0, 0, 0, .08));
  background: #fff;
  color: var(--text, #1d1d1f);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.mt-btn:hover { background: #f7f8fa; }
.mt-btn:disabled { opacity: .5; cursor: not-allowed; }
.mt-btn-primary { background: #111827; border-color: #111827; color: #fff; }
.mt-btn-primary:hover { background: #1f2937; }
.mt-btn-blue { background: var(--blue, #2997ff); border-color: var(--blue, #2997ff); color: #fff; }
.mt-btn-blue:hover { filter: brightness(.95); }
.mt-btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.mt-btn-ghost { background: transparent; border-color: transparent; color: var(--muted, #5f6368); }
.mt-btn-ghost:hover { background: rgba(0, 0, 0, .04); }
.mt-btn-danger { color: #b42318; border-color: #f4c7c3; background: #fff; }
.mt-btn-danger:hover { background: #fef3f2; }

/* a 标签形式的按钮需要提高特异度，压过上面的 .materials-page a */
.materials-page .mt-btn-primary { color: #fff; }
.materials-page .mt-btn-primary:hover { color: #fff; }
.materials-page .mt-btn-blue { color: #fff; }
.materials-page .mt-btn-blue:hover { color: #fff; }
.materials-page .mt-btn-danger { color: #b42318; }

.mt-user { font-size: 13px; color: var(--muted, #5f6368); }
.mt-badge-cart {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #111827; color: #fff; font-size: 11px; line-height: 1;
}

/* ---------- 布局 ---------- */

.mt-main { max-width: var(--max, 1180px); margin: 0 auto; padding: 22px 20px 64px; }
.mt-page-title { margin: 0 0 4px; font-size: 24px; letter-spacing: -.01em; }
.mt-page-sub { margin: 0 0 20px; color: var(--muted, #5f6368); font-size: 13px; }
.mt-panel { background: var(--panel, #fff); border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: var(--mt-radius-lg); }
.mt-panel-pad { padding: 18px; }
.mt-section-title { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.mt-muted { color: var(--muted, #5f6368); }
.mt-small { font-size: 12px; }
.mt-row { display: flex; align-items: center; gap: 10px; }
.mt-row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-spacer { flex: 1; }

/* ---------- 素材库 ---------- */

.mt-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.mt-search { flex: 1 1 320px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: 10px; padding: 0 12px; height: 40px; }
.mt-search input { flex: 1; border: 0; outline: 0; font: inherit; background: transparent; height: 100%; }
.mt-select { height: 40px; border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: 10px; background: #fff; padding: 0 10px; font: inherit; color: inherit; }

.mt-filters { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin-bottom: 18px; }
.mt-filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-filter-label { min-width: 62px; color: var(--muted, #5f6368); font-size: 13px; }
.mt-chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px;
  border-radius: 14px; border: 1px solid var(--line, rgba(0, 0, 0, .08));
  background: #fff; font-size: 13px; color: var(--muted, #5f6368); cursor: pointer;
}
.mt-chip:hover { color: var(--text, #1d1d1f); }
.mt-chip[aria-pressed="true"] { background: #111827; border-color: #111827; color: #fff; }

.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.mt-card { background: #fff; border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: var(--mt-radius-lg); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .18s ease, transform .18s ease; }
.mt-card:hover { box-shadow: var(--mt-shadow); transform: translateY(-2px); }
.mt-card-media { position: relative; aspect-ratio: 16 / 9; background: #eceff3; overflow: hidden; }
.mt-card-media-link { display: block; width: 100%; height: 100%; }
.mt-card-media img, .mt-card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 预览视频是卡片的主体：滚入视口由 JS 挂上 src 并播放，
   加载完淡入盖住封面图；封面图同时是视频加载前/被拦截时的兜底。 */
.mt-card-media video { opacity: 0; position: absolute; inset: 0; transition: opacity .3s ease; }
.mt-card-media video.is-ready { opacity: 1; }
.mt-card-tag { position: absolute; left: 8px; top: 8px; display: inline-flex; gap: 6px; }
.mt-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; background: rgba(17, 24, 39, .78); color: #fff; backdrop-filter: blur(4px); }
.mt-pill-light { background: rgba(255, 255, 255, .9); color: #111827; }
.mt-pill-ai { background: #b45309; }
.mt-duration { position: absolute; right: 8px; bottom: 8px; }

/* 卡片右上角的收藏红心 */
.mt-fav-btn {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(17, 24, 39, .55); color: #fff;
  font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s ease, transform .15s ease;
}
.mt-fav-btn:hover { background: rgba(17, 24, 39, .82); transform: scale(1.06); }
.mt-fav-btn[data-on="true"] { background: #e11d48; }
.mt-fav-btn[data-on="true"]:hover { background: #be123c; }
.mt-fav-btn:disabled { opacity: .6; cursor: not-allowed; }
.materials-page .mt-fav-btn { color: #fff; }
.mt-card-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mt-card-title { font-size: 14px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.mt-card-meta { display: flex; align-items: center; gap: 8px; color: var(--soft, #7a7d82); font-size: 12px; }
.mt-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mt-price { font-size: 17px; font-weight: 700; }
.mt-price small { font-size: 12px; font-weight: 400; color: var(--muted, #5f6368); }

.mt-empty { padding: 56px 20px; text-align: center; color: var(--muted, #5f6368); }
.mt-pager { display: flex; justify-content: center; gap: 10px; margin-top: 26px; }
.mt-loading { padding: 40px; text-align: center; color: var(--muted, #5f6368); }

/* ---------- 详情页 ---------- */

.mt-detail { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 22px; align-items: start; }
@media (max-width: 940px) { .mt-detail { grid-template-columns: minmax(0, 1fr); } }

.mt-player { position: relative; background: #0b0f14; border-radius: var(--mt-radius-lg); overflow: hidden; aspect-ratio: 16 / 9; }
.mt-player video { width: 100%; height: 100%; display: block; object-fit: contain; background: #0b0f14; }
.mt-player-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 13px; text-align: center; padding: 20px; }
.mt-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.mt-thumb { flex: 0 0 108px; height: 61px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #eceff3; }
.mt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-thumb[aria-current="true"] { border-color: var(--blue, #2997ff); }

.mt-spec { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 18px; margin-top: 4px; }
.mt-spec-item { font-size: 13px; display: flex; gap: 8px; }
.mt-spec-key { color: var(--muted, #5f6368); min-width: 62px; }
.mt-spec-val { font-weight: 500; word-break: break-all; }

.mt-keywords { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.mt-buybox { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 14px; }
.mt-license-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: var(--mt-radius); cursor: pointer; background: #fff; }
.mt-license-option + .mt-license-option { margin-top: 8px; }
.mt-license-option[data-selected="true"] { border-color: #111827; box-shadow: inset 0 0 0 1px #111827; }
.mt-license-option[data-disabled="true"] { opacity: .5; cursor: not-allowed; }
.mt-license-radio { margin-top: 3px; }
.mt-license-main { flex: 1; min-width: 0; }
.mt-license-name { font-size: 14px; font-weight: 600; }
.mt-license-desc { font-size: 12px; color: var(--muted, #5f6368); margin-top: 2px; }
.mt-license-price { font-size: 16px; font-weight: 700; white-space: nowrap; }
.mt-license-price small { font-size: 11px; font-weight: 400; color: var(--muted, #5f6368); display: block; text-align: right; }

.mt-buy-actions { display: flex; flex-direction: column; gap: 8px; }
.mt-note { font-size: 12px; color: var(--muted, #5f6368); line-height: 1.6; }

.mt-usage-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mt-usage-table th, .mt-usage-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line, rgba(0, 0, 0, .06)); }
.mt-usage-table th { color: var(--muted, #5f6368); font-weight: 500; }
.mt-usage-yes { color: #08724f; }
.mt-usage-no { color: #b0b6bd; }

.mt-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line, rgba(0, 0, 0, .08)); margin-bottom: 14px; }
.mt-tab { padding: 10px 0; font-size: 14px; color: var(--muted, #5f6368); border-bottom: 2px solid transparent; cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; font-family: inherit; }
.mt-tab[aria-selected="true"] { color: var(--text, #1d1d1f); border-bottom-color: #111827; font-weight: 600; }
.mt-terms { white-space: pre-line; font-size: 13px; line-height: 1.75; color: #374151; }

/* ---------- 购物车 / 结算 ---------- */

.mt-cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .mt-cart-layout { grid-template-columns: minmax(0, 1fr); } }
.mt-cart-item { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 14px; padding: 14px; align-items: center; }
.mt-cart-item + .mt-cart-item { border-top: 1px solid var(--line, rgba(0, 0, 0, .06)); }
.mt-cart-thumb { width: 132px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #eceff3; }
.mt-cart-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-cart-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mt-cart-tier { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: #eef2f7; color: #334155; font-size: 12px; }
.mt-cart-price { text-align: right; font-weight: 700; font-size: 16px; }

.mt-summary-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; }
.mt-summary-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line, rgba(0, 0, 0, .08)); font-weight: 700; }
.mt-summary-total .mt-price { font-size: 22px; }

.mt-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mt-field label { font-size: 13px; font-weight: 500; }
.mt-field .mt-hint { font-size: 12px; color: var(--muted, #5f6368); }
.mt-input, .mt-textarea {
  width: 100%; border: 1px solid var(--line, rgba(0, 0, 0, .12)); border-radius: 9px;
  padding: 10px 12px; font: inherit; background: #fff; color: inherit;
}
.mt-input:focus, .mt-textarea:focus { outline: 2px solid rgba(41, 151, 255, .28); border-color: var(--blue, #2997ff); }
.mt-textarea { min-height: 84px; resize: vertical; }
.mt-radio-row { display: flex; gap: 16px; font-size: 13px; }
.mt-radio-row label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }

/* ---------- 支付 ---------- */

.mt-pay-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .mt-pay-layout { grid-template-columns: minmax(0, 1fr); } }
.mt-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 18px; }
.mt-qr { width: 208px; height: 208px; border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: 10px; padding: 8px; background: #fff; }
.mt-qr img, .mt-qr canvas { width: 100%; height: 100%; display: block; }
.mt-pay-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted, #5f6368); }
.mt-spinner { width: 14px; height: 14px; border: 2px solid rgba(0, 0, 0, .12); border-top-color: #111827; border-radius: 50%; animation: mt-spin .8s linear infinite; }
@keyframes mt-spin { to { transform: rotate(360deg); } }
.mt-pay-done { text-align: center; padding: 30px 18px; }
.mt-pay-done .mt-check { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; background: #dcf8ed; color: #08724f; display: flex; align-items: center; justify-content: center; font-size: 22px; }

/* ---------- 交付 / 证书 / 发票 ---------- */

.mt-deliver-card { border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: var(--mt-radius); padding: 14px; background: #fff; }
.mt-deliver-card + .mt-deliver-card { margin-top: 12px; }
.mt-deliver-head { display: flex; gap: 12px; align-items: center; }
.mt-deliver-thumb { width: 96px; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: #eceff3; flex: none; }
.mt-deliver-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-deliver-name { font-size: 14px; font-weight: 600; }
.mt-link-box { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.mt-link-text { flex: 1 1 260px; min-width: 0; font-size: 13px; background: #f7f8fa; border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: 8px; padding: 9px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mt-cert-card { border: 1px solid var(--line, rgba(0, 0, 0, .08)); border-radius: var(--mt-radius); padding: 14px; background: #fff; }
/* 权益卡底部的「授权证书」条：默认提示可申请，申请后变成下载入口 */
.mt-cert-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fafbfc; border: 1px dashed var(--line, rgba(0, 0, 0, .12)); }
.mt-cert-strip-label { font-size: 12px; font-weight: 600; color: #475467; letter-spacing: .02em; }
.mt-cert-strip .mt-small { flex: 1 1 240px; min-width: 0; }
.mt-cert-card + .mt-cert-card { margin-top: 12px; }
.mt-cert-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.mt-state { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; }
.mt-state-ok { background: #dcf8ed; color: #08724f; }
.mt-state-warn { background: #fff4e5; color: #8a5a00; }
.mt-state-info { background: #eef2f7; color: #334155; }
.mt-state-danger { background: #fef3f2; color: #b42318; }

.mt-verify-result { padding: 20px; border-radius: var(--mt-radius-lg); border: 1px solid var(--line, rgba(0, 0, 0, .08)); background: #fff; }
.mt-verify-ok { border-color: #b8ebc8; background: #f4fdf8; }
.mt-verify-fail { border-color: #f7b7b0; background: #fff8f7; }
.mt-kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; margin-top: 14px; }
.mt-kv dt { color: var(--muted, #5f6368); }
.mt-kv dd { margin: 0; font-weight: 500; word-break: break-all; }

/* ---------- 提示 ---------- */

.mt-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 16px);
  background: rgba(17, 24, 39, .94); color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: opacity .22s ease, transform .22s ease; z-index: 90; max-width: min(90vw, 460px);
}
.mt-toast.is-open { opacity: 1; transform: translate(-50%, 0); }

.mt-alert { padding: 10px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 12px; }
.mt-alert-error { background: #fef3f2; color: #b42318; border: 1px solid #f7b7b0; }
.mt-alert-info { background: #eef6ff; color: #1a4f8a; border: 1px solid #cfe4fb; }
.mt-alert-warn { background: #fff8ec; color: #8a5a00; border: 1px solid #ffe4b8; }

/* ---------- 购买须知 / 授权说明 ---------- */

.mt-notice-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.8; color: #374151; }
.mt-notice-list li { margin-bottom: 3px; }

/* ---------- 后台「素材管理」面板用到的样式 ----------
   后台页面不引用本文件，这些类名由 src/index.js 的 renderAdminHtml() 内联注入
   （见那里的 .mt-admin-* 样式块），这里保留一份是为了本地单独预览时也好看。
   改这里的同时请同步改 index.js 里的那份，否则后台样式不会变。 */

.mt-admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mt-admin-table th, .mt-admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e4e7ec; vertical-align: top; }
.mt-admin-table th { color: #667085; font-weight: 500; white-space: nowrap; background: #f9fafb; }
.mt-admin-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.mt-admin-chip.ok { background: #dcf8ed; color: #08724f; }
.mt-admin-chip.warn { background: #fff4e5; color: #8a5a00; }
.mt-admin-chip.danger { background: #fef3f2; color: #b42318; }
.mt-admin-chip.muted { background: #eef2f7; color: #334155; }
.mt-admin-alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.mt-admin-alert.ok { background: #f4fdf8; color: #08724f; border: 1px solid #b8ebc8; }
.mt-admin-alert.danger { background: #fef3f2; color: #b42318; border: 1px solid #f7b7b0; }

/* ---------- 移动端微调 ---------- */

@media (max-width: 720px) {
  .mt-topbar-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .mt-topnav { order: 3; width: 100%; overflow-x: auto; }
  .mt-main { padding: 16px 14px 48px; }
  .mt-cart-item { grid-template-columns: 96px minmax(0, 1fr); }
  .mt-cart-thumb { width: 96px; }
  .mt-cart-price { grid-column: 2; text-align: left; }
  .mt-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
