/**
 * CNS WooCommerce UI — Reza Batch 1 (customer surfaces)
 * Base: woocommerce-ui-fixes-v1.2
 * Adds: cart Proceed to Checkout prominence; shop/single Sold By + Add to Cart polish
 *
 * @version 1.3.0-batch1
 */

/* ==========================================================================
   1) Shop / product_cat header (#1)
   ========================================================================== */

body.archive.woocommerce .woocommerce-products-header,
body.tax-product_cat .woocommerce-products-header {
  margin: 0 0 0.75rem;
  padding: 1.5rem 0 0.75rem;
  border-bottom: 1px solid #E2E6DA;
}

body.archive.woocommerce .woocommerce-products-header h1,
body.archive.woocommerce .woocommerce-products-header .woocommerce-products-header__title,
body.tax-product_cat .woocommerce-products-header h1 {
  margin: 0 0 0.25rem;
  color: #1E2132;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ==========================================================================
   2) Marketplace breadcrumb (#2)
   ========================================================================== */

body.archive.woocommerce .woocommerce-breadcrumb,
body.tax-product_cat .woocommerce-breadcrumb {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: #5A5A5A;
}

body.archive.woocommerce .woocommerce-breadcrumb a,
body.tax-product_cat .woocommerce-breadcrumb a {
  color: #5A5A5A;
  text-decoration: none;
}

body.archive.woocommerce .woocommerce-breadcrumb a:hover,
body.tax-product_cat .woocommerce-breadcrumb a:hover {
  color: #172111;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   3) Loop toolbar chips — Goods/Services (#3)
   ========================================================================== */

body.archive.woocommerce ul.products,
body.tax-product_cat ul.products {
  clear: both;
}

body.archive.woocommerce .cns-shop-loop-filters,
body.tax-product_cat .cns-shop-loop-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  float: left;
  margin: 0.5em 12px 0.75em 0;
  padding: 0;
  max-width: 100%;
}

body.archive.woocommerce .cns-shop-loop-filters a,
body.tax-product_cat .cns-shop-loop-filters a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #E2E6DA;
  background: #F7F8F4;
  color: #1E2132;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

body.archive.woocommerce .cns-shop-loop-filters a:hover,
body.archive.woocommerce .cns-shop-loop-filters a:focus,
body.tax-product_cat .cns-shop-loop-filters a:hover,
body.tax-product_cat .cns-shop-loop-filters a:focus {
  border-color: #7CAE15;
  color: #172111;
  background: #fff;
}

body.archive.woocommerce .cns-shop-loop-filters a.is-active,
body.tax-product_cat .cns-shop-loop-filters a.is-active {
  background: #7CAE15;
  border-color: #7CAE15;
  color: #172111;
}

body.archive.woocommerce .cns-shop-loop-filters a.is-active:hover,
body.archive.woocommerce .cns-shop-loop-filters a.is-active:focus,
body.tax-product_cat .cns-shop-loop-filters a.is-active:hover,
body.tax-product_cat .cns-shop-loop-filters a.is-active:focus {
  background: #92C22B;
  border-color: #92C22B;
  color: #172111;
}

body.archive.woocommerce .woocommerce-result-count,
body.tax-product_cat .woocommerce-result-count {
  margin-top: 0.65em;
  margin-bottom: 0.75em;
}

body.archive.woocommerce form.woocommerce-ordering,
body.tax-product_cat form.woocommerce-ordering {
  margin-top: 0.35em;
  margin-bottom: 0.75em;
}

@media (max-width: 768px) {
  body.archive.woocommerce .cns-shop-loop-filters,
  body.tax-product_cat .cns-shop-loop-filters {
    float: none;
    width: 100%;
    margin: 0 0 0.75em;
  }

  body.archive.woocommerce .woocommerce-result-count,
  body.tax-product_cat .woocommerce-result-count,
  body.archive.woocommerce form.woocommerce-ordering,
  body.tax-product_cat form.woocommerce-ordering {
    float: none;
    width: 100%;
  }
}

@media (max-width: 544px) {
  body.archive.woocommerce .cns-shop-loop-filters a,
  body.tax-product_cat .cns-shop-loop-filters a {
    padding: 7px 12px;
    font-size: 12px;
  }
}

/* ==========================================================================
   4) Cart — Proceed to Checkout prominence (#4)
   ========================================================================== */

.woocommerce-cart .cart-collaterals .cart_totals {
  float: none;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
}

.woocommerce-cart .cart-collaterals table.shop_table {
  float: none;
  width: 100%;
}

.woocommerce-cart .bb_cart_totals_ctrls {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  clear: both;
  margin-top: 8px;
}

.woocommerce-cart .bb_cart_totals_ctrls .cart_shop {
  margin-right: 0;
  order: 2;
  flex: 1 1 auto;
}

.woocommerce-cart .bb_cart_totals_ctrls .wc-proceed-to-checkout {
  order: 1;
  flex: 1 1 100%;
  text-align: stretch;
  padding: 0;
  margin: 0;
}

.woocommerce-cart .bb_cart_totals_ctrls .wc-proceed-to-checkout a.checkout-button,
.woocommerce-cart .wc-proceed-to-checkout a.button.checkout-button,
.woocommerce .wc-proceed-to-checkout a.button.checkout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  height: auto;
  padding: 14px 24px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  border-radius: 10px;
  background: #7CAE15 !important;
  border: 1px solid #7CAE15 !important;
  color: #172111 !important;
  box-shadow: 0 8px 20px rgba(124, 174, 21, 0.28);
  text-align: center;
}

.woocommerce-cart .bb_cart_totals_ctrls .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce-cart .wc-proceed-to-checkout a.button.checkout-button:hover,
.woocommerce .wc-proceed-to-checkout a.button.checkout-button:hover {
  background: #92C22B !important;
  border-color: #92C22B !important;
  color: #172111 !important;
}

.woocommerce-cart .bb_cart_totals_ctrls .cart_shop a.button {
  width: 100%;
  text-align: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 544px) {
  .woocommerce-cart .cart-collaterals .cart_totals {
    max-width: none;
  }

  .woocommerce-cart .bb_cart_totals_ctrls .wc-proceed-to-checkout {
    order: 1;
    flex-basis: 100%;
  }

  .woocommerce-cart .bb_cart_totals_ctrls .cart_shop {
    order: 2;
    margin: 0;
    width: 100%;
  }
}

/* ==========================================================================
   5) Shop / single Sold By + Add to Cart (#6)
   ========================================================================== */

ul.products li.product a.by-store-name-link,
.single-product a.by-store-name-link,
.woocommerce a.by-store-name-link {
  display: block !important;
  margin: 6px 0 10px;
  padding: 0;
  color: #7CAE15 !important;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

ul.products li.product a.by-store-name-link:hover,
.single-product a.by-store-name-link:hover,
.woocommerce a.by-store-name-link:hover {
  color: #5f8a10 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

ul.products li.product .button,
ul.products li.product a.button,
ul.products li.product a.add_to_cart_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;
  margin-top: 4px;
  border-radius: 8px;
  background: #7CAE15 !important;
  border-color: #7CAE15 !important;
  color: #172111 !important;
  font-weight: 650;
}

ul.products li.product .button:hover,
ul.products li.product a.button:hover,
ul.products li.product a.add_to_cart_button:hover {
  background: #92C22B !important;
  border-color: #92C22B !important;
  color: #172111 !important;
}

/* Cart table Sold By (dl.variation from item_data) — avoid column squash */
.woocommerce-cart table.shop_table td.product-name dl.variation {
  display: block;
  width: 100%;
  max-width: none;
  margin: 6px 0 0;
  float: none;
  overflow-wrap: anywhere;
}

.woocommerce-cart table.shop_table td.product-name dl.variation dt,
.woocommerce-cart table.shop_table td.product-name dl.variation dd {
  display: inline;
  float: none;
  margin: 0;
}

.woocommerce-cart table.shop_table td.product-name dl.variation dd p {
  display: inline;
  margin: 0;
}

/* ==========================================================================
   6) Checkout Sold By — ONLY rows with dl.variation (from v1.2)
   ========================================================================== */

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) {
  flex-wrap: wrap;
  align-items: flex-start;
}

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > .bs-product-remove {
  order: 1;
}

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > .bs-product-thumbnail {
  order: 2;
}

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > .bs-product-name {
  order: 3;
  flex: 1 1 auto;
  min-width: 0;
}

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > dl.variation {
  order: 10;
  flex: 1 1 100%;
  width: 100%;
  max-width: none;
  margin: 6px 0 0;
  float: none;
}

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > dl.variation dt,
.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > dl.variation dd {
  display: inline;
  float: none;
  margin: 0;
}

.woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check:has(> dl.variation) > dl.variation dd p {
  display: inline;
  margin: 0;
}

@supports not selector(:has(*)) {
  .woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check {
    flex-wrap: wrap;
  }
  .woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check > dl.variation {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    margin: 6px 0 0;
    float: none;
  }
  .woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check > dl.variation dt,
  .woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check > dl.variation dd {
    display: inline;
    float: none;
    margin: 0;
  }
  .woocommerce-checkout .bb-wc-co table.shop_table .bs-product-check > dl.variation dd p {
    display: inline;
    margin: 0;
  }
}
