/**
 * Shoptrangsuc Core - product taxonomy/shop archive styles.
 * Loaded only on product archives and supported taxonomies.
 */

/* =========================================================
   5. TAXONOMY / ARCHIVE PRESENTATION
========================================================= */

/* ==============================
   Taxonomy archive — top block
===============================*/
body.woocommerce.archive .term-description .header_sec.section {
  padding: 0 !important;
}

/* =========================================================
   Shoptrangsuc - Category hero block
   Purpose: SEO-friendly category intro with text-first DOM
========================================================= */

.st-category-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "media content";
  align-items: stretch;
  margin: 0 0 34px;
  background: var(--st-bg-soft, #F8F8F8);
}


/* Media
========================================================= */

.st-category-hero__media {
  grid-area: media;
  min-width: 0;
  overflow: hidden;
}

.st-category-hero__media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}


/* Content
========================================================= */

.st-category-hero__content {
  grid-area: content;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-width: 620px;
  margin: 0 auto;
  padding: 34px 42px;
  color: var(--st-text, #2A2622);
}

.st-category-hero__content p {
  margin: 0 0 18px;
  color: var(--st-text, #2A2622);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.75;
  text-align: justify;
  text-align-last: left;
}

.st-category-hero__content p:last-child {
  margin-bottom: 0;
}

.st-category-hero__lead strong {
  color: var(--st-text-strong, #111111);
  font-weight: 600;
}


/* Category hero content links
========================================================= */

body.woocommerce.archive .st-category-hero__content a:not(.button) {
  color: inherit;
  text-decoration: none !important;
  border-bottom: 0.75px solid var(
    --st-secondary-border,
    rgba(128, 103, 68, .42)
  );
}

body.woocommerce.archive .st-category-hero__content a:not(.button):hover,
body.woocommerce.archive .st-category-hero__content a:not(.button):focus-visible {
  color: var(--st-secondary, #806744);
  border-bottom-color: var(--st-secondary, #806744);
}


/* Trust note
========================================================= */

.st-category-hero__trust {
  padding: 13px 16px;
  border-left: 2px solid var(--st-gold-soft, #B79B63);
  border-radius: var(--st-radius-small, 8px);
  background: rgba(255, 255, 255, .58);
  color: var(--st-text, #2A2622);
  font-size: 14px;
  line-height: 1.65;
  text-align: justify;
  text-align-last: left;
}

/* Tablet
========================================================= */

@media only screen and (max-width: 849px) {
  .st-category-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "content"
      "media";
    margin-bottom: 30px;
  }

  .st-category-hero__content {
    max-width: none;
    padding: 24px 22px 26px;
  }

  .st-category-hero__content p {
    font-size: 14.5px;
    line-height: 1.7;
  }

  .st-category-hero__media img {
    height: auto;
    min-height: 0;
    object-fit: contain;
  }
}


/* Mobile
========================================================= */

@media only screen and (max-width: 549px) {
  .st-category-hero {
    margin-bottom: 26px;
  }

  .st-category-hero__content {
    padding: 20px 16px 22px;
  }

  .st-category-hero__content p {
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.68;
  }

  .st-category-hero__trust {
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.62;
  }
}

/* ==============================
   Shop & taxonomy archive
===============================*/
body.woocommerce.archive .products {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

body.woocommerce.archive .products .product-category {
  order: 1;
}

body.woocommerce.archive .products:has(.product-category)::after {
  content: "";
  display: block;
  flex: 0 0 100%;
  max-width: 100%;
  height: 0;
  order: 2;
}

body.woocommerce.archive .products .product:not(.product-category) {
  order: 3;
}

/* ==============================
   Shop & taxonomy archive — ordering
===============================*/

/*
 * Native WooCommerce ordering remains the only archive control.
 * The Flatsome product-filter trigger is removed in PHP, not hidden by CSS.
 */
body.woocommerce.archive .st-archive-ordering {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  margin: 0;
  padding: 0 0 20px;
}

body.woocommerce.archive .st-archive-ordering .woocommerce-ordering {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  clear: both;
  float: none !important;
  width: auto;
  margin: 0;
  padding: 0;
}

body.woocommerce.archive .st-archive-ordering .woocommerce-ordering::before {
  content: "Sắp xếp theo:";
  flex: 0 0 auto;
  color: var(--st-text-soft, #5E5A54);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

body.woocommerce.archive .st-archive-ordering .woocommerce-ordering select.orderby {
  flex: 0 0 auto;
  width: auto;
  min-width: 180px;
  max-width: 100%;
  margin: 0;
  border-radius: 4px;
  font-size: 13px;
}

body.woocommerce.archive .st-archive-ordering .woocommerce-ordering select.orderby option {
  font-size: 13px;
}

/* Mô tả danh mục */
body.woocommerce.archive .shop-container .term-description {
  text-align: justify;
}

/* Phân trang */
body.woocommerce.archive .woocommerce-pagination::before {
  content: "Chọn trang để xem thêm sản phẩm";
  display: block;
  margin-bottom: 15px;
  color: var(--st-text-light);
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
  text-align: center;
}

body.woocommerce.archive .woocommerce-pagination .page-numbers {
  margin-bottom: 20px !important;
}

/* =========================================================
   9. SEO CONTENT / FAQ / LINKS
========================================================= */

/* ==============================
   SEO content — bottom description
   General typography/presentation is owned by the child theme.
===============================*/

/* Site-wide TOC presentation is owned by child-theme style.css. */

/* Bottom description collapse UI. */
.category-bottom-seo-content.Shoptrangsuc-cat-desc-target {
  position: relative;
  transition: max-height .25s ease;
}

.category-bottom-seo-content.Shoptrangsuc-cat-desc-target.is-collapsed {
  overflow: hidden;
}

.category-bottom-seo-content.Shoptrangsuc-cat-desc-target:not(.is-collapsed) {
  overflow: visible;
}

.category-bottom-seo-content .Shoptrangsuc-cat-desc-fade {
  display: none;
}

.category-bottom-seo-content.is-collapsed .Shoptrangsuc-cat-desc-fade {
  display: block;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  height: 120px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .55) 40%,
    rgba(255, 255, 255, .9) 75%,
    #fff 100%
  );
  pointer-events: none;
}

.Shoptrangsuc-cat-desc-toggle-wrap {
  position: relative;
  z-index: 30;
  margin-top: 16px;
  padding-bottom: 24px;
  text-align: center;
}

.Shoptrangsuc-cat-desc-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 9px 24px;
  border: 1px solid var(--st-divider, #E5E0D8);
  background: var(--st-white, #FFFFFF);
  color: var(--st-primary, #1C1C1A);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all .2s ease;
}

.Shoptrangsuc-cat-desc-toggle-btn:hover {
  border-color: var(--st-primary, #1C1C1A);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

@media (max-width: 549px) {
  .category-bottom-seo-content.is-collapsed .Shoptrangsuc-cat-desc-fade {
    height: 100px;
  }

  .Shoptrangsuc-cat-desc-toggle-wrap {
    margin-top: 14px;
    padding-bottom: 22px;
  }
}

@media (max-width: 549px) {
  body.woocommerce.archive .shop-page-title {
    padding: 8px 0 5px;
  }

  body.woocommerce.archive .shop-page-title h1 {
    line-height: 1.25;
  }

  body.woocommerce.archive .shop-page-title .woocommerce-breadcrumb {
    margin-top: 5px;
    margin-bottom: -12px;
    font-size: 12px;
  }

  body.woocommerce.archive .st-archive-ordering {
    padding-bottom: 16px;
  }

  body.woocommerce.archive .st-archive-ordering .woocommerce-ordering select.orderby {
    width: auto;
    min-width: 0;
    max-width: 170px;
    border-radius: 4px;
    font-size: 12px;
  }

  body.woocommerce.archive .st-archive-ordering .woocommerce-ordering select.orderby option {
    font-size: 12px;
  }

  body.woocommerce.archive .products:has(.product-category)::after {
    margin-bottom: 22px;
  }

  body.woocommerce.archive .products .product-category .box-text {
    height: auto !important;
    min-height: 0 !important;
    padding-top: 7px !important;
    padding-bottom: 0 !important;
  }

  body.woocommerce.archive .products .product-category .box-text-inner {
    margin: 0 !important;
    padding: 0 !important;
  }

  body.woocommerce.archive .products .product-category .box-text h5,
  body.woocommerce.archive .products .product-category .woocommerce-loop-category__title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11.5px;
    line-height: 1.25;
    letter-spacing: 0.045em;
  }
  body.woocommerce.archive .products.row-small > .product-category {
    margin-bottom: -10px !important;
  }
}

/* =========================================================
   Shop Sidebar — unified deferred filter
========================================================= */
body.woocommerce.archive #shop-sidebar .widget > .is-divider.small {
  display: none;
}

body.woocommerce.archive #shop-sidebar .widget {
  margin-bottom: 24px;
}

body.woocommerce.archive #shop-sidebar .widget:last-child {
  margin-bottom: 0;
}

body.woocommerce.archive #shop-sidebar .widget-title {
  display: block;
  margin-bottom: 11px;
}

body.woocommerce.archive #shop-sidebar .woocommerce-widget-layered-nav-list__item {
  margin: 0;
  padding: 5px 0;
  border: 0 !important;
}

body.woocommerce.archive.st-filter-drawer-open .st-product-sticky-panel,
body.woocommerce.archive.st-filter-drawer-open .st-toc-float {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.woocommerce.archive #shop-sidebar .count {
  display: none !important;
}

body.woocommerce.archive #shop-sidebar .st-filter-native-active--hidden {
  display: none !important;
}

/* Category keeps its hierarchy; Brand and attributes become compact chips. */
body.woocommerce.archive #shop-sidebar .st-filter-option {
  position: relative;
  cursor: pointer;
}

body.woocommerce.archive #shop-sidebar .st-filter-option > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--st-text, #3A3936);
  font-weight: 400;
  text-decoration: none;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--category > a::before {
  content: "";
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid var(--st-divider-strong, #BFB8AE);
  border-radius: 50%;
  background: var(--st-white, #FFFFFF);
  box-sizing: border-box;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--category.is-selected > a::before {
  border: 4px solid var(--st-primary, #1C1C1A);
}

body.woocommerce.archive #shop-sidebar .st-filter-option:hover > a,
body.woocommerce.archive #shop-sidebar .st-filter-option:focus-within > a {
  color: var(--st-secondary, #806744);
}

body.woocommerce.archive #shop-sidebar .st-filter-option.is-selected > a {
  color: var(--st-text-strong, #1C1C1A) !important;
  font-weight: 500;
}

body.woocommerce.archive #shop-sidebar .st-filter-chip-list {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  padding: 0;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  min-height: 36px;
  margin: 0 !important;
  padding: 0 11px !important;
  border: 1px solid var(--st-divider, #DED8D0) !important;
  border-radius: var(--st-radius-small, 8px);
  background: var(--st-white, #FFFFFF);
  box-sizing: border-box;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--chip > a {
  min-height: 34px;
  padding: 0;
  white-space: normal;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--chip > a::before {
  display: none !important;
  content: none !important;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--chip:hover,
body.woocommerce.archive #shop-sidebar .st-filter-option--chip:focus-within {
  border-color: var(--st-secondary-border, rgba(128, 103, 68, .42)) !important;
  background: var(--st-ivory, #FCFAF7);
}

body.woocommerce.archive #shop-sidebar .st-filter-option--chip.is-selected {
  border-color: var(--st-secondary, #806744) !important;
  background: rgba(128, 103, 68, .065);
}

body.woocommerce.archive #shop-sidebar .st-filter-option--color .ux-swatch,
body.woocommerce.archive #shop-sidebar .st-filter-option--color [class*="swatch"] {
  flex: 0 0 auto;
}

body.woocommerce.archive #shop-sidebar .st-filter-option--color .ux-swatch::before,
body.woocommerce.archive #shop-sidebar .st-filter-option--color .ux-swatch::after,
body.woocommerce.archive #shop-sidebar .st-filter-option--color [class*="swatch"]::before,
body.woocommerce.archive #shop-sidebar .st-filter-option--color [class*="swatch"]::after {
  content: none !important;
}

/* Quick price presets stay two-column; slider remains native WooCommerce. */
body.woocommerce.archive #shop-sidebar .st-filter-price-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

body.woocommerce.archive #shop-sidebar .st-filter-price-preset {
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid var(--st-divider, #DED8D0);
  border-radius: var(--st-radius-small, 8px);
  background: var(--st-white, #FFFFFF);
  color: var(--st-text, #3A3936);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

body.woocommerce.archive #shop-sidebar .st-filter-price-preset:hover,
body.woocommerce.archive #shop-sidebar .st-filter-price-preset:focus-visible {
  border-color: var(--st-secondary-border, rgba(128, 103, 68, .42));
  background: var(--st-ivory, #FCFAF7);
}

body.woocommerce.archive #shop-sidebar .st-filter-price-preset.is-selected {
  border-color: var(--st-secondary, #806744);
  background: rgba(128, 103, 68, .065);
  color: var(--st-text-strong, #1C1C1A);
  font-weight: 500;
}

body.woocommerce.archive #shop-sidebar .st-filter-price .price_slider_amount .button {
  display: none !important;
}

/* Normalized selected summary. */
body.woocommerce.archive #shop-sidebar .st-filter-summary {
  margin: 0 0 20px;
}

body.woocommerce.archive #shop-sidebar .st-filter-summary[hidden] {
  display: none !important;
}

body.woocommerce.archive #shop-sidebar .st-filter-summary__title {
  margin: 0 0 9px;
  color: var(--st-text, #3A3936);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: .02em;
}

body.woocommerce.archive #shop-sidebar .st-filter-summary__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.woocommerce.archive #shop-sidebar .st-filter-summary__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  margin: 0;
  padding: 3px 8px;
  border: 1px solid var(--st-divider, #E5E0D8);
  border-radius: var(--st-radius-pill, 999px);
  background: var(--st-ivory, #FCFAF7);
  color: var(--st-text-soft, #5E5A54);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}

body.woocommerce.archive #shop-sidebar .st-filter-summary__chip:hover,
body.woocommerce.archive #shop-sidebar .st-filter-summary__chip:focus-visible {
  border-color: var(--st-secondary-border, rgba(128, 103, 68, .42));
  background: var(--st-white, #FFFFFF);
  color: var(--st-secondary, #806744);
}

/* Single sticky action footer for the whole filter session. */
body.woocommerce.archive #shop-sidebar .st-filter-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 20px 0 0;
  padding: 10px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--st-divider, #E5E0D8);
  background: var(--st-white, #FFFFFF);
  box-sizing: border-box;
}

body.woocommerce.archive #shop-sidebar .st-filter-actions button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 0 8px;
  border-radius: var(--st-radius-small, 8px);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
}

body.woocommerce.archive #shop-sidebar .st-filter-actions__clear {
  border: 1px solid var(--st-divider, #D8D3CB);
  background: var(--st-white, #FFFFFF);
  color: var(--st-text, #3A3936);
}

body.woocommerce.archive #shop-sidebar .st-filter-actions__apply {
  border: 1px solid var(--st-primary, #1C1C1A);
  background: var(--st-primary, #1C1C1A);
  color: var(--st-white, #FFFFFF);
}

body.woocommerce.archive #shop-sidebar .st-filter-actions__clear:hover,
body.woocommerce.archive #shop-sidebar .st-filter-actions__clear:focus-visible {
  border-color: var(--st-secondary-border, rgba(128, 103, 68, .42));
  color: var(--st-secondary, #806744);
}

body.woocommerce.archive #shop-sidebar .st-filter-actions__apply:hover,
body.woocommerce.archive #shop-sidebar .st-filter-actions__apply:focus-visible {
  border-color: var(--st-secondary, #806744);
  background: var(--st-secondary, #806744);
}

body.woocommerce.archive #shop-sidebar .st-filter-actions button:disabled {
  cursor: default;
  opacity: .4;
}

@media only screen and (max-width: 549px) {
  body.woocommerce.archive #shop-sidebar .st-filter-actions {
    margin-top: 18px;
    padding: 9px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  body.woocommerce.archive #shop-sidebar .st-filter-actions button {
    padding: 0 6px;
    font-size: 12px;
  }
}

/* =========================================================
   R49 — Dynamic facet availability
========================================================= */
body.woocommerce.archive #shop-sidebar .is-st-unavailable,
body.woocommerce.archive #shop-sidebar .st-filter-widget--empty {
  display: none !important;
}

body.woocommerce.archive #shop-sidebar.st-filter-availability-loading
.st-filter-option:not(.is-selected),
body.woocommerce.archive #shop-sidebar.st-filter-availability-loading
.st-filter-price-preset:not(.is-selected) {
  pointer-events: none;
}
