/*
 * Theme 5 + Theme 6 visual-integrity patch.
 * Scope is deliberately limited to Beauty Glow Commerce and Catalog Market Pro.
 * Loaded after storefront-themes.css so it can correct incomplete visual rules
 * without changing the shared renderer or Themes 1-4.
 */

/* ========================================================================== 
   THEME 5 — BEAUTY GLOW COMMERCE
   ========================================================================== */

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-section,
.store-theme-beauty-glow-commerce .st-beauty-section {
  padding-block: clamp(38px, 4.5vw, 64px);
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-intro,
[data-theme-renderer="beauty-glow-commerce"] .st-beauty-section-head,
.store-theme-beauty-glow-commerce .st-beauty-category-intro,
.store-theme-beauty-glow-commerce .st-beauty-section-head {
  margin-bottom: 26px;
  text-align: center;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-section-title,
.store-theme-beauty-glow-commerce .st-beauty-section-title {
  line-height: 1.3;
}

/* Restore the missing category-media geometry. */
[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid,
.store-theme-beauty-glow-commerce .st-beauty-category-grid {
  align-items: stretch;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid .st-category-card,
.store-theme-beauty-glow-commerce .st-beauty-category-grid .st-category-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  background: var(--theme-surface, #fff);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid .st-category-card:hover,
.store-theme-beauty-glow-commerce .st-beauty-category-grid .st-category-card:hover {
  transform: translateY(-3px);
  border-color: rgba(196, 106, 122, 0.34);
  box-shadow: 0 16px 36px rgba(46, 31, 36, 0.10);
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid .st-category-media,
.store-theme-beauty-glow-commerce .st-beauty-category-grid .st-category-media {
  display: block;
  width: 100%;
  min-height: 150px;
  aspect-ratio: 4 / 3;
  flex: 0 0 auto;
  background-size: cover;
  background-position: center;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid .st-category-title,
.store-theme-beauty-glow-commerce .st-beauty-category-grid .st-category-title {
  margin: 0;
  padding: 14px 16px 16px;
  color: var(--theme-secondary, #2e1f24);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.45;
  text-align: start;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid .st-category-count,
.store-theme-beauty-glow-commerce .st-beauty-category-grid .st-category-count {
  padding: 0 16px 16px;
  color: var(--theme-muted, #826c73);
  font-size: 11px;
}

/* Product filter pills. */
[data-theme-renderer="beauty-glow-commerce"] .st-category-filter-bar,
.store-theme-beauty-glow-commerce .st-category-filter-bar {
  margin-top: 18px;
  gap: 10px;
}

[data-theme-renderer="beauty-glow-commerce"] .st-cat-filter-btn,
.store-theme-beauty-glow-commerce .st-cat-filter-btn {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--theme-border, #f0d8dd);
  border-radius: 999px;
  background: #fff;
  color: var(--theme-secondary, #2e1f24);
}

[data-theme-renderer="beauty-glow-commerce"] .st-cat-filter-btn:hover,
[data-theme-renderer="beauty-glow-commerce"] .st-cat-filter-btn.is-active,
.store-theme-beauty-glow-commerce .st-cat-filter-btn:hover,
.store-theme-beauty-glow-commerce .st-cat-filter-btn.is-active {
  border-color: var(--theme-primary, #c46a7a);
  background: var(--theme-primary, #c46a7a);
  color: #fff;
}

/* Product cards: remove oversized empty media and restore complete card content. */
[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid,
.store-theme-beauty-glow-commerce .st-beauty-products-grid {
  align-items: stretch;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-card,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-card {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  background: var(--theme-surface, #fff);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-card:hover,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(196, 106, 122, 0.32);
  box-shadow: 0 18px 42px rgba(46, 31, 36, 0.11);
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-media-wrap,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-media-wrap {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--theme-surface-soft, #fcecee);
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-img,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
  object-position: center;
  background: var(--theme-surface-soft, #fcecee);
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-badge,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-badge {
  position: absolute;
  z-index: 2;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-body,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-body {
  display: flex;
  min-width: 0;
  padding: 16px 16px 18px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  background: var(--theme-surface, #fff);
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-title,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-title {
  min-height: 44px;
  margin: 0;
  color: var(--theme-secondary, #2e1f24);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.48;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-prices,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-prices {
  display: flex;
  min-height: 30px;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-price,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-price {
  color: var(--theme-primary-hover, #a95365);
  font-size: 18px;
  font-weight: 900;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-old-price,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-old-price {
  color: var(--theme-muted, #826c73);
  font-size: 12px;
  text-decoration: line-through;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-buy-btn,
.store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-buy-btn {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  margin-top: auto;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

/* Beauty footer hierarchy. */
[data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer-inner,
.store-theme-beauty-glow-commerce .st-beauty-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 42px;
  align-items: start;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer-brand,
.store-theme-beauty-glow-commerce .st-beauty-footer-brand {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 900;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer-copy,
.store-theme-beauty-glow-commerce .st-beauty-footer-copy {
  max-width: 680px;
  margin: 0;
  color: var(--theme-footer-muted, #c9b8be);
  font-size: 13px;
  line-height: 1.8;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer-links,
.store-theme-beauty-glow-commerce .st-beauty-footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

[data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer small,
.store-theme-beauty-glow-commerce .st-beauty-footer small {
  grid-column: 1 / -1;
  color: var(--theme-footer-muted, #c9b8be);
}

/* ========================================================================== 
   THEME 6 — CATALOG MARKET PRO
   ========================================================================== */

[data-theme-renderer="catalog-market-pro"] .st-market-section-head,
.store-theme-catalog-market-pro .st-market-section-head {
  margin-bottom: 22px;
  text-align: start;
}

[data-theme-renderer="catalog-market-pro"] .st-market-kicker,
.store-theme-catalog-market-pro .st-market-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--theme-primary, #2563eb);
  font-size: 11px;
  font-weight: 850;
}

[data-theme-renderer="catalog-market-pro"] .st-market-section-title,
.store-theme-catalog-market-pro .st-market-section-title {
  margin: 0;
  color: var(--theme-secondary, #0f172a);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 900;
  line-height: 1.3;
}

/* Make category cards look like deliberate catalog tiles. */
[data-theme-renderer="catalog-market-pro"] .st-market-category-grid .st-category-card,
.store-theme-catalog-market-pro .st-market-category-grid .st-category-card {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

[data-theme-renderer="catalog-market-pro"] .st-market-category-grid .st-category-card:hover,
.store-theme-catalog-market-pro .st-market-category-grid .st-category-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.38);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

[data-theme-renderer="catalog-market-pro"] .st-market-category-grid .st-category-title,
.store-theme-catalog-market-pro .st-market-category-grid .st-category-title {
  margin: 0;
  padding: 13px 14px 8px;
  color: var(--theme-text, #0f172a);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
}

[data-theme-renderer="catalog-market-pro"] .st-market-category-grid .st-category-count,
.store-theme-catalog-market-pro .st-market-category-grid .st-category-count {
  padding: 0 14px 13px;
  color: var(--theme-muted, #64748b);
  font-size: 11px;
}

/* Do not reserve a fifth empty column when the demo only has four products. */
[data-theme-renderer="catalog-market-pro"] .st-market-products-grid,
.store-theme-catalog-market-pro .st-market-products-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: stretch;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-card,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-card {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  background: var(--theme-surface, #fff);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-card:hover,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, 0.34);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.10);
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-media-wrap,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-media-wrap {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  flex: 0 0 auto;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-img,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
  object-position: center;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-badge,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-badge {
  position: absolute;
  z-index: 2;
  inset-block-start: 9px;
  inset-inline-end: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--theme-primary, #2563eb);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-body,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-body {
  display: flex;
  min-width: 0;
  padding: 13px 14px 15px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  background: var(--theme-surface, #fff);
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-title,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-title {
  min-height: 42px;
  margin: 0;
  color: var(--theme-text, #0f172a);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.5;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-prices,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-prices {
  display: flex;
  min-height: 28px;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-price,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-price {
  color: var(--theme-secondary, #0f172a);
  font-size: 16px;
  font-weight: 900;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-old-price,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-old-price {
  color: var(--theme-muted, #64748b);
  font-size: 11px;
  text-decoration: line-through;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-buy-btn,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-buy-btn {
  display: inline-flex;
  width: 100%;
  min-height: 38px;
  margin-top: auto;
  padding: 9px 12px;
  align-items: center;
  justify-content: center;
  border-radius: var(--theme-btn-radius, 8px);
  background: var(--theme-primary, #2563eb);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

[data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-buy-btn:hover,
.store-theme-catalog-market-pro .st-market-products-grid .st-product-buy-btn:hover {
  background: var(--theme-primary-hover, #1d4ed8);
}

/* Catalog filters should read as controls, not loose text. */
[data-theme-renderer="catalog-market-pro"] .st-category-filter-bar,
.store-theme-catalog-market-pro .st-category-filter-bar {
  justify-content: flex-start;
  gap: 8px;
  margin-top: 16px;
}

[data-theme-renderer="catalog-market-pro"] .st-cat-filter-btn,
.store-theme-catalog-market-pro .st-cat-filter-btn {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--theme-border, #d8e1ec);
  border-radius: var(--theme-btn-radius, 8px);
  background: var(--theme-surface, #fff);
  color: var(--theme-text, #0f172a);
}

[data-theme-renderer="catalog-market-pro"] .st-cat-filter-btn:hover,
[data-theme-renderer="catalog-market-pro"] .st-cat-filter-btn.is-active,
.store-theme-catalog-market-pro .st-cat-filter-btn:hover,
.store-theme-catalog-market-pro .st-cat-filter-btn.is-active {
  border-color: var(--theme-primary, #2563eb);
  background: var(--theme-primary, #2563eb);
  color: #fff;
}

[data-theme-renderer="catalog-market-pro"] .st-market-trust-item,
.store-theme-catalog-market-pro .st-market-trust-item {
  min-width: 0;
  border: 1px solid var(--theme-border, #d8e1ec);
  border-radius: var(--theme-card-radius, 10px);
}

[data-theme-renderer="catalog-market-pro"] .st-market-trust-item b,
.store-theme-catalog-market-pro .st-market-trust-item b {
  display: block;
  margin-bottom: 2px;
  color: var(--theme-text, #0f172a);
  font-size: 12px;
}

[data-theme-renderer="catalog-market-pro"] .st-market-trust-item span,
.store-theme-catalog-market-pro .st-market-trust-item span {
  color: var(--theme-muted, #64748b);
  font-size: 11px;
}

/* The renderer already outputs a complete market footer; give it its missing CSS. */
[data-theme-renderer="catalog-market-pro"] .st-market-footer,
.store-theme-catalog-market-pro .st-market-footer {
  margin-top: auto;
  padding: 38px 0 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--theme-footer-bg, #0f172a);
  color: var(--theme-footer-text, #fff);
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer-inner,
.store-theme-catalog-market-pro .st-market-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 36px;
  align-items: start;
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer-brand,
.store-theme-catalog-market-pro .st-market-footer-brand {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer p,
.store-theme-catalog-market-pro .st-market-footer p {
  max-width: 720px;
  margin: 0;
  color: var(--theme-footer-muted, #94a3b8);
  font-size: 12px;
  line-height: 1.8;
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer-links,
.store-theme-catalog-market-pro .st-market-footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer a,
.store-theme-catalog-market-pro .st-market-footer a {
  color: #fff;
  font-size: 12px;
  font-weight: 750;
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer a:hover,
.store-theme-catalog-market-pro .st-market-footer a:hover {
  color: #bfdbfe;
}

[data-theme-renderer="catalog-market-pro"] .st-market-footer small,
.store-theme-catalog-market-pro .st-market-footer small {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--theme-footer-muted, #94a3b8);
  font-size: 11px;
}

/* ========================================================================== 
   RESPONSIVE SAFETY
   ========================================================================== */

@media (max-width: 960px) {
  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid,
  .store-theme-beauty-glow-commerce .st-beauty-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  [data-theme-renderer="catalog-market-pro"] .st-market-products-grid,
  .store-theme-catalog-market-pro .st-market-products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Hide desktop nav; mobile drawer is used instead. */
  [data-theme-renderer="catalog-market-pro"] .st-market-nav,
  .store-theme-catalog-market-pro .st-market-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-section,
  .store-theme-beauty-glow-commerce .st-beauty-section {
    padding-block: 32px;
  }

  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-category-grid,
  .store-theme-beauty-glow-commerce .st-beauty-category-grid,
  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid,
  .store-theme-beauty-glow-commerce .st-beauty-products-grid,
  [data-theme-renderer="catalog-market-pro"] .st-market-category-grid,
  .store-theme-catalog-market-pro .st-market-category-grid,
  [data-theme-renderer="catalog-market-pro"] .st-market-products-grid,
  .store-theme-catalog-market-pro .st-market-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid .st-product-body,
  .store-theme-beauty-glow-commerce .st-beauty-products-grid .st-product-body,
  [data-theme-renderer="catalog-market-pro"] .st-market-products-grid .st-product-body,
  .store-theme-catalog-market-pro .st-market-products-grid .st-product-body {
    padding: 12px;
  }

  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer-inner,
  .store-theme-beauty-glow-commerce .st-beauty-footer-inner,
  [data-theme-renderer="catalog-market-pro"] .st-market-footer-inner,
  .store-theme-catalog-market-pro .st-market-footer-inner {
    grid-template-columns: 1fr;
  }

  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-footer small,
  .store-theme-beauty-glow-commerce .st-beauty-footer small,
  [data-theme-renderer="catalog-market-pro"] .st-market-footer small,
  .store-theme-catalog-market-pro .st-market-footer small {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  [data-theme-renderer="beauty-glow-commerce"] .st-beauty-products-grid,
  .store-theme-beauty-glow-commerce .st-beauty-products-grid,
  [data-theme-renderer="catalog-market-pro"] .st-market-products-grid,
  .store-theme-catalog-market-pro .st-market-products-grid {
    grid-template-columns: 1fr;
  }
}
