/*
 * BesaPharm — Page-level overrides (single product, cart, checkout).
 * Loaded LAST — wins over everything.
 */

/* ══════════════════════════════════════════════════════
 * ZERO SIDE PADDING on key pages
 * ══════════════════════════════════════════════════════ */

body.woocommerce-cart main.oxa-page,
body.woocommerce-cart .oxa-page,
body.woocommerce-cart main.site-main,
body.woocommerce-cart .site-main,
body.woocommerce-cart #primary,
body.woocommerce-cart #primary.content-area,
body.post-type-archive-product main.site-main,
body.post-type-archive-product .site-main,
body.post-type-archive-product #primary,
body.post-type-archive-product #primary.content-area,
body.tax-product_cat main.site-main,
body.tax-product_cat .site-main,
body.tax-product_cat #primary,
body.tax-product_cat #primary.content-area,
body.woocommerce-checkout main.oxa-page,
body.woocommerce-checkout .oxa-page,
body.woocommerce-checkout main.site-main,
body.woocommerce-checkout .site-main,
body.woocommerce-checkout #primary,
body.woocommerce-checkout #primary.content-area,
body.single-product main.oxa-page,
body.single-product .oxa-page,
body.single-product main.site-main,
body.single-product .site-main,
body.single-product #primary,
body.single-product #primary.content-area {
  padding-inline: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ══════════════════════════════════════════════════════
 * SINGLE PRODUCT — 1280px
 * ══════════════════════════════════════════════════════ */

body.single-product #primary.content-area {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding: 0 !important;
}
body.single-product .site-main {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding: 2rem 0 3rem !important;
}
body.single-product .oxa-page {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding-inline: 0 !important;
}
body.single-product .e-con-inner {
  max-width: 1280px !important;
}

/* ══════════════════════════════════════════════════════
 * CART — 1280px
 * ══════════════════════════════════════════════════════ */

body.woocommerce-cart #primary.content-area,
body.woocommerce-cart #primary {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding: 0 !important;
}
body.woocommerce-cart .site-main {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding: 2rem 0 3rem !important;
}

/* ══════════════════════════════════════════════════════
 * CHECKOUT — 1280px only, no grid override
 * ══════════════════════════════════════════════════════ */

body.woocommerce-checkout #primary.content-area,
body.woocommerce-checkout #primary {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding: 0 !important;
}
body.woocommerce-checkout .site-main {
  max-width: 1280px !important;
  margin-inline: auto !important;
  padding: 2rem 0 3rem !important;
}

/* ══════════════════════════════════════════════════════
 * CART TABLE BORDER
 * ══════════════════════════════════════════════════════ */

body.woocommerce-cart table.shop_table,
body.woocommerce-cart .woocommerce table.shop_table,
body.woocommerce-cart form.woocommerce-cart-form table.shop_table {
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

/* ══════════════════════════════════════════════════════
 * HIDE COUPON + UPDATE CART
 * ══════════════════════════════════════════════════════ */

.woocommerce-cart .coupon,
.woocommerce-cart td.actions .coupon,
.cart-discount,
.woocommerce-cart .woocommerce-form-coupon-toggle,
.woocommerce-cart #coupon_code,
.woocommerce-cart .coupon-form {
  display: none !important;
}
body.woocommerce-cart button[name="update_cart"],
body.woocommerce-cart .woocommerce-cart-form__contents td.actions button[name="update_cart"] {
  display: none !important;
}
body.woocommerce-cart table.shop_table td.actions {
  display: none !important;
}

/* ══════════════════════════════════════════════════════
 * CART — grid layout
 * ══════════════════════════════════════════════════════ */

body.woocommerce-cart .woocommerce {
  display: grid !important;
  grid-template-columns: 1fr 380px !important;
  gap: 2.5rem !important;
  align-items: start !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.woocommerce-cart .woocommerce > .woocommerce-notices-wrapper,
body.woocommerce-cart .woocommerce > h1,
body.woocommerce-cart .woocommerce > .entry-title {
  grid-column: 1 / -1 !important;
}
body.woocommerce-cart .woocommerce-cart-form {
  grid-column: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
}
body.woocommerce-cart .cart-collaterals {
  grid-column: 2 !important;
  min-width: 0 !important;
  margin-top: 0 !important;
}

/* ══════════════════════════════════════════════════════
 * CART TOTALS
 * ══════════════════════════════════════════════════════ */

body.woocommerce-cart .cart_totals {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  position: static !important;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  padding: 1.5rem !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
}
body.woocommerce-cart .cart_totals > h2 {
  font-size: 30px !important;
  font-weight: 700 !important;
  margin: 0 0 1.25rem !important;
  color: #242424 !important;
}
body.woocommerce-cart .cart_totals table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  margin-bottom: 1.5rem !important;
  border: none !important;
  border-radius: 0 !important;
}
body.woocommerce-cart .cart_totals table th,
body.woocommerce-cart .cart_totals table td {
  padding: 0.75rem 0 !important;
  border-bottom: 1px solid #e5e7eb !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  font-size: 0.9375rem !important;
  vertical-align: top !important;
  word-break: break-word !important;
  background: transparent !important;
}
body.woocommerce-cart .cart_totals table th {
  font-weight: 600 !important;
  color: #6b7280 !important;
  text-align: left !important;
  width: 40% !important;
}
body.woocommerce-cart .cart_totals table td {
  color: #1d1d1d !important;
  text-align: right !important;
}
body.woocommerce-cart .cart_totals table .order-total th,
body.woocommerce-cart .cart_totals table .order-total td {
  font-weight: 700 !important;
  font-size: 1.125rem !important;
  color: #1d1d1d !important;
  border-bottom: 0 !important;
  padding-top: 1rem !important;
}
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
  display: block !important;
  width: 100% !important;
  padding: 1rem !important;
  background: #1d1d1d !important;
  color: #fff !important;
  text-align: center !important;
  border-radius: 9999px !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  transition: background 0.2s ease !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
}
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button:hover {
  background: var(--bp-brand-hover, #3d3d3d) !important;
  color: #fff !important;
}

/* ══════════════════════════════════════════════════════
 * SINGLE PRODUCT — layout
 * ══════════════════════════════════════════════════════ */

body.single-product div.product .woocommerce-product-gallery,
body.single-product div.product .summary,
body.single-product div.product .entry-summary {
  float: none !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  position: static !important;
}
body.single-product div.product {
  display: grid !important;
  grid-template-columns: 45fr 55fr !important;
  gap: 2.5rem !important;
  align-items: start !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}
body.single-product div.product .woocommerce-tabs,
body.single-product div.product .related.products,
body.single-product div.product .up-sells,
body.single-product div.product section.related {
  grid-column: 1 / -1 !important;
}

/* Gallery — a square main image area; the product image is contained inside it,
   so every product renders at the same size regardless of its native
   dimensions.

   This was a flat `height: 520px` on all three boxes. A square is what the
   reference uses (557 × 557, its column width), and stating it as a ratio means
   the image stays square at any column width instead of being letterboxed at
   one and cropped at another. All three have to agree: the slide sets the
   height, and the viewport and the track it slides in have to follow, or the
   image is clipped by whichever is shortest. */
body.single-product div.product .woocommerce-product-gallery__wrapper {
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
}
body.single-product div.product .woocommerce-product-gallery .flex-viewport {
  height: auto !important;
}
body.single-product div.product .woocommerce-product-gallery__image,
body.single-product div.product figure.woocommerce-product-gallery__image {
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
body.single-product div.product .woocommerce-product-gallery__image > a,
body.single-product div.product figure.woocommerce-product-gallery__image > a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
}
body.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 1rem;
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════
 * HIDE REVIEWS
 * ══════════════════════════════════════════════════════ */

.star-rating,
.woocommerce-product-rating,
.comment-form-rating,
#reviews,
#tab-title-reviews {
  display: none !important;
}

/* ══════════════════════════════════════════════════════
 * SINGLE PRODUCT — typography
 * ══════════════════════════════════════════════════════ */

body.single-product div.product .product_title,
body.single-product div.product h1.product_title,
body.single-product div.product .entry-summary h1,
body.single-product div.product .summary h1 {
  font-size: 33px !important;
  font-weight: 700 !important;
  color: #1d1d1d !important;
  margin: 0 0 0.75rem !important;
  line-height: 1.15 !important;
}
body.single-product div.product .price,
body.single-product div.product p.price {
  font-size: 24px !important; font-weight: 700 !important; color: #1d1d1d !important; margin-bottom: 1.25rem !important;
}
body.single-product div.product .price del { color: var(--oxa-muted) !important; font-size: 16px !important; font-weight: var(--oxa-fw-body) !important; }
body.single-product div.product .price ins { text-decoration: none !important; color: var(--oxa-sale-price) !important; font-weight: var(--oxa-fw-medium) !important; }
body.single-product div.product .woocommerce-product-details__short-description,
body.single-product div.product .woocommerce-product-details__short-description p {
  font-size: 16px !important; color: #1d1d1d !important; line-height: 1.6 !important; margin-bottom: 1.5rem !important;
}
body.single-product div.product .product_meta {
  font-size: 14px !important; color: #6b7280 !important;
  padding-top: 1.5rem !important; border-top: 1px solid #e5e7eb !important;
  display: flex !important; flex-direction: column !important; gap: 0.375rem !important;
}
body.single-product div.product .product_meta a { color: var(--bp-brand, #111111) !important; }

/* ══════════════════════════════════════════════════════
 * SINGLE PRODUCT — add to cart
 * ══════════════════════════════════════════════════════ */

body.single-product div.product form.cart {
  display: flex !important; align-items: stretch !important;
  gap: 0.75rem !important; margin-bottom: 2rem !important; flex-wrap: nowrap !important;
}
body.single-product div.product form.cart .quantity { flex-shrink: 0 !important; }
body.single-product div.product form.cart .quantity .qty {
  width: 64px !important; height: 52px !important; text-align: center !important;
  border: 1px solid #e5e7eb !important; border-radius: 10px !important;
  font-size: 1rem !important; font-weight: 600 !important;
}
body.single-product div.product form.cart .single_add_to_cart_button {
  flex: 1 !important; background: #1d1d1d !important; color: #fff !important;
  border: 0 !important; border-radius: 10px !important;
  font-size: 1rem !important; font-weight: 600 !important;
  padding: 0.875rem 2rem !important; height: 52px !important;
  cursor: pointer !important; transition: background 0.2s ease !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
}
body.single-product div.product form.cart .single_add_to_cart_button:hover { background: var(--bp-brand-hover, #3d3d3d) !important; }

/* ══════════════════════════════════════════════════════
 * SINGLE PRODUCT — tabs
 * ══════════════════════════════════════════════════════ */

body.single-product .woocommerce-tabs { border-top: 1px solid #e5e7eb; padding-top: 2rem; margin-top: 2rem; }
body.single-product .woocommerce-tabs ul.tabs {
  list-style: none !important; padding: 0 !important; margin: 0 0 1.5rem !important;
  display: flex !important; gap: 0 !important; border-bottom: 2px solid #e5e7eb !important;
}
body.single-product .woocommerce-tabs ul.tabs li { margin: 0 !important; padding: 0 !important; background: none !important; border: none !important; border-radius: 0 !important; }
body.single-product .woocommerce-tabs ul.tabs li::before,
body.single-product .woocommerce-tabs ul.tabs li::after { display: none !important; }
body.single-product .woocommerce-tabs ul.tabs li a {
  display: block; padding: 0.75rem 1.5rem; font-size: 0.9375rem; font-weight: 500;
  color: #6b7280; border-bottom: 2px solid transparent; margin-bottom: -2px; background: none !important;
}
body.single-product .woocommerce-tabs ul.tabs li.active a { color: #1d1d1d; border-bottom-color: var(--bp-brand, #111111); }
body.single-product .woocommerce-tabs .panel { font-size: 16px; line-height: 1.7; color: #1d1d1d; }
body.single-product .woocommerce-tabs .panel h2 { font-size: 1.25rem !important; margin-bottom: 1rem; }

/* ══════════════════════════════════════════════════════
 * SINGLE PRODUCT — related/upsells
 * ══════════════════════════════════════════════════════ */

body.single-product .related.products,
body.single-product .up-sells,
body.single-product section.related.products {
  margin-top: 2rem !important; padding-top: 2rem !important; border-top: 0 !important;
}
body.single-product .related.products > h2,
body.single-product .up-sells > h2 {
  font-size: 1.25rem !important; font-weight: 700 !important; margin-bottom: 1.5rem !important; color: #1d1d1d !important;
}

/* ══════════════════════════════════════════════════════
 * RESPONSIVE
 * ══════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  body.single-product div.product { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
  body.single-product div.product form.cart { flex-wrap: wrap !important; }
  body.woocommerce-cart .woocommerce { grid-template-columns: 1fr !important; }
  /* The desktop rule above squares the image against its column; below 900px
     the column is the screen, so the same ratio applies and this only has to
     get out of the way. It used to pin all four boxes to 380px, which on a
     753px-wide tablet column cropped the photograph to a letterbox. */
  body.single-product div.product .woocommerce-product-gallery__wrapper,
  body.single-product div.product .woocommerce-product-gallery .flex-viewport {
    height: auto !important;
    max-height: none !important;
  }
  body.single-product div.product .woocommerce-product-gallery__image,
  body.single-product div.product figure.woocommerce-product-gallery__image {
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 1 / 1 !important;
  }
}
