/* Shop v2 — bố cục kiểu pgfasia, màu lấy từ bảng màu (--tl-*, xuất ở wp_head). */

.tlv2 {
  --tlv2-radius: 10px;
  --tlv2-border: #e6e6e3;
  --tlv2-muted: #6b6b6b;
  background: var(--tl-surface, #f6f6f4);
  padding-bottom: 56px;
}

/* ---------- Hàng tab ---------- */
.tlv2-tabs {
  background: #fff;
  border-bottom: 1px solid var(--tlv2-border);
  padding: 16px 0;
}
.tlv2-tabs__list {
  position: relative;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tlv2-tabs__list > li { flex: 1 1 0; min-width: 0; }
.tlv2-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--tl-primary, #dc4d28);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .2s ease, transform .2s ease;
}
.tlv2-tab:hover,
.tlv2-tab:focus-visible { background: var(--tl-primary-dark, #b83d1f); color: #fff; text-decoration: none; }
.tlv2-tab.is-active { background: var(--tl-heading, #1f2937); color: #fff; }
.tlv2-tab:focus-visible { outline: 3px solid var(--tl-accent, #bcc647); outline-offset: 2px; }

/* ---------- Thân trang ---------- */
.tlv2-body { padding-top: 16px; }

.tlv2-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--tlv2-muted);
}
.tlv2-crumbs a { color: var(--tlv2-muted); text-decoration: none; }
.tlv2-crumbs a:hover { color: var(--tl-primary, #dc4d28); }
.tlv2-crumbs [aria-current] { color: var(--tl-heading, #1f2937); }

.tlv2-banner { display: block; margin-bottom: 20px; border-radius: var(--tlv2-radius); overflow: hidden; background: #eee; }
.tlv2-banner__img { display: block; width: 100%; height: auto; }

/* Banner /cua-hang/ (Giao diện Tru-Life → Banner cửa hàng): nhiều ảnh → vuốt ngang + tự chạy (shop-v2.js) */
.tlv2-hero { position: relative; margin-bottom: 20px; border-radius: var(--tlv2-radius); overflow: hidden; background: #eee; }
.tlv2-hero__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; }
.tlv2-hero__track::-webkit-scrollbar { display: none; }
.tlv2-hero__slide { display: block; flex: 0 0 100%; scroll-snap-align: start; }
.tlv2-hero__slide picture { display: block; }
.tlv2-hero__img { display: block; width: 100%; height: auto; aspect-ratio: var(--hero-ratio, auto); object-fit: cover; }
.tlv2-hero__nav {
  position: absolute; top: 50%; z-index: 2; display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-top: -21px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #1f2937; box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  cursor: pointer; opacity: 0; transition: opacity .2s ease, background-color .2s ease;
}
.tlv2-hero__nav--prev { left: 16px; }
.tlv2-hero__nav--next { right: 16px; }
.tlv2-hero:hover .tlv2-hero__nav, .tlv2-hero__nav:focus-visible { opacity: 1; }
.tlv2-hero__nav:hover { background: #fff; color: var(--tl-primary, #dc4d28); }
.tlv2-hero__dots { position: absolute; left: 50%; bottom: 14px; z-index: 2; display: flex; gap: 6px; transform: translateX(-50%); }
.tlv2-hero__dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .6); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: pointer; transition: width .25s ease, background-color .25s ease; }
.tlv2-hero__dot[aria-current="true"] { width: 22px; background: #fff; }
@media (max-width: 767px) {
  .tlv2-hero__img { aspect-ratio: var(--hero-ratio-m, auto); }
  .tlv2-hero__nav { display: none; }
  .tlv2-hero__dots { bottom: 10px; }
}
@media (hover: none) { .tlv2-hero__nav { display: none; } }

/* ---------- Thanh tiêu đề + bộ lọc ---------- */
.tlv2-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: #fff;
  border-radius: var(--tlv2-radius);
}
.tlv2-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--tl-primary-dark, #b83d1f);
}
.tlv2-controls { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 520px; justify-content: flex-end; }

.tlv2-search {
  position: relative;
  display: flex;
  flex: 1 1 240px;
  max-width: 340px;
  margin: 0;
}
.tlv2-search input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 14px;
  border: 1px solid var(--tlv2-border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}
.tlv2-search button {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--tlv2-muted);
  cursor: pointer;
}
.tlv2-search input:focus,
.tlv2-select select:focus { outline: none; border-color: var(--tl-primary, #dc4d28); box-shadow: 0 0 0 3px rgba(220, 77, 40, .15); }

.tlv2-select { position: relative; margin: 0; flex: 0 1 180px; }
.tlv2-select select {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--tlv2-border);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236b6b6b' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
  font-size: 15px;
  color: var(--tl-heading, #1f2937);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.tlv2-apply {
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--tl-primary, #dc4d28);
  color: #fff;
  font-weight: 700;
}

/* ---------- Danh mục con ---------- */
.tlv2-subcats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.tlv2-pill {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--tl-primary, #dc4d28);
  border-radius: 999px;
  background: #fff;
  color: var(--tl-primary, #dc4d28);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.tlv2-pill:hover,
.tlv2-pill.is-active { background: var(--tl-primary, #dc4d28); color: #fff; text-decoration: none; }

.tlv2-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 14px; color: var(--tlv2-muted); }
.tlv2-clear { color: var(--tl-primary, #dc4d28); font-weight: 600; text-decoration: none; }

/* ---------- Lưới sản phẩm (ô sản phẩm giữ nguyên từ shop.css) ---------- */
.tlv2-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 768px)  { .tlv2-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 992px)  { .tlv2-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .tlv2-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.tlv2-empty { padding: 56px 16px; text-align: center; background: #fff; border-radius: var(--tlv2-radius); color: var(--tlv2-muted); }
.tlv2-empty p { margin-bottom: 16px; font-size: 16px; }

/* ---------- Trang tổng /cua-hang/: các mục (kiểu trang chủ pgfasia) ---------- */
.tlv2-section { margin-top: 44px; }
.tlv2-toolbar + .tlv2-section { margin-top: 28px; }
.tlv2-section__title { display: flex; justify-content: center; margin: 0 0 20px; }
.tlv2-section__title a {
  display: block;
  width: min(100%, 880px);
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--tl-primary-dark, #b83d1f);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .2s ease;
}
.tlv2-section__title a:hover,
.tlv2-section__title a:focus-visible { background: var(--tl-primary, #dc4d28); color: #fff; text-decoration: none; }
.tlv2-section__more { display: flex; justify-content: center; margin-top: 20px; }
.tlv2-more {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 48px;
  padding: 10px 40px;
  border: 1px solid var(--tl-primary, #dc4d28);
  border-radius: 8px;
  background: #fff;
  color: var(--tl-primary, #dc4d28);
  font-size: 16px;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.tlv2-more:hover,
.tlv2-more:focus-visible { background: var(--tl-primary, #dc4d28); color: #fff; text-decoration: none; }

/* Tablet/mobile: mỗi mục là lưới đều (không vuốt ngang, không lòi ô thứ 3) — chỉ hiện số ô vừa đủ hàng. */
@media (max-width: 1199px) {
  .tlv2-grid--row > :nth-child(n+5) { display: none; }
}
@media (min-width: 768px) and (max-width: 991px) {
  .tlv2-grid--row > :nth-child(n+4) { display: none; }
}
@media (max-width: 767px) {
  .tlv2-section { margin-top: 32px; }
  .tlv2-section__title { margin-bottom: 14px; }
  .tlv2-section__title a { padding: 11px 16px; font-size: 18px; }
  .tlv2-section__more { margin-top: 14px; }
  .tlv2-more { width: 100%; justify-content: center; padding: 10px 16px; font-size: 15px; }
}

/* ---------- Phân trang ---------- */
.tlv2-pagination { display: flex; justify-content: center; margin-top: 32px; }
/* paginate_links(type=list) gắn class page-numbers cho cả <ul> → chỉ định dạng ô bên trong <li>. */
.tlv2-pagination ul.page-numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; margin: 0; padding: 0; border: 0; background: none; list-style: none; }
.tlv2-pagination li { margin: 0; }
.tlv2-pagination li > .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--tlv2-border);
  border-radius: 8px;
  background: #fff;
  color: var(--tl-heading, #1f2937);
  font-weight: 600;
  text-decoration: none;
}
.tlv2-pagination a.page-numbers:hover { border-color: var(--tl-primary, #dc4d28); color: var(--tl-primary, #dc4d28); }
.tlv2-pagination li > .page-numbers.current { background: var(--tl-primary, #dc4d28); border-color: var(--tl-primary, #dc4d28); color: #fff; }

/* ---------- Mobile ---------- */
@media (max-width: 991px) {
  .tlv2-tabs { padding: 12px 0; }
  .tlv2-tabs__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
  .tlv2-tabs__list > li { min-width: 0; }
  .tlv2-tab { min-height: 44px; padding: 8px 10px; font-size: 14px; letter-spacing: .04em; }
  .tlv2-controls { justify-content: stretch; flex-basis: 100%; }
  .tlv2-search { max-width: none; flex-basis: 100%; }
  .tlv2-select { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 575px) {
  .tlv2-tabs__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tlv2-tabs__list > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tlv2-tab { min-height: 42px; font-size: 13px; }
  .tlv2-toolbar { padding: 14px; }
  .tlv2-title { font-size: 21px; }
  .tlv2-select { flex: 1 1 calc(50% - 5px); }
  .tlv2-select--sort { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .tlv2-tab, .tlv2-pill { transition: none; }
}

/* ---------- Ô sản phẩm trên mobile (chỉ trong cửa hàng/danh mục mới) ----------
 * Desktop giữ nguyên. Mobile: lề trong gọn, chữ vừa ô, nút 1 dòng, các ô cùng chiều cao, nút luôn ở đáy. */
.tlv2 { overflow-x: clip; }
.tlv2-grid > * { min-width: 0; }
@media (max-width: 767px) {
  .tlv2-grid { gap: 12px; }
  .tlv2 .product-card { border-radius: 10px; }
  .tlv2 .product-card__brand { top: 8px; right: 8px; max-width: 38px; max-height: 38px; padding: 4px; border-radius: 6px; }
  .tlv2 .product-card__badge { top: 8px; left: 8px; }
  .tlv2 .badge-percent { padding: 4px 8px; font-size: 12px; }
  .tlv2 .product-card__content { padding: 10px 10px 12px; gap: 8px; }
  .tlv2 .product-card__title { font-size: 14px; font-weight: 600; line-height: 1.35; min-height: calc(1.35em * 2); }
  .tlv2 .product-card__pricing { min-height: 18px; flex-wrap: wrap; row-gap: 2px; }
  .tlv2 .price-sale, .tlv2 .price-current { font-size: 14px; }
  .tlv2 .price-variable { font-size: 13px; line-height: 1.3; white-space: normal; }
  .tlv2 .product-card__packaging,
  .tlv2 .product-card__origin { gap: 5px; min-height: 30px; padding: 5px 8px; border-radius: 6px; font-size: 12px; line-height: 1.3; }
  .tlv2 .product-card__packaging span,
  .tlv2 .product-card__origin span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tlv2 .product-card__packaging svg,
  .tlv2 .product-card__origin svg { width: 13px; height: 13px; }
  .tlv2 .product-card__add-to-cart,
  .tlv2 .product-card__select-options { gap: 6px; min-height: 40px; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.2; white-space: nowrap; box-shadow: none; }
  .tlv2 .product-card__add-to-cart .button-text { display: inline; padding: 0; }
  .tlv2 .product-card__add-to-cart svg,
  .tlv2 .product-card__select-options svg { width: 16px; height: 16px; }
}
@media (max-width: 374px) {
  /* Màn rất hẹp: nút chỉ còn icon để không xuống dòng. */
  .tlv2 .product-card__add-to-cart .button-text,
  .tlv2 .product-card__select-options .button-text { display: none; }
}
@media (hover: none) {
  .tlv2 .product-card:hover, .tlv2 .product-card__add-to-cart:hover, .tlv2 .product-card__select-options:hover { transform: none; }
  .tlv2 .product-card:hover .product-card__image img { transform: none; }
}

/* ---------- Hàng tab dính trên cùng khi cuộn (bản sao do shop-v2.js tạo) ---------- */
.tru-header.tlv2-hdr { transition: top .25s ease, box-shadow .15s ease, background-color .15s ease; }
.tlv2-tabs.tlv2-tabs--bar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 1015; /* dưới header (1020) để dropdown của header vẫn nổi lên trên */
  padding: 8px 0;
  border-bottom: 1px solid #e6e6e3;
  box-shadow: 0 6px 16px rgba(17, 24, 39, .08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transition: top .25s ease, opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.tlv2-tabs.tlv2-tabs--bar.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition: top .25s ease, opacity .2s ease, transform .2s ease, visibility 0s;
}
.tlv2-tabs--bar .tlv2-tabs__list { gap: 8px; }
.tlv2-tabs--bar .tlv2-tab { min-height: 40px; padding: 6px 12px; font-size: 14px; }

@media (max-width: 991px) {
  /* Bản dính: 1 hàng cuộn ngang thay cho lưới 2 cột, chỉ cao ~50px */
  .tlv2-tabs--bar .tlv2-tabs__list {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tlv2-tabs--bar .tlv2-tabs__list::-webkit-scrollbar { display: none; }
  .tlv2-tabs--bar .tlv2-tabs__list > li { flex: 1 0 auto; }
  .tlv2-tabs--bar .tlv2-tabs__list > li:last-child:nth-child(odd) { grid-column: auto; }
  .tlv2-tabs--bar .tlv2-tab { min-height: 36px; padding: 6px 14px; font-size: 13px; letter-spacing: .03em; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .tru-header.tlv2-hdr, .tlv2-tabs.tlv2-tabs--bar, .tlv2-tabs.tlv2-tabs--bar.is-shown { transition: none; }
}
