/* ============================================================
 * MxxCRM 单站 CMS 公共主题样式（site.css）
 * 内容：
 *   A. 全站设计变量 + 页头/页脚/卡片公共样式（原内联在各模板中的
 *      .ent-* / .site-* 样式抽取于此，配合 page_head()/page_foot() 使用）
 *   B. 商品详情页京东/淘宝风布局样式（.pd-*，配合 type_id=8 模板）
 * 引入方式：<link rel="stylesheet" href="/static/default/css/site.css">
 * 依赖：bootstrap.min.css、cms.css（按钮/弹窗组件）
 * ============================================================ */

/* ========== A1. 设计变量 ========== */
:root {
  --ent-primary: #0f2b46;
  --ent-primary2: #1d4ed8;
  --ent-accent: #d97706;
  --ent-ink: #0f172a;
  --ent-muted: #64748b;
  --ent-soft: #f6f8fb;
  --ent-line: #e2e8f0;
  --jd-red: #e4393c;
  --jd-red-deep: #c81623;
  --tb-orange: #ff5000;
}

/* ========== A2. 基础 ========== */
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ent-ink);
}
a { text-decoration: none; }

/* ========== A3. 页头（企业版 .ent-navbar / 简洁版 .site-header 两种片段） ========== */
.ent-navbar {
  background: #fff;
  border-bottom: 1px solid var(--ent-line);
  padding: .65rem 0;
}
.ent-navbar .brand { font-weight: 800; font-size: 1.15rem; color: var(--ent-primary); }
.ent-navbar .nav-link { color: #334155; font-weight: 500; }
.ent-navbar .nav-link:hover { color: var(--ent-accent); }
.ent-navbar .nav-link.active { color: var(--ent-accent); background: #fff7ed; }

.site-header { background: #fff; }
.site-header .navbar-brand { color: var(--ent-primary); }

/* ========== A3b. 全站页头（首页同款导航 .site-nav，d85） ========== */
.site-nav {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.site-nav .navbar-brand.brand {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -.02em;
  color: #0f172a;
}
.site-nav .brand .dot { color: #2563eb; }
.site-nav .nav-link { color: #334155; font-weight: 500; padding: .45rem .75rem; border-radius: 6px; }
.site-nav .nav-link:hover { color: #2563eb; }
.site-nav .nav-link.active { color: #2563eb; background: #eff6ff; }
.site-nav .cms-cart-entry { color: #334155; }
.site-nav .form-control-sm { border-radius: 6px; }

/* ========== A4. 页脚（.ent-footer / .site-footer） ========== */
.ent-footer {
  border-top: 1px solid var(--ent-line);
  background: var(--ent-soft);
  color: var(--ent-muted);
  padding: 2.6rem 0;
  margin-top: 3rem;
}
.ent-footer a { color: var(--ent-muted); }
.ent-footer a:hover { color: var(--ent-accent); }
.site-footer {
  border-top: 1px solid var(--ent-line);
  background: var(--ent-soft);
  color: var(--ent-muted);
}
.site-footer a:hover { color: var(--ent-accent); }
.site-footer h6 { font-weight: 700; color: var(--ent-ink); }

/* ========== A5. 通用组件 ========== */
.ent-btn { display: inline-block; padding: .6rem 1.4rem; border-radius: 8px; font-weight: 600; }
.ent-btn-accent { background: var(--ent-accent); color: #fff; }
.ent-btn-accent:hover { filter: brightness(.94); color: #fff; }
.ent-btn-primary { background: var(--ent-primary2); color: #fff; }
.ent-btn-primary:hover { filter: brightness(.94); color: #fff; }
.ent-section { padding: 3.2rem 0; }
.ent-title { font-weight: 800; font-size: 1.6rem; margin-bottom: .4rem; }
.ent-sub { color: var(--ent-muted); margin-bottom: 2rem; }
.ent-card {
  border: 1px solid var(--ent-line);
  border-radius: 12px;
  background: #fff;
  height: 100%;
  transition: all .25s ease;
}
.ent-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px -16px rgba(15, 23, 42, .25); }

/* ============================================================
 * B. 商品详情页（京东/淘宝风，.pd-*）
 * ============================================================ */
.pd-page { background: #f4f6f8; padding-bottom: 2.5rem; }

/* 面包屑 */
.pd-crumb {
  padding: .9rem 0 .6rem;
  font-size: 13px;
  color: var(--ent-muted);
}
.pd-crumb a { color: var(--ent-muted); }
.pd-crumb a:hover { color: var(--tb-orange); }
.pd-crumb .sep { margin: 0 .5rem; color: #cbd5e1; }
.pd-crumb .cur { color: var(--ent-ink); }

/* 主区：左图右信息 */
.pd-main {
  display: flex;
  gap: 20px;
  background: #fff;
  border: 1px solid var(--ent-line);
  border-radius: 10px;
  padding: 20px;
}
@media (max-width: 991.98px) { .pd-main { flex-direction: column; } }
.pd-gallery { flex: 0 0 420px; max-width: 420px; }
@media (max-width: 991.98px) { .pd-gallery { flex: auto; max-width: 100%; } }
.pd-gallery-main {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--ent-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
}
.pd-gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pd-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  background: #fafafa;
}
.pd-thumb:hover { border-color: #fdba74; }
.pd-thumb.active { border-color: var(--tb-orange); }

.pd-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pd-title { font-size: 20px; font-weight: 700; line-height: 1.5; margin: 2px 0 8px; }
.pd-sub {
  color: var(--tb-orange);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* 价格区（京东红底价格带） */
.pd-price-panel {
  background: linear-gradient(90deg, #fff2ec, #fff8f5);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.pd-price { color: var(--jd-red); display: flex; align-items: baseline; gap: 2px; }
.pd-price .rmb { font-size: 16px; font-weight: 700; }
.pd-price .num { font-size: 30px; font-weight: 800; font-family: Arial, sans-serif; line-height: 1; }
.pd-price del { margin-left: 10px; color: #94a3b8; font-size: 13px; font-weight: 400; }
.pd-price-tags { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.pd-price-tags span { font-size: 12px; color: var(--jd-red); background: #fff; border: 1px solid #fbc9c4; border-radius: 3px; padding: 1px 6px; }

/* 库存/配送行 */
.pd-meta-line {
  display: flex;
  font-size: 13px;
  color: var(--ent-muted);
  margin-bottom: 6px;
}
.pd-meta-line .k { flex: 0 0 64px; color: #94a3b8; }
.pd-meta-line .in-stock { color: #16a34a; font-weight: 600; }
.pd-meta-line .out-stock { color: var(--jd-red); font-weight: 600; }

/* 参数表 */
.pd-params { font-size: 13px; color: var(--ent-muted); margin: 6px 0 14px; }
.pd-params td { padding: 3px 0; }
.pd-params th { color: #94a3b8; font-weight: 400; width: 72px; }

/* 购买区（cart_button 输出的按钮在此放大） */
.pd-cta { margin: 10px 0 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.pd-cta .cms-btn { font-size: 16px; padding: 12px 44px; border-radius: 6px; }
.pd-cta .cms-btn-lead {
  background: linear-gradient(90deg, var(--tb-orange), #ff7a2f);
  border: none;
  box-shadow: 0 6px 16px -6px rgba(255, 80, 0, .55);
}
.pd-cta .cms-btn-lead:hover { background: linear-gradient(90deg, #f04300, #ff6a1f); color: #fff; }

/* 服务承诺行 */
.pd-service {
  border-top: 1px dashed var(--ent-line);
  padding-top: 12px;
  font-size: 12px;
  color: var(--ent-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.pd-service b { color: var(--ent-ink); font-weight: 600; }

/* 区块卡片（规格/详情/推荐） */
.pd-section {
  background: #fff;
  border: 1px solid var(--ent-line);
  border-radius: 10px;
  margin-top: 16px;
  overflow: hidden;
}
.pd-section-hd {
  padding: 12px 20px;
  border-bottom: 1px solid var(--ent-line);
  font-size: 15px;
  font-weight: 700;
  background: #fff;
  position: relative;
}
.pd-section-hd::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--tb-orange);
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: -2px;
}
.pd-section-bd { padding: 18px 20px; }

/* 详情富文本 */
.pd-detail { line-height: 1.9; color: #334155; font-size: 14px; }
.pd-detail img { max-width: 100%; height: auto; border-radius: 6px; }
.pd-detail table { width: 100%; max-width: 720px; border-collapse: collapse; }
.pd-detail table td, .pd-detail table th { border: 1px solid var(--ent-line); padding: 8px 12px; font-size: 13px; }

/* 规格参数 */
.pd-spec-group { margin-bottom: 10px; font-size: 14px; }
.pd-spec-group b { display: inline-block; min-width: 110px; color: var(--ent-ink); }
.pd-spec-table { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 10px; }
.pd-spec-table th, .pd-spec-table td { border: 1px solid var(--ent-line); padding: 7px 12px; text-align: left; }
.pd-spec-table th { background: var(--ent-soft); font-weight: 600; }

/* 相关推荐 */
.pd-rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pd-rel-item {
  border: 1px solid var(--ent-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: all .2s ease;
  display: block;
}
.pd-rel-item:hover { transform: translateY(-3px); box-shadow: 0 12px 26px -14px rgba(15, 23, 42, .3); }
.pd-rel-item img { width: 100%; height: 150px; object-fit: cover; display: block; background: #fafafa; }
.pd-rel-item .t { display: block; padding: 8px 10px 2px; font-size: 13px; color: var(--ent-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-rel-item .p { display: block; padding: 0 10px 10px; font-size: 15px; font-weight: 700; color: var(--jd-red); }

/* ========== B2. SKU 规格点选（淘宝式） ========== */
.pd-sku-group { margin-bottom: 14px; }
.pd-sku-label { font-size: 13px; color: var(--ent-muted); margin-bottom: 8px; }
.pd-sku-label b { color: var(--ent-ink); font-weight: 600; }
.pd-sku-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.pd-spec-btn {
  padding: 8px 18px;
  border: 1px solid var(--ent-line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: var(--ent-ink);
  cursor: pointer;
  transition: all .15s ease;
}
.pd-spec-btn:hover { border-color: var(--tb-orange); color: var(--tb-orange); }
.pd-spec-btn.active {
  border-color: var(--tb-orange);
  color: var(--tb-orange);
  background: #fff7f2;
  font-weight: 600;
  position: relative;
}
.pd-spec-btn.disabled { opacity: .35; cursor: not-allowed; background: #f8fafc; }
.pd-spec-btn.disabled:hover { border-color: var(--ent-line); color: var(--ent-ink); }

/* 库存文案（选中规格后动态更新） */
.pd-stock-ok { color: #16a34a; font-weight: 600; }
.pd-stock-out { color: var(--jd-red); font-weight: 600; }
.pd-stock-hint { color: var(--ent-muted); }
.pd-arrival-btn { color: var(--tb-orange); text-decoration: underline; }

/* ========== B3. 商品评价区块 ========== */
.pd-review-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ent-line);
  margin-bottom: 6px;
}
.pd-review-avg { font-size: 30px; font-weight: 800; color: var(--jd-red); }
.pd-review-star { color: #f5a623; font-size: 15px; letter-spacing: 2px; }
.pd-review-count { color: var(--ent-muted); font-size: 13px; }
.pd-review-item { padding: 14px 0; border-bottom: 1px dashed var(--ent-line); }
.pd-review-item:last-child { border-bottom: none; }
.pd-review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pd-review-user { font-weight: 600; font-size: 13px; color: var(--ent-ink); }
.pd-review-stars { color: #f5a623; font-size: 13px; letter-spacing: 2px; }
.pd-review-time { color: #94a3b8; font-size: 12px; margin-left: auto; }
.pd-review-content { font-size: 14px; color: #334155; line-height: 1.8; }
.pd-review-reply {
  margin-top: 8px;
  background: var(--ent-soft);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ent-muted);
}
.pd-review-reply b { color: var(--tb-orange); }
