/*
 * Furnicom Commerce Fixes v7
 * Focused QA fixes for compare modal, single-product quantity, residual canvas,
 * and WooCommerce cart. Loaded after stability-refresh.css.
 */

/* ========================================================================== 
   Final canvas cleanup — legacy app CSS still paints .single-product grey.
   ========================================================================== */
body.single-product,
body.woocommerce-cart,
body.woocommerce-checkout,
body.woocommerce-page,
body.single-product .body-wrapper,
body.single-product #contents,
body.single-product #contents-detail,
body.single-product #contents-detail > .single-product,
body.single-product #contents-detail .single-product,
body.single-product .content-product-detail,
body.single-product .tabs,
body.single-product .bottom-single-product,
body.single-product .related,
body.single-product .related-products,
body.single-product .upsells,
body.single-product .up-sells,
body.single-product .sw_related_upsell_widget,
body.single-product .sw_related_upsell_widget .tab-content,
body.single-product .sw_related_upsell_widget .tab-pane,
body.single-product .sw_related_upsell_widget .sw-woo-container-slider,
body.single-product .sw_related_upsell_widget .resp-slider-container {
  background: var(--fm-page, #fbfaf6) !important;
  background-color: var(--fm-page, #fbfaf6) !important;
}

body.single-product .tabs .tabbable,
body.single-product .tabs .tabbable .tab-content,
body.single-product .tabs .tabbable .tab-pane,
body.single-product .related .products-entry,
body.single-product .upsells .products-entry,
body.single-product .up-sells .products-entry {
  background: #fff !important;
}

/* ========================================================================== 
   Quantity stepper — horizontal, reusable on product and cart screens.
   ========================================================================== */
.woocommerce .quantity.buttons_added,
.woocommerce-page .quantity.buttons_added,
.single-product .product-summary-bottom .quantity.buttons_added,
.woocommerce-cart table.cart .quantity.buttons_added {
  direction: ltr !important;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: stretch;
  flex: 0 0 auto;
  width: 118px !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--fm-line, #dfe7e3) !important;
  border-radius: 11px !important;
  background: #fff !important;
  box-shadow: none !important;
  vertical-align: middle;
}

.woocommerce .quantity.buttons_added .qty,
.woocommerce-page .quantity.buttons_added .qty,
.single-product .product-summary-bottom .quantity.buttons_added .qty,
.woocommerce-cart table.cart .quantity.buttons_added .qty {
  order: 2;
  flex: 1 1 46px;
  width: 46px !important;
  min-width: 0 !important;
  height: 46px !important;
  margin: 0 !important;
  padding: 0 4px !important;
  border: 0 !important;
  border-right: 1px solid var(--fm-line, #dfe7e3) !important;
  border-left: 1px solid var(--fm-line, #dfe7e3) !important;
  border-radius: 0 !important;
  background: #fff !important;
  color: var(--fm-heading, #173b37) !important;
  font-size: 13px !important;
  font-weight: 700;
  line-height: 46px !important;
  text-align: center;
  box-shadow: none !important;
  -moz-appearance: textfield;
}

.woocommerce .quantity.buttons_added .plus,
.woocommerce .quantity.buttons_added .minus,
.woocommerce-page .quantity.buttons_added .plus,
.woocommerce-page .quantity.buttons_added .minus,
.single-product .product-summary-bottom .quantity.buttons_added .plus,
.single-product .product-summary-bottom .quantity.buttons_added .minus,
.woocommerce-cart table.cart .quantity.buttons_added .plus,
.woocommerce-cart table.cart .quantity.buttons_added .minus {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 35px;
  width: 35px !important;
  min-width: 35px !important;
  height: 46px !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--fm-surface-warm, #f8faf7) !important;
  color: var(--fm-primary, #16786f) !important;
  font-family: Vazirmatn, "WebYekan", Tahoma, Arial, sans-serif !important;
  font-size: 18px !important;
  font-weight: 500 !important;
  line-height: 46px !important;
  text-align: center;
  text-shadow: none !important;
  box-shadow: none !important;
  cursor: pointer;
}

.woocommerce .quantity.buttons_added .minus,
.woocommerce-page .quantity.buttons_added .minus {
  order: 1;
}

.woocommerce .quantity.buttons_added .plus,
.woocommerce-page .quantity.buttons_added .plus {
  order: 3;
}

.woocommerce .quantity.buttons_added .plus:hover,
.woocommerce .quantity.buttons_added .minus:hover,
.woocommerce-page .quantity.buttons_added .plus:hover,
.woocommerce-page .quantity.buttons_added .minus:hover {
  background: var(--fm-primary-soft, #e9f5f2) !important;
  color: var(--fm-primary-hover, #0f625a) !important;
}

/* Single product action cluster. Do not float legacy pieces around the stepper. */
.single-product .product_detail .content_product_detail .product-summary-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.single-product .product_detail .content_product_detail .product-summary-bottom form.cart,
.single-product .product_detail .content_product_detail .product-summary-bottom p.cart,
.single-product .product_detail .content_product_detail .product-summary-bottom .single-product-addcart {
  float: none !important;
  margin: 0 !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom form.cart,
.single-product .product_detail .content_product_detail .product-summary-bottom p.cart {
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .single_add_to_cart_button,
.single-product .product_detail .content_product_detail .product-summary-bottom .product_type_external,
.single-product .product_detail .content_product_detail .product-summary-bottom .product_type_grouped {
  float: none !important;
  height: 48px !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 0 22px !important;
  border-radius: 11px !important;
  line-height: 48px !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .single-product-addcart {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .single-product-addcart .compare-button,
.single-product .product_detail .content_product_detail .product-summary-bottom .single-product-addcart .yith-wcwl-add-to-wishlist {
  float: none !important;
  margin: 0 !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .compare-button a,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-add-to-wishlist a,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-wishlistexistsbrowse a,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-wishlistaddedbrowse a {
  position: relative;
  box-sizing: border-box;
  display: block !important;
  width: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--fm-line, #dfe7e3) !important;
  border-radius: 11px !important;
  background: #fff !important;
  background-image: none !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 48px !important;
  text-indent: 0 !important;
  box-shadow: none !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .compare-button a:before {
  content: "\f0ec" !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-add-to-wishlist a:before,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-wishlistexistsbrowse a:before,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-wishlistaddedbrowse a:before {
  content: "\f004" !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .compare-button a:before,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-add-to-wishlist a:before,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-wishlistexistsbrowse a:before,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-wishlistaddedbrowse a:before {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  background: none !important;
  color: #71827e !important;
  font-family: FontAwesome !important;
  font-size: 15px !important;
  line-height: 48px !important;
  text-align: center !important;
  text-indent: 0 !important;
}

.single-product .product_detail .content_product_detail .product-summary-bottom .compare-button a:hover,
.single-product .product_detail .content_product_detail .product-summary-bottom .yith-wcwl-add-to-wishlist a:hover {
  border-color: #b9d8d1 !important;
  background: var(--fm-primary-soft, #e9f5f2) !important;
}

/* ========================================================================== 
   Compare popup shell (Colorbox on parent document)
   ========================================================================== */
#colorbox,
#cboxWrapper,
#cboxContent {
  box-sizing: border-box;
}

#colorbox {
  overflow: visible !important;
  border-radius: 18px !important;
  background: transparent !important;
  box-shadow: 0 30px 90px rgba(8, 31, 29, .34) !important;
}

#cboxWrapper,
#cboxContent {
  border-radius: 18px !important;
  background: #fff !important;
}

#cboxLoadedContent {
  margin: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: #fff !important;
}

#cboxOverlay {
  background: rgba(9, 21, 24, .68) !important;
  opacity: 1 !important;
}

#cboxClose {
  top: 12px !important;
  right: 12px !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 10005 !important;
  width: 38px !important;
  height: 38px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #fff !important;
  background-image: none !important;
  color: transparent !important;
  font-size: 0 !important;
  box-shadow: 0 5px 16px rgba(10, 42, 39, .18) !important;
}

#cboxClose:before {
  content: "\00d7";
  display: block;
  color: #60726e;
  font-family: Arial, sans-serif;
  font-size: 27px;
  font-weight: 300;
  line-height: 36px;
  text-align: center;
}

/* ========================================================================== 
   Cart page — keep table semantics, modernize spacing and totals.
   ========================================================================== */
.woocommerce-cart .woocommerce,
.woocommerce-cart .entry-content,
.woocommerce-cart #contents,
.woocommerce-cart .main-page {
  background: transparent !important;
}

.woocommerce-cart form.woocommerce-cart-form,
.woocommerce-cart form.cart-form {
  margin-bottom: 24px;
}

.woocommerce-cart table.shop_table.cart,
.woocommerce-cart .woocommerce table.shop_table.cart {
  width: 100% !important;
  margin: 0 0 24px !important;
  overflow: hidden;
  border: 1px solid var(--fm-line, #dfe7e3) !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 8px 26px rgba(21, 65, 60, .05);
}

.woocommerce-cart table.shop_table.cart thead th {
  padding: 15px 16px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--fm-line, #dfe7e3) !important;
  background: var(--fm-surface-warm, #f8faf7) !important;
  color: var(--fm-heading, #173b37) !important;
  font-size: 12.5px;
  font-weight: 800;
  text-align: right;
}

.woocommerce-cart table.shop_table.cart tbody td {
  padding: 16px !important;
  border: 0 !important;
  border-bottom: 1px solid #edf1ef !important;
  background: #fff !important;
  color: var(--fm-text, #405752);
  vertical-align: middle !important;
  text-align: right;
}

.woocommerce-cart table.shop_table.cart tr:last-child td,
.woocommerce-cart table.shop_table.cart td.actions {
  border-bottom: 0 !important;
}

.woocommerce-cart table.shop_table.cart .product-remove {
  width: 42px;
  text-align: center !important;
}

.woocommerce-cart table.shop_table.cart .product-remove a.remove {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: #fff2ee !important;
  color: var(--fm-coral, #e85d3f) !important;
  font-size: 20px !important;
  line-height: 32px !important;
}

.woocommerce-cart table.shop_table.cart .product-remove a.remove:hover {
  background: var(--fm-coral, #e85d3f) !important;
  color: #fff !important;
}

.woocommerce-cart table.shop_table.cart .product-thumbnail {
  width: 90px;
}

.woocommerce-cart table.shop_table.cart .product-thumbnail img {
  width: 70px !important;
  height: 70px !important;
  padding: 5px;
  border: 1px solid var(--fm-line, #dfe7e3);
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.woocommerce-cart table.shop_table.cart .product-name a {
  color: var(--fm-heading, #173b37) !important;
  font-weight: 700;
  line-height: 1.9;
}

.woocommerce-cart table.shop_table.cart .product-price .amount,
.woocommerce-cart table.shop_table.cart .product-subtotal .amount {
  color: var(--fm-coral, #e85d3f) !important;
  font-weight: 800;
  white-space: nowrap;
}

.woocommerce-cart table.shop_table.cart td.actions {
  padding: 14px 16px !important;
  background: var(--fm-surface-warm, #f8faf7) !important;
}

.woocommerce-cart table.shop_table.cart td.actions .coupon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  float: right !important;
}

.woocommerce-cart table.shop_table.cart td.actions .coupon #coupon_code {
  width: 190px !important;
  height: 42px !important;
  margin: 0 !important;
  padding: 0 13px !important;
  border: 1px solid var(--fm-line, #dfe7e3) !important;
  border-radius: 10px !important;
  background: #fff !important;
}

.woocommerce-cart table.shop_table.cart td.actions .button,
.woocommerce-cart table.shop_table.cart td.actions button.button,
.woocommerce-cart table.shop_table.cart td.actions input.button {
  float: none !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: var(--fm-primary, #16786f) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 700;
  line-height: 42px !important;
}

.woocommerce-cart table.shop_table.cart td.actions > .button,
.woocommerce-cart table.shop_table.cart td.actions > button.button,
.woocommerce-cart table.shop_table.cart td.actions > input.button {
  float: left !important;
}

.woocommerce-cart .cart-collaterals,
.woocommerce-page.woocommerce-cart .cart-collaterals {
  box-sizing: border-box;
  display: flex !important;
  justify-content: flex-start;
  width: 100% !important;
  margin: 0 0 34px !important;
}

.rtl.woocommerce-cart .cart-collaterals,
.rtl.woocommerce-page.woocommerce-cart .cart-collaterals {
  justify-content: flex-start;
}

.woocommerce-cart .cart-collaterals .cart_totals,
.woocommerce-page.woocommerce-cart .cart-collaterals .cart_totals {
  box-sizing: border-box;
  float: none !important;
  width: min(100%, 480px) !important;
  margin: 0 !important;
  overflow: hidden;
  border: 1px solid var(--fm-line, #dfe7e3) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 8px 26px rgba(21, 65, 60, .05);
}

.woocommerce-cart .cart-collaterals .cart_totals h2 {
  margin: 0 !important;
  padding: 18px 20px 12px !important;
  color: var(--fm-heading, #173b37) !important;
  font-size: 20px !important;
  font-weight: 800;
}

.woocommerce-cart .cart-collaterals .cart_totals table,
.woocommerce-cart .cart-collaterals .cart_totals table.shop_table {
  display: table !important;
  width: calc(100% - 40px) !important;
  margin: 0 20px 8px !important;
  border: 0 !important;
  border-collapse: collapse !important;
  table-layout: auto !important;
  background: #fff !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table tbody {
  display: table-row-group !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table tr {
  display: table-row !important;
  width: auto !important;
  border: 0 !important;
  border-bottom: 1px solid #edf1ef !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table th,
.woocommerce-cart .cart-collaterals .cart_totals table td {
  display: table-cell !important;
  width: 50% !important;
  padding: 13px 0 !important;
  border: 0 !important;
  background: #fff !important;
  color: var(--fm-text, #405752) !important;
  font-size: 13px !important;
  line-height: 1.9 !important;
  vertical-align: middle !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table th {
  font-weight: 700;
  text-align: right !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table td {
  text-align: left !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table td:before {
  display: none !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table .order-total th,
.woocommerce-cart .cart-collaterals .cart_totals table .order-total td {
  padding-top: 16px !important;
  padding-bottom: 16px !important;
  color: var(--fm-heading, #173b37) !important;
}

.woocommerce-cart .cart-collaterals .cart_totals table .order-total .amount {
  color: var(--fm-primary, #16786f) !important;
  font-size: 17px !important;
  font-weight: 900 !important;
  white-space: nowrap;
}

.woocommerce-cart .cart-collaterals .wc-proceed-to-checkout {
  margin: 0 !important;
  padding: 14px 20px 20px !important;
}

.woocommerce-cart .cart-collaterals .wc-proceed-to-checkout .checkout-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 0 20px !important;
  border: 0 !important;
  border-radius: 11px !important;
  background: var(--fm-primary, #16786f) !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 48px !important;
}

.woocommerce-cart .cart-collaterals .wc-proceed-to-checkout .checkout-button:hover {
  background: var(--fm-primary-hover, #0f625a) !important;
}

@media (max-width: 767px) {
  .single-product .product_detail .content_product_detail .product-summary-bottom {
    gap: 8px;
  }

  .single-product .product_detail .content_product_detail .product-summary-bottom form.cart,
  .single-product .product_detail .content_product_detail .product-summary-bottom p.cart {
    flex-wrap: wrap;
  }

  .woocommerce-cart table.shop_table.cart,
  .woocommerce-cart table.shop_table.cart tbody,
  .woocommerce-cart table.shop_table.cart tr,
  .woocommerce-cart table.shop_table.cart td {
    box-sizing: border-box;
  }

  .woocommerce-cart table.shop_table.cart td.actions .coupon {
    display: flex;
    float: none !important;
    width: 100%;
    margin-bottom: 9px;
  }

  .woocommerce-cart table.shop_table.cart td.actions .coupon #coupon_code {
    flex: 1 1 auto;
    width: auto !important;
  }

  .woocommerce-cart table.shop_table.cart td.actions > .button,
  .woocommerce-cart table.shop_table.cart td.actions > button.button,
  .woocommerce-cart table.shop_table.cart td.actions > input.button {
    float: none !important;
    width: 100% !important;
  }

  .woocommerce-cart .cart-collaterals .cart_totals,
  .woocommerce-page.woocommerce-cart .cart-collaterals .cart_totals {
    width: 100% !important;
  }
}
