/*
 * 文件作用：
 * WooCommerce 分类页、产品详情页、购物车、结账页、搜索结果页的基础样式。
 * 将 iwamed-wc-products.css 和 iwamed-fixes.css 中依赖
 * body:has(.iwa-content-page) 的规则迁移为 body.pmgr-site-page，
 * 避免主题升级后 :has() 失效。
 *
 * 所有规则以 body.pmgr-site-page 为前缀，不污染非目标页面。
 */

/* ── WC / 搜索页面：在 body 层留出 fixed nav 的高度 ──
 * 参考 shop.css 的 body.pmgr-page-shop 做法，统一在 body 级别处理，
 * 避免被更高特异性的 single-product / cart / checkout 内层规则覆盖。
 */
body.pmgr-page-wc,
body.pmgr-page-search {
  padding-top: var(--pmgr-nav-height, 80px) !important;
}

/* ══════════════════════════════════════════════════════════════
   WC 产品列表（分类页 / Shop 列表 / 标签页）
   ══════════════════════════════════════════════════════════════ */

/* 产品网格容器：1280px 居中，4 列 */
body.pmgr-site-page ul.products {
  max-width: 1280px !important;
  margin: 40px auto !important;
  padding: 0 40px !important;
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 24px !important;
  list-style: none !important;
}

/* 产品卡片 */
body.pmgr-site-page ul.products > li.product {
  background: #ffffff !important;
  border: 1px solid #e5e6ea !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  transition: box-shadow 0.25s, transform 0.25s;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  float: none !important;
}

body.pmgr-site-page ul.products > li.product:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
  transform: translateY(-4px);
}

/* 图片区：固定高度居中 */
body.pmgr-site-page ul.products > li.product figure,
body.pmgr-site-page ul.products > li.product .ct-media-container {
  height: 220px !important;
  background: #f7f8fa !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  margin: 0 !important;
  overflow: hidden !important;
  border-radius: 0 !important;
  position: relative !important;
}

body.pmgr-site-page ul.products > li.product .wp-post-image,
body.pmgr-site-page ul.products > li.product img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  transition: transform 0.35s !important;
  aspect-ratio: auto !important;
}

body.pmgr-site-page ul.products > li.product:hover .wp-post-image {
  transform: scale(1.06) !important;
}

/* 产品没有主图时，WooCommerce 会输出默认占位图。
 * 这里把默认小图标隐藏，改成统一的品牌占位块，避免页面看起来像图片加载失败。
 */
body.pmgr-site-page ul.products > li.product figure:has(img.woocommerce-placeholder),
body.pmgr-site-page ul.products > li.product .ct-media-container:has(img.woocommerce-placeholder),
body.pmgr-site-page ul.products > li.product figure:has(img[src*="woocommerce-placeholder"]),
body.pmgr-site-page ul.products > li.product .ct-media-container:has(img[src*="woocommerce-placeholder"]) {
  background:
    linear-gradient(135deg, rgba(200, 16, 46, 0.06), rgba(34, 34, 38, 0.03)),
    #f7f8fa !important;
}

body.pmgr-site-page ul.products > li.product img.woocommerce-placeholder,
body.pmgr-site-page ul.products > li.product img[src*="woocommerce-placeholder"] {
  opacity: 0 !important;
  transform: none !important;
}

body.pmgr-site-page ul.products > li.product figure:has(img.woocommerce-placeholder)::before,
body.pmgr-site-page ul.products > li.product .ct-media-container:has(img.woocommerce-placeholder)::before,
body.pmgr-site-page ul.products > li.product figure:has(img[src*="woocommerce-placeholder"])::before,
body.pmgr-site-page ul.products > li.product .ct-media-container:has(img[src*="woocommerce-placeholder"])::before {
  content: "产品图待补";
  position: absolute;
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(150px, calc(100% - 40px));
  min-height: 86px;
  padding: 14px 18px;
  border: 1px dashed rgba(200, 16, 46, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #60636b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-sizing: border-box;
  z-index: 1;
}

/* 产品标题 */
body.pmgr-site-page ul.products > li.product .woocommerce-loop-product__title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #222226 !important;
  line-height: 1.4 !important;
  padding: 16px 18px 4px !important;
  margin: 0 !important;
}

/* 价格：品牌红 */
body.pmgr-site-page ul.products > li.product .price {
  color: var(--pmgr-red, #C8102E) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  padding: 4px 18px 12px !important;
  margin: 0 !important;
  display: block !important;
}

body.pmgr-site-page ul.products > li.product .price del {
  color: #999 !important;
  font-size: 13px !important;
  font-weight: 400 !important;
}

body.pmgr-site-page ul.products > li.product .price ins {
  text-decoration: none !important;
  color: var(--pmgr-red, #C8102E) !important;
}

/* SALE 角标
 * 强制成为产品图左上角的一个小 badge：
 *   - 宽度由文字决定，不被任何父级 width:100% 撑满
 *   - 位置 top-left，避免遮住产品图右上角的关键视觉
 *   - white-space:nowrap 防止文字换行变成竖条
 */
body.pmgr-site-page ul.products > li.product .onsale {
  position: absolute !important;
  top: 12px !important;
  left: 12px !important;
  right: auto !important;
  bottom: auto !important;
  display: inline-block !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 4px 10px !important;
  background: var(--pmgr-red, #C8102E) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  line-height: 1.4 !important;
  text-align: left !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  z-index: 2 !important;
}

/* Add to Cart 按钮（产品列表卡片）
 * 设计原则：
 *   - inline-flex：宽度由文字决定，不再撑满整个卡片
 *   - min-width:120px：保证短文案（如 “Read more”）也有合理可点击区域
 *   - align-self:center：在 li.product 这个 flex column 容器中水平居中
 *   - margin-top:auto：把按钮推到卡片底部，与价格之间留呼吸空间
 */
body.pmgr-site-page ul.products > li.product .button.add_to_cart_button,
body.pmgr-site-page ul.products > li.product a.button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center !important;
  width: auto !important;
  max-width: calc(100% - 36px) !important;
  min-width: 120px !important;
  margin: auto auto 18px auto !important;
  padding: 10px 18px !important;
  background: #222226 !important;
  color: #ffffff !important;
  text-align: center !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  border: 0 !important;
  white-space: nowrap !important;
  transition: background 0.2s !important;
}

body.pmgr-site-page ul.products > li.product .button.add_to_cart_button:hover,
body.pmgr-site-page ul.products > li.product a.button:hover {
  background: var(--pmgr-red, #C8102E) !important;
  color: #ffffff !important;
}

/* 分类页标题：居中 + 红色下划线 */
body.pmgr-site-page .woocommerce-products-header__title,
body.pmgr-site-page .woocommerce-products-header h1 {
  text-align: center;
  color: #1a1a1d !important;
  font-size: 28px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--pmgr-red, #C8102E);
  display: inline-block;
  margin: 40px auto 0;
}

/* 分页 */
body.pmgr-site-page .woocommerce-pagination ul {
  display: flex;
  justify-content: center;
  gap: 6px;
  list-style: none;
  margin: 40px 0;
  padding: 0;
}

body.pmgr-site-page .woocommerce-pagination ul li a,
body.pmgr-site-page .woocommerce-pagination ul li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #e5e6ea;
  color: #222226;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

body.pmgr-site-page .woocommerce-pagination ul li a:hover,
body.pmgr-site-page .woocommerce-pagination ul li span.current {
  background: var(--pmgr-red, #C8102E);
  color: #ffffff;
  border-color: var(--pmgr-red, #C8102E);
}

/* ══════════════════════════════════════════════════════════════
   单产品页（single-product）
   ══════════════════════════════════════════════════════════════ */

/* 浅灰背景，区分侧边页脚 */
body.pmgr-site-page.single-product {
  background: #f5f6f8 !important;
}

/* 内容区限宽 */
body.pmgr-site-page.single-product #main-container,
body.pmgr-site-page.single-product main.site-main,
body.pmgr-site-page.single-product .entry-content {
  max-width: 1280px !important;
  margin: 0 auto !important;
  padding: 20px 32px !important;
  width: auto !important;
  background: #ffffff !important;
}

body.pmgr-site-page.single-product .wp-site-blocks {
  max-width: none !important;
}

/* 面包屑 */
body.pmgr-site-page.single-product .ct-breadcrumbs,
body.pmgr-site-page.single-product .woocommerce-breadcrumb {
  color: #666 !important;
  font-size: 13px !important;
  margin-bottom: 24px !important;
}

body.pmgr-site-page.single-product .ct-breadcrumbs a,
body.pmgr-site-page.single-product .woocommerce-breadcrumb a {
  color: var(--pmgr-red, #C8102E) !important;
  font-weight: 500 !important;
}

/* 产品标题 */
body.pmgr-site-page.single-product .product_title,
body.pmgr-site-page.single-product h1.product_title {
  color: #1a1a1d !important;
  font-size: 32px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  margin-bottom: 16px !important;
}

/* 价格 */
body.pmgr-site-page.single-product .price,
body.pmgr-site-page.single-product p.price {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: var(--pmgr-red, #C8102E) !important;
  margin-bottom: 20px !important;
}

body.pmgr-site-page.single-product .price del {
  color: #999 !important;
  font-weight: 400 !important;
  font-size: 18px !important;
}

body.pmgr-site-page.single-product .price ins {
  text-decoration: none !important;
  color: var(--pmgr-red, #C8102E) !important;
}

/* Add to Cart 按钮 */
body.pmgr-site-page.single-product .single_add_to_cart_button,
body.pmgr-site-page.single-product button.single_add_to_cart_button {
  background: var(--pmgr-red, #C8102E) !important;
  background-color: var(--pmgr-red, #C8102E) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
  padding: 14px 32px !important;
  border-radius: 4px !important;
  transition: background 0.2s !important;
}

body.pmgr-site-page.single-product .single_add_to_cart_button:hover,
body.pmgr-site-page.single-product button.single_add_to_cart_button:hover {
  background: var(--pmgr-red-hover, #E13349) !important;
  background-color: var(--pmgr-red-hover, #E13349) !important;
}

/* SKU / 分类 meta */
body.pmgr-site-page.single-product .product_meta {
  font-size: 14px !important;
  color: #666 !important;
  margin-top: 20px !important;
  padding-top: 20px !important;
  border-top: 1px solid #eee !important;
}

body.pmgr-site-page.single-product .product_meta a {
  color: var(--pmgr-red, #C8102E) !important;
  font-weight: 500 !important;
}

/* Tabs */
body.pmgr-site-page.single-product .woocommerce-tabs ul.tabs > li.active > a {
  color: var(--pmgr-red, #C8102E) !important;
  border-bottom-color: var(--pmgr-red, #C8102E) !important;
}

/* 相关产品 */
body.pmgr-site-page.single-product .related.products h2 {
  color: #1a1a1d !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  padding-bottom: 12px !important;
  margin-bottom: 24px !important;
  border-bottom: 2px solid var(--pmgr-red, #C8102E) !important;
  display: inline-block !important;
}

/* ══════════════════════════════════════════════════════════════
   搜索结果 / Cart / Checkout — 限宽居中
   ══════════════════════════════════════════════════════════════ */

body.pmgr-site-page.search main.site-main,
body.pmgr-site-page.woocommerce-cart main.site-main,
body.pmgr-site-page.woocommerce-checkout main.site-main,
body.pmgr-site-page.search .entry-content,
body.pmgr-site-page.woocommerce-cart .entry-content,
body.pmgr-site-page.woocommerce-checkout .entry-content {
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 20px 32px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Cart 结账按钮：品牌红 */
body.pmgr-site-page.woocommerce-cart .wc-proceed-to-checkout a.checkout-button,
body.pmgr-site-page.woocommerce-cart a.checkout-button {
  background: var(--pmgr-red, #C8102E) !important;
  background-color: var(--pmgr-red, #C8102E) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 6px !important;
  transition: background 0.15s !important;
}

body.pmgr-site-page.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover {
  background: #a50d26 !important;
}

/* ══════════════════════════════════════════════════════════════
   响应式 — 平板/手机
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
  body.pmgr-site-page ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    padding: 0 24px !important;
  }

  body.pmgr-site-page ul.products > li.product figure,
  body.pmgr-site-page ul.products > li.product .ct-media-container {
    height: 180px !important;
  }

  /* 平板：内容区左右 padding 收齐到 20px，与 nav-footer.css 中
     .pmgr-nav / .pmgr-footer 在 ≤1023px 的 20px 边距一致，
     避免出现"黑色描述卡比页眉页脚窄"的视觉错位。 */
  body.pmgr-site-page.single-product #main-container,
  body.pmgr-site-page.single-product main.site-main,
  body.pmgr-site-page.single-product .entry-content,
  body.pmgr-site-page.search main.site-main,
  body.pmgr-site-page.woocommerce-cart main.site-main,
  body.pmgr-site-page.woocommerce-checkout main.site-main,
  body.pmgr-site-page.search .entry-content,
  body.pmgr-site-page.woocommerce-cart .entry-content,
  body.pmgr-site-page.woocommerce-checkout .entry-content {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}

@media (max-width: 639px) {
  body.pmgr-site-page ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 0 16px !important;
  }

  body.pmgr-site-page ul.products > li.product figure,
  body.pmgr-site-page ul.products > li.product .ct-media-container {
    height: 140px !important;
  }

  /* 手机：内容区左右 padding 收齐到 16px，与 .pmgr-nav 在 ≤639px
     的 16px 边距完全一致，让 pd-wrap 黑色卡片左右边界正好对齐
     IPETMED logo / 汉堡按钮所在的列。 */
  body.pmgr-site-page.single-product #main-container,
  body.pmgr-site-page.single-product main.site-main,
  body.pmgr-site-page.single-product .entry-content,
  body.pmgr-site-page.search main.site-main,
  body.pmgr-site-page.woocommerce-cart main.site-main,
  body.pmgr-site-page.woocommerce-checkout main.site-main,
  body.pmgr-site-page.search .entry-content,
  body.pmgr-site-page.woocommerce-cart .entry-content,
  body.pmgr-site-page.woocommerce-checkout .entry-content {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   商品 archive 页三栏布局
   左：产品分类树 | 中：商品网格（继续走 ul.products）| 右：促销产品侧栏

   作用域：body.pmgr-site-page + 由 woocommerce_before/after_shop_loop hook
   注入的 .pmgr-archive-three-col 容器。只在分类页/标签页/Shop 页生效，
   单产品页底部 Related Products 不会触发本布局（PHP 端 guard 已过滤）。

   触发结构（按 hook 优先级时间线）：
     .pmgr-archive-three-col
       └─ aside.pmgr-archive-left   ← 分类树 (sticky)
       └─ div.pmgr-archive-main     ← result_count + ordering + ul.products + pagination
       └─ aside.pmgr-archive-right  ← 促销产品 (sticky)

   响应式断点：
     ≥1280px → 三栏 240 / 1fr / 280
     1024-1279 → 两栏 220 / 1fr，右侧促销栏下移到底部占满宽度
     ≤1023px → 单列，左侧分类高度限 280px 内部滚动，右侧促销在最底部
     ≤639px → 同单列，间距更紧，中间网格 2 列
   ══════════════════════════════════════════════════════════════ */

/* ── 外层三栏容器 ─────────────────────────────────────────────── */
body.pmgr-site-page .pmgr-archive-three-col {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 28px;
  max-width: 1480px;
  margin: 24px auto 60px;
  padding: 0 24px;
  align-items: start;
  box-sizing: border-box;
}

/* 中列：min-width:0 防止内部 ul.products grid 把父级撑出页面 */
body.pmgr-site-page .pmgr-archive-main {
  min-width: 0;
}

/* 中列内 reset ul.products：取消居中限宽，按 .pmgr-archive-main 流动 */
body.pmgr-site-page .pmgr-archive-main ul.products {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

/* 中列内卡片图片高度收一点（容器变窄，太高会显得比例怪） */
body.pmgr-site-page .pmgr-archive-main ul.products > li.product figure,
body.pmgr-site-page .pmgr-archive-main ul.products > li.product .ct-media-container {
  height: 180px !important;
  padding: 12px !important;
}

/* 中列内 result_count / catalog_ordering / pagination 不要再用 max-width 居中 */
body.pmgr-site-page .pmgr-archive-main .woocommerce-result-count,
body.pmgr-site-page .pmgr-archive-main .woocommerce-ordering,
body.pmgr-site-page .pmgr-archive-main .woocommerce-pagination {
  max-width: none !important;
}

/* ── 左侧：产品分类树 ──────────────────────────────────────────── */
body.pmgr-site-page .pmgr-archive-left {
  background: #ffffff;
  border: 1px solid #e5e6ea;
  border-radius: 10px;
  padding: 16px 12px;
  position: sticky;
  top: calc(var(--pmgr-nav-height, 84px) + 16px);
  max-height: calc(100dvh - var(--pmgr-nav-height, 84px) - 32px);
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
}

/* 整体 details 包装：桌面端去掉 summary 默认箭头 + cursor */
body.pmgr-site-page .pmgr-cat-tree-collapsible {
  margin: 0;
}

body.pmgr-site-page .pmgr-cat-tree-collapsible > summary.pmgr-cat-tree-title {
  list-style: none;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.pmgr-site-page .pmgr-cat-tree-collapsible > summary::-webkit-details-marker {
  display: none;
}

/* 标题样式：14px 加粗 + 红色下划线 */
body.pmgr-site-page .pmgr-cat-tree-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1d;
  margin: 0 0 12px;
  padding: 0 4px 10px;
  border-bottom: 2px solid var(--pmgr-red, #C8102E);
  letter-spacing: 0.5px;
}

body.pmgr-site-page .pmgr-cat-tree {
  margin: 0;
}

body.pmgr-site-page .pmgr-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 子分类列表：左侧缩进 + 细线指示层级 */
body.pmgr-site-page .pmgr-cat-list--child {
  margin: 2px 0 4px 10px;
  padding-left: 8px;
  border-left: 1px solid #eef0f3;
}

body.pmgr-site-page .pmgr-cat-item {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 分类链接行：name 左对齐，count 数字徽章右对齐 */
body.pmgr-site-page .pmgr-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: #3a3a3f;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  min-width: 0;
}

body.pmgr-site-page .pmgr-cat-link:hover {
  background: rgba(200, 16, 46, 0.06);
  color: var(--pmgr-red, #C8102E);
}

body.pmgr-site-page .pmgr-cat-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

body.pmgr-site-page .pmgr-cat-count {
  flex: 0 0 auto;
  color: #9a9a9f;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  padding: 1px 7px;
  border-radius: 9px;
  line-height: 1.6;
}

/* 当前分类高亮：红底白字 */
body.pmgr-site-page .pmgr-cat-item.is-current > .pmgr-cat-link,
body.pmgr-site-page .pmgr-cat-item.is-current > .pmgr-cat-details > .pmgr-cat-summary > .pmgr-cat-link {
  background: var(--pmgr-red, #C8102E) !important;
  color: #ffffff !important;
  font-weight: 600;
}

body.pmgr-site-page .pmgr-cat-item.is-current > .pmgr-cat-link .pmgr-cat-count,
body.pmgr-site-page .pmgr-cat-item.is-current > .pmgr-cat-details > .pmgr-cat-summary > .pmgr-cat-link .pmgr-cat-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* 祖先分类（弱高亮）：红字加粗，不变背景 */
body.pmgr-site-page .pmgr-cat-item.is-ancestor:not(.is-current) > .pmgr-cat-details > .pmgr-cat-summary > .pmgr-cat-link {
  color: var(--pmgr-red, #C8102E);
  font-weight: 600;
}

/* ── 折叠 <details> / <summary> 美化 ─────────────────────────── */
body.pmgr-site-page .pmgr-cat-details {
  margin: 0;
}

body.pmgr-site-page .pmgr-cat-summary {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  position: relative;
  gap: 2px;
}

body.pmgr-site-page .pmgr-cat-summary::-webkit-details-marker {
  display: none;
}

body.pmgr-site-page .pmgr-cat-summary::marker {
  content: '';
  display: none;
}

body.pmgr-site-page .pmgr-cat-summary > .pmgr-cat-link {
  flex: 1 1 auto;
  min-width: 0;
}

/* 折叠三角图标 */
body.pmgr-site-page .pmgr-cat-toggle {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  color: #b0b3b8;
  font-size: 10px;
  line-height: 1;
  transition: transform 0.2s, color 0.2s;
}

body.pmgr-site-page .pmgr-cat-details[open] > .pmgr-cat-summary .pmgr-cat-toggle {
  transform: rotate(90deg);
  color: var(--pmgr-red, #C8102E);
}

/* ── 右侧：促销产品侧栏 ────────────────────────────────────────── */
body.pmgr-site-page .pmgr-archive-right {
  background: #ffffff;
  border: 1px solid #e5e6ea;
  border-radius: 10px;
  padding: 16px 14px;
  position: sticky;
  top: calc(var(--pmgr-nav-height, 84px) + 16px);
  max-height: calc(100dvh - var(--pmgr-nav-height, 84px) - 32px);
  overflow-y: auto;
}

body.pmgr-site-page .pmgr-sale-sidebar {
  /* 无额外样式，sticky 在父 aside 上 */
}

body.pmgr-site-page .pmgr-sale-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1d;
  margin: 0 0 14px;
  padding: 0 4px 10px;
  border-bottom: 2px solid var(--pmgr-red, #C8102E);
  letter-spacing: 0.5px;
}

body.pmgr-site-page .pmgr-sale-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.pmgr-site-page .pmgr-sale-item {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 单行促销卡：缩略图 + 名 + 价 */
body.pmgr-site-page .pmgr-sale-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

body.pmgr-site-page .pmgr-sale-link:hover {
  background: rgba(200, 16, 46, 0.04);
  border-color: rgba(200, 16, 46, 0.25);
}

body.pmgr-site-page .pmgr-sale-img {
  flex: 0 0 56px;
  width: 56px !important;
  height: 56px !important;
  object-fit: contain;
  border-radius: 6px;
  background: #f7f8fa;
  padding: 4px;
  box-sizing: border-box;
}

body.pmgr-site-page .pmgr-sale-body {
  flex: 1 1 auto;
  min-width: 0;
}

body.pmgr-site-page .pmgr-sale-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #222226;
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.pmgr-site-page .pmgr-sale-price {
  font-size: 13px;
  color: var(--pmgr-red, #C8102E);
  font-weight: 700;
  line-height: 1.4;
}

body.pmgr-site-page .pmgr-sale-price del {
  color: #999;
  font-weight: 400;
  font-size: 11px;
  margin-right: 4px;
}

body.pmgr-site-page .pmgr-sale-price ins {
  text-decoration: none;
  color: var(--pmgr-red, #C8102E);
}

body.pmgr-site-page .pmgr-sale-empty {
  color: #9a9a9f;
  font-size: 13px;
  text-align: center;
  margin: 16px 0;
  padding: 20px 12px;
  border: 1px dashed #e5e6ea;
  border-radius: 8px;
}

/* ══════════════════════════════════════════════════════════════
   响应式 — 1024px-1279px：右侧促销下移占满宽度
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1279px) {
  body.pmgr-site-page .pmgr-archive-three-col {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
  }

  body.pmgr-site-page .pmgr-archive-right {
    grid-column: 1 / -1;        /* 占满整行 */
    position: static;
    max-height: none;
  }

  body.pmgr-site-page .pmgr-archive-main ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   响应式 — ≤1023px：单列堆叠，左侧分类高度限定避免占太多视野
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
  body.pmgr-site-page .pmgr-archive-three-col {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 20px;
    margin: 16px auto 40px;
  }

  body.pmgr-site-page .pmgr-archive-left {
    grid-column: 1;
    position: static;
    max-height: 280px;          /* 高度限定，内部独立滚动 */
    padding: 12px 10px;
  }

  body.pmgr-site-page .pmgr-archive-main ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.pmgr-site-page .pmgr-archive-right {
    grid-column: 1;
    padding: 14px 12px;
  }
}

/* ══════════════════════════════════════════════════════════════
   响应式 — ≤639px：手机端，间距更紧，网格 2 列
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 639px) {
  body.pmgr-site-page .pmgr-archive-three-col {
    gap: 12px;
    padding: 0 16px;
    margin: 12px auto 32px;
  }

  body.pmgr-site-page .pmgr-archive-left {
    max-height: 240px;
  }

  body.pmgr-site-page .pmgr-archive-main ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  body.pmgr-site-page .pmgr-archive-main ul.products > li.product figure,
  body.pmgr-site-page .pmgr-archive-main ul.products > li.product .ct-media-container {
    height: 140px !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   会员价标签（PMGR Member Pricing）

   由 pmgr-member-pricing.php 的 pmgr_mp_filter_price_html() 注入：
     <span class="pmgr-price-tag pmgr-price-tag--dealer">经销商专属价</span>
     <span class="pmgr-price-tag pmgr-price-tag--vet_doctor">宠物医生专属价</span>
     <a class="pmgr-login-price-note">登录查看会员价 →</a>

   颜色策略：
     - dealer     用品牌红 #C8102E（B 端经销商，与站点主色统一）
     - vet_doctor 用墨绿 #1f7a5f（C 端宠物医生，区别于经销商，传递专业感）
     - 登录提示  灰色弱化，hover 变红

   作用域：不加 body 前缀 —— 三站任何加载本 wc.css 的页面都生效，
   包括 lumavet（即便 lumavet 暂未启用会员体系，CSS 静态文件无副作用）。
   ══════════════════════════════════════════════════════════════ */

.pmgr-price-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.4px;
  border-radius: 4px;
  text-transform: none;
  vertical-align: middle;
  white-space: nowrap;
}

.pmgr-price-tag--dealer {
  background: var(--pmgr-red, #C8102E);
  color: #ffffff;
}

.pmgr-price-tag--vet_doctor {
  background: #1f7a5f;
  color: #ffffff;
}

/* 未登录提示：灰色小字链接，hover 变红 */
.pmgr-login-price-note {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 4px;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.pmgr-login-price-note:hover {
  color: #ffffff;
  background: var(--pmgr-red, #C8102E);
}

/* 移动端：换行避免和价格挤在一行 */
@media (max-width: 639px) {
  .pmgr-price-tag,
  .pmgr-login-price-note {
    display: inline-block;
    margin-left: 0;
    margin-top: 4px;
  }
}
