/* theme-fix-collection.css: nền chung collection v3 (Claude-A). Chỉ nạp trong template collection.
   Nguồn: design/collection/CRITIQUE.md đợt 1, 4, 5 + design/homepage/round2/codex/SPEC.md (Anker: Sạch và rõ).
   Hợp đồng: .col3 (bọc thân trang, khai báo --hp-* và --col3-*), container = main.wrapper.main-content,
   lưới .col3-grid*. Người khác chỉ dùng biến, không ghi đè. Dark chỉ ở ≤768px qua html[data-mobile-theme="dark"]. */

/* ---------- Biến dùng chung (giống .hv2 của trang chủ v3) ---------- */
.col3 {
  --col3-max: 1270px;
  --col3-gutter: 18px;
  --hp-ink: #0b1118;
  --hp-muted: #66727d;
  --hp-blue: #00a7e1;
  --hp-blue-deep: #007fae;
  --hp-surface: #f4f7f9;
  --hp-surface-strong: #eaf0f3;
  --hp-border: #dce4e8;
  --hp-bg: #fff;
  --hp-card: #fff;
  --hp-link: #007fae;
  --hp-sale: #c41f2e;
  --hp-sale-bg: #fff2f4;
  --hp-focus: #007fae;
  color: var(--hp-ink);
}
@media (max-width: 1100px) { .col3 { --col3-gutter: 12px; } }
@media (max-width: 768px) {
  html[data-mobile-theme="dark"] .col3 {
    --hp-ink: #f1f6f8; --hp-muted: #9baab4; --hp-surface: #121c25; --hp-surface-strong: #1a2731; --hp-border: #2c3a45;
    --hp-bg: #070d13; --hp-card: #121c25; --hp-link: #7dd3f5; --hp-focus: #7dd3f5; --hp-sale: #ff7a84; --hp-sale-bg: #291d25;
  }
}

/* ---------- Container: 1270px, lề trùng header (18px >1100, 12px ≤1100; 1440 → 85px) ---------- */
.template-collection .main-content.wrapper {
  box-sizing: border-box;
  max-width: calc(1270px + 2 * 18px);
  padding-left: 18px;
  padding-right: 18px;
}
@media (max-width: 1100px) {
  .template-collection .main-content.wrapper { max-width: calc(1270px + 2 * 12px); padding-left: 12px; padding-right: 12px; }
}

/* ---------- Lưới: 4 cột >900, 3 cột 591–900, 2 cột ≤590; gap 20 desktop, 12 tablet/mobile (dọc 16 mobile) ---------- */
.template-collection .grid-uniform.col3-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
}
.template-collection .grid-uniform.col3-grid::before,
.template-collection .grid-uniform.col3-grid::after { content: none; display: none; }
.template-collection .grid-uniform.col3-grid > .grid__item {
  display: flex;
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.template-collection .col3-grid > .grid__item > .product-container { width: 100%; min-width: 0; }
@media (max-width: 1100px) { .template-collection .grid-uniform.col3-grid { gap: 12px; } }
@media (max-width: 900px) { .template-collection .grid-uniform.col3-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 590px) { .template-collection .grid-uniform.col3-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; margin-bottom: 32px; } }

/* ---------- Khối mã giảm giá (app display-promotion, phương án A) ----------
   Giữ chỗ trước khi app chèn (~1,4 s sau load) để CLS ≈ 0. Chiều cao đo thật sau khi gọn:
   12 đệm + 24 tiêu đề + 136 phiếu (SVG đã có 8px bóng trên/dưới) + 4 đệm = 176px ở 320–1920. */
.template-collection .hrv-pmo-coupon {
  display: flow-root;
  min-height: 176px;
  margin: 4px 0 16px;
}
.template-collection .hrv-pmo-coupon.col3-pmo-none { min-height: 0; margin: 0; }
.template-collection .hrv-pmo-coupon .dlpm-coupons {
  margin: 0 !important;
  padding: 12px 12px 4px !important;
  background: var(--anker-surface, #f4f7f9) !important;
  border-radius: 16px;
}
.template-collection .hrv-pmo-coupon .dlpm-heading {
  margin: 0 !important;
  padding: 0 4px;
  color: var(--anker-ink, #0b1118) !important;
  font-family: inherit;
  font-size: 16px !important;
  line-height: 24px !important;
  font-weight: 600;
  text-align: left !important;
}
.template-collection .hrv-pmo-coupon .dlpm-btn-controls { margin-bottom: 0 !important; }
.template-collection .hrv-pmo-coupon .dlpm-btn-controls > li { width: 44px; height: 44px; cursor: pointer; }
/* Phiếu của app rộng cố định 336px: dưới 390px thu nhỏ để nút "Sao chép" không bị cắt (khung trong = 100vw − 48px). */
@media (max-width: 389px) {
  .template-collection .hrv-pmo-coupon { min-height: 165px; }               /* 12 + 24 + 136×0,92 + 4 */
  .template-collection .hrv-pmo-coupon .dlpm-coupon--row__items { zoom: 0.92; }
}
@media (max-width: 359px) {
  .template-collection .hrv-pmo-coupon { min-height: 149px; }               /* 12 + 24 + 136×0,8 + 4 */
  .template-collection .hrv-pmo-coupon .dlpm-coupon--row__items { zoom: 0.8; }
}
@media (max-width: 768px) {
  html[data-mobile-theme="dark"] .template-collection .hrv-pmo-coupon .dlpm-coupons { background: #121c25 !important; }
  html[data-mobile-theme="dark"] .template-collection .hrv-pmo-coupon .dlpm-heading { color: #f1f6f8 !important; }
}

/* Khoảng trống trước dải "Mua sắm theo danh mục" (footer): Tùng báo 16/10. Nội dung cuối → tiêu đề dải ≈ 80px desktop / 56px mobile. */
.template-collection .site-footer { margin-top: 0 !important; }
.template-collection main.main-content { padding-bottom: 0 !important; margin-bottom: 0 !important; }
body.template-collection .col3 nav.col3-pag.pagination, body.template-collection .col3 .col3-pag.pagination { margin-bottom: 40px !important; }
.template-collection .site-footer__top .space-padding-tb-40 { padding-top: 40px !important; }
@media (max-width: 768px) {
  body.template-collection .col3 nav.col3-pag.pagination, body.template-collection .col3 .col3-pag.pagination { margin-bottom: 28px !important; }
  .template-collection .site-footer__top .space-padding-tb-40 { padding-top: 28px !important; }
}
