
/* Final commerce layout corrections */

/* WooCommerce sale flash is a sibling of the gallery and summary. It must
 * not become a third grid item and create a full-width yellow panel. */
.woocommerce div.product,
.brl-wc-wrap .woocommerce div.product {
  position: relative !important;
}
.woocommerce div.product > span.onsale,
.brl-wc-wrap .woocommerce div.product > span.onsale {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  left: auto !important;
  z-index: 20 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 5px 10px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: var(--danger, #d92d20) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  transform: none !important;
}

/* Archive sale badge belongs to the product image, not the document flow. */
.brl-wc-wrap .woocommerce ul.products li.product,
.woocommerce ul.products li.product {
  position: relative !important;
}
.brl-wc-wrap .woocommerce ul.products li.product > .onsale,
.woocommerce ul.products li.product > .onsale {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  left: auto !important;
  z-index: 5 !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 4px 9px !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

/* Product card + shop grid layout lives in assets/css/cards.css */

/* 1.9.39 shop-grid rules removed — see cards.css */

/* WooCommerce cart: desktop is a real table. Never allow a column to become
 * narrow enough to wrap Persian product names one character per line. */
@media (min-width: 761px) {
  body.woocommerce-cart .brl-wc-wrap,
  body.woocommerce-cart .site-content > .brl-wc-wrap,
  body.woocommerce-cart .container.brl-wc-wrap {
    width: min(1120px, calc(100% - 48px)) !important;
    max-width: 1120px !important;
    margin-inline: auto !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents thead,
  body.woocommerce-cart .woocommerce-cart-form__contents tbody {
    display: table-header-group !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents tbody { display: table-row-group !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents tr { display: table-row !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents th,
  body.woocommerce-cart .woocommerce-cart-form__contents td {
    display: table-cell !important;
    vertical-align: middle !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 14px 12px !important;
    white-space: normal !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents th:nth-child(1),
  body.woocommerce-cart .woocommerce-cart-form__contents td:nth-child(1) { width: 46% !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents th:nth-child(2),
  body.woocommerce-cart .woocommerce-cart-form__contents td:nth-child(2) { width: 16% !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents th:nth-child(3),
  body.woocommerce-cart .woocommerce-cart-form__contents td:nth-child(3) { width: 14% !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents th:nth-child(4),
  body.woocommerce-cart .woocommerce-cart-form__contents td:nth-child(4) { width: 16% !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents th:nth-child(5),
  body.woocommerce-cart .woocommerce-cart-form__contents td:nth-child(5) { width: 8% !important; }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-name,
  body.woocommerce-cart .woocommerce-cart-form__contents .product-name a {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-thumbnail {
    width: 84px !important;
    text-align: center !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-thumbnail img {
    display: inline-block !important;
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    object-fit: cover !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-price,
  body.woocommerce-cart .woocommerce-cart-form__contents .product-subtotal,
  body.woocommerce-cart .woocommerce-cart-form__contents .product-quantity,
  body.woocommerce-cart .woocommerce-cart-form__contents .product-remove {
    white-space: nowrap !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .quantity,
  body.woocommerce-cart .woocommerce-cart-form__contents .qty {
    display: inline-flex !important;
    width: auto !important;
    max-width: 90px !important;
  }
}

/* Cart/checkout wrapper itself must never become a narrow column. */
.woocommerce-cart .site-content,
.woocommerce-checkout .site-content {
  width: 100% !important;
  max-width: none !important;
}
body.woocommerce-cart .brl-wc-wrap,
body.woocommerce-checkout .brl-wc-wrap {
  box-sizing: border-box !important;
}

/* WooCommerce cart desktop: Woo's cart has SIX cells (remove, thumbnail,
   name, price, quantity, subtotal). The previous 5-column nth-child rule
   assigned the name cell a tiny column, which caused vertical text. */
@media (min-width: 761px) {
  body.woocommerce-cart .woocommerce-cart-form__contents {
    display: table !important;
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents tr {
    display: table-row !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents th,
  body.woocommerce-cart .woocommerce-cart-form__contents td {
    display: table-cell !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-remove {
    width: 42px !important;
    min-width: 42px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-thumbnail {
    width: 90px !important;
    min-width: 90px !important;
    text-align: center !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-thumbnail img {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    object-fit: contain !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-name {
    width: 40% !important;
    min-width: 240px !important;
    text-align: right !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-name a {
    display: inline !important;
    width: auto !important;
    max-width: none !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-price {
    width: 15% !important;
    min-width: 130px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-quantity {
    width: 13% !important;
    min-width: 100px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
  body.woocommerce-cart .woocommerce-cart-form__contents .product-subtotal {
    width: 15% !important;
    min-width: 130px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
}



/* ============================================================
   Aqua Store 1.9.40 — LAYOUT FIXES (cart + shop alignment)
   ============================================================ */

/* ── FIX 1: سبد خرید — جلوگیری از نمایش یک حرف در هر سطر ──
   جدول cart-table با <colgroup> عرض صریح دارد.
   table-layout:fixed از محاسبه خودکار مرورگر جلوگیری می‌کند
   که می‌تواند ستون نام محصول را تا صفر باریک کند.            */
table.cart-table {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 420px !important; /* اجازه اسکرول افقی روی موبایل */
  border-collapse: collapse !important;
}
table.cart-table th,
table.cart-table td {
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  vertical-align: middle !important;
}
table.cart-table td:first-child a {
  display: block;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  line-height: 1.5;
}
/* قیمت و جمع روی یک خط بمانند */
table.cart-table td:nth-child(2),
table.cart-table td:nth-child(4) {
  white-space: nowrap !important;
}
table.cart-table td:nth-child(3),
table.cart-table td:nth-child(5) {
  text-align: center !important;
}

/* FIX 2 card-height rules removed — see cards.css */
