/* market-ui.css — 统一设计系统（深色优先 + 玻璃拟态 + Apple 风格）
   被 market.html / merchant.html / admin-market.html 共用
   不依赖任何外部 CDN，所有样式集中在此 */
:root {
  --bg: #0b0d12;
  --bg-elev: #14171f;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text: #f5f6f8;
  --text-muted: #9aa0a8;
  --text-light: #6b7280;
  --primary: #f27935;
  --primary-hover: #ff8a4a;
  --primary-soft: rgba(242,121,53,0.12);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.35);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "Helvetica Neue",
          "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fa;
    --bg-elev: #ffffff;
    --bg-card: rgba(0,0,0,0.02);
    --bg-card-hover: rgba(0,0,0,0.05);
    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.16);
    --text: #1a1d23;
    --text-muted: #5a6270;
    --text-light: #8a909a;
    --shadow: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.10);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ====== 顶部导航 ====== */
.m-topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.m-topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px;
}
.m-logo { font-size: 17px; font-weight: 700; color: var(--primary); letter-spacing: -0.01em; }
.m-logo span { color: var(--text); font-weight: 500; margin-left: 4px; font-size: 13px; }
.m-nav { display: flex; gap: 4px; flex: 1; margin-left: 24px; }
.m-nav a {
  padding: 6px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: all var(--transition);
}
.m-nav a:hover { background: var(--bg-card); color: var(--text); }
.m-nav a.active { background: var(--primary-soft); color: var(--primary); }
.m-topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ====== 按钮 ====== */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  transition: all var(--transition); white-space: nowrap;
}
.m-btn:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.m-btn-primary { background: var(--primary); color: #fff; border-color: transparent; }
.m-btn-primary:hover { background: var(--primary-hover); }
.m-btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.m-btn-danger:hover { background: #dc2626; }
.m-btn-ghost { background: transparent; border-color: transparent; }
.m-btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.m-btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--radius-lg); }
.m-btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ====== 容器 ====== */
.m-container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.m-container-narrow { max-width: 960px; margin: 0 auto; padding: 24px; }

/* ====== 卡片 ====== */
.m-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: all var(--transition);
}
.m-card-hover:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

/* ====== 商品卡片 ====== */
.m-product-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.m-product {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: all var(--transition); cursor: pointer;
}
.m-product:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.m-product-cover {
  width: 100%; aspect-ratio: 16/10; background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--text-light); overflow: hidden;
}
.m-product-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-product-body { padding: 14px 16px 16px; }
.m-product-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 40px; line-height: 1.4;
}
.m-product-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; min-height: 16px; }
.m-product-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.m-product-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-light); }
.m-product-price { display: flex; align-items: baseline; gap: 6px; margin-top: 12px; }
.m-product-price strong { font-size: 20px; font-weight: 700; color: var(--primary); }
.m-product-price del { font-size: 12px; color: var(--text-light); }
.m-product-shop {
  font-size: 12px; color: var(--text-muted); margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}

/* ====== 表单 ====== */
.m-form-row { margin-bottom: 16px; }
.m-form-row label {
  display: block; font-size: 13px; color: var(--text-muted);
  margin-bottom: 6px; font-weight: 500;
}
.m-input, .m-textarea, .m-select {
  width: 100%; padding: 10px 14px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 14px;
  transition: all var(--transition);
}
.m-input:focus, .m-textarea:focus, .m-select:focus {
  outline: none; border-color: var(--primary); background: var(--bg);
}
.m-textarea { resize: vertical; min-height: 80px; }
.m-help { font-size: 12px; color: var(--text-light); margin-top: 4px; }
/* 行内表单提示（错误红 / 成功绿），紧贴输入框 */
.m-err { font-size: 12.5px; color: #E64545; margin-top: 6px; line-height: 1.4; }
.m-ok  { font-size: 12.5px; color: #1AAD19; margin-top: 6px; line-height: 1.4; }
.m-input-err { border-color: #E64545 !important; }

/* ====== 表格 ====== */
.m-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.m-table th, .m-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.m-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.m-table tbody tr:hover { background: var(--bg-card); }

/* ====== 徽章 ====== */
.m-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
}
.m-badge-pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.m-badge-active  { background: rgba(34,197,94,0.15); color: var(--success); }
.m-badge-banned  { background: rgba(239,68,68,0.15); color: var(--danger); }
.m-badge-rejected{ background: rgba(239,68,68,0.15); color: var(--danger); }
.m-badge-info    { background: rgba(59,130,246,0.15); color: var(--info); }
.m-badge-muted   { background: var(--bg-card); color: var(--text-muted); }

/* ====== Toast ====== */
.m-toast-wrap { position: fixed; top: 80px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.m-toast {
  padding: 10px 16px; border-radius: var(--radius); font-size: 13px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow-lg); animation: mSlideIn 0.2s ease;
}
.m-toast-success { border-color: var(--success); }
.m-toast-error { border-color: var(--danger); }
@keyframes mSlideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====== 模态框 ====== */
.m-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 9000; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: mFade 0.15s;
}
.m-modal {
  background: var(--bg-elev); border-radius: var(--radius-xl);
  padding: 28px; min-width: 380px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.m-modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
@keyframes mFade { from { opacity: 0; } to { opacity: 1; } }

/* ====== 加载/空 ====== */
.m-loading { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.m-empty { text-align: center; padding: 80px 20px; color: var(--text-light); }
.m-empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ====== 工具 ====== */
.m-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.m-row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-col { display: flex; flex-direction: column; gap: 12px; }
.m-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.m-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.m-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.m-spacer { flex: 1; }
.m-section-title { font-size: 22px; font-weight: 700; margin: 24px 0 16px; letter-spacing: -0.01em; }
.m-section-sub { font-size: 13px; color: var(--text-muted); margin-top: -8px; margin-bottom: 16px; }
.m-stat-card { padding: 20px; }
.m-stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.m-stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--primary); }

/* ====== 响应式 ====== */
@media (max-width: 768px) {
  .m-topbar-inner { padding: 10px 14px; }
  .m-nav { display: none; }
  .m-container, .m-container-narrow { padding: 16px; }
  .m-product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .m-grid-2, .m-grid-3, .m-grid-4 { grid-template-columns: 1fr; }
  .m-modal { min-width: auto; width: 92vw; padding: 20px; }
}
@media (max-width: 480px) {
  .m-product-grid { grid-template-columns: 1fr; }
}

/* ====== 滚动条 ====== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ====== Tabs（商品详情/评价切换） ====== */
.m-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 24px 0 16px; }
.m-tab { padding: 10px 20px; cursor: pointer; color: var(--text-muted); font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition); }
.m-tab:hover { color: var(--text); }
.m-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.m-tab-pane { animation: fadeIn 0.18s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ====== 通知红点 ====== */
.m-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius); cursor: pointer; transition: all var(--transition); }
.m-bell:hover { background: var(--bg-card); }
.m-bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg-elev); }

/* ====== 收藏按钮（商品卡心形） ====== */
.m-fav-btn {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; transition: all var(--transition);
  backdrop-filter: blur(8px);
}
.m-fav-btn:hover { transform: scale(1.1); background: rgba(0,0,0,0.75); }
.m-fav-btn.active { background: var(--primary); color: #fff; }

/* ====== 横幅 ====== */
.m-banner {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 20px; aspect-ratio: 4/1; background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center;
  cursor: pointer;
}
.m-banner-content { padding: 24px 32px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.m-banner-content h3 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.m-banner-content p { font-size: 13px; opacity: 0.9; }

/* ====== 统计数字 ====== */
.m-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.m-stat-mini { padding: 14px 16px; }
.m-stat-mini .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.m-stat-mini .value { font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--text); }
.m-stat-mini .value.primary { color: var(--primary); }

/* ====== 简易柱状图（无第三方库） ====== */
.m-bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding: 8px 0; }
.m-bar { flex: 1; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 4px; position: relative; transition: all var(--transition); }
.m-bar:hover { background: var(--primary-hover); }
.m-bar-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.m-bar-val   { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text); font-weight: 600; }

/* ====== 商家回复样式 ====== */
.m-merchant-reply {
  margin-top: 10px; padding: 10px 14px;
  background: var(--primary-soft); border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}
.m-merchant-reply .from { font-size: 12px; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.m-merchant-reply .body { color: var(--text); font-size: 13px; }
.m-merchant-reply .when { color: var(--text-light); font-size: 11px; margin-top: 4px; }
