/* SHB Cart & Checkout — 1.0.0
 * Palette is the shop's own: deep brown #684824, brown #8B6635, gold #C9A227,
 * ivory #F7F3EA, text #3A2D1F. No new colour is introduced.
 * Everything is scoped to the product form, the cart and the checkout.
 * The theme's global button variables are never touched. */

:root {
  --shb-deep: #684824;
  --shb-brown: #8B6635;
  --shb-gold: #C9A227;
  --shb-ivory: #F7F3EA;
  --shb-text: #3A2D1F;
  --shb-line: #e7dcc6;
  --shb-radius: 35px;
  --shb-tb: 60px;
}

/* 2. Footer: Visa and Mastercard out until card payments are live. */
#sh-payments .sh-pay-icons .sh-pay-card:nth-child(-n+2) {
  display: none !important;
}

/* 6. Deposit callout (product page and cart). */
body.single-product .shb-deposit-box,
body.woocommerce-cart .shb-deposit-box {
  background: var(--shb-ivory) !important;
  border: 2px dashed var(--shb-brown) !important;
  border-radius: 12px !important;
  padding: 10px 14px !important;
  margin: 10px 0 14px !important;
  color: var(--shb-text) !important;
  font-size: 14px !important;
  line-height: 1.7 !important;
  font-weight: 700 !important;
  text-align: center !important;
}
body.single-product .shb-deposit-box .shb-deposit-text,
body.woocommerce-cart .shb-deposit-box .shb-deposit-text {
  display: block;
}

/* 4 + 8. Product buy box: quantity on its own row, then اشتري الآن (primary)
   beside أضف للسلة (secondary). */
/* The buy box moves onto the page's cream background, as in the approved
   mock-up. The band's own light-on-dark text colours are reset here so
   nothing becomes unreadable; the theme's global variables stay untouched. */
body.single-product .summary-inner form.cart {
  background: none !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
body.single-product .summary-inner form.cart label,
body.single-product .summary-inner form.cart th,
body.single-product .summary-inner form.cart .woocommerce-variation-availability,
body.single-product .summary-inner form.cart .stock,
body.single-product .summary-inner form.cart .reset_variations,
body.single-product .summary-inner form.cart .wd-swatch-text,
body.single-product .summary-inner form.cart .wd-swatch,
body.single-product .summary-inner form.cart .wd-swatch * {
  color: var(--shb-text) !important;
}
body.single-product .summary-inner form.cart .woocommerce-variation-price,
body.single-product .summary-inner form.cart .woocommerce-variation-price .amount,
body.single-product .summary-inner form.cart .woocommerce-variation-price ins {
  color: var(--shb-deep) !important;
}
body.single-product .summary-inner form.cart .woocommerce-variation-price del,
body.single-product .summary-inner form.cart .woocommerce-variation-price del .amount {
  color: #8a7a63 !important;
}
body.single-product .summary-inner form.cart .quantity {
  background: #fff !important;
  border: 1px solid var(--shb-line) !important;
  border-radius: var(--shb-radius) !important;
}
body.single-product .summary-inner form.cart .quantity .qty {
  background: transparent !important;
  color: var(--shb-text) !important;
}
body.single-product .summary-inner form.cart .quantity button {
  color: var(--shb-brown) !important;
}

body.single-product .summary form.cart {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  align-items: stretch !important;
}
body.single-product .summary form.cart > .quantity,
body.single-product .summary form.cart .woocommerce-variation-add-to-cart > .quantity {
  flex: 1 1 100% !important;
  order: 0 !important;
  justify-content: center !important;
  margin: 0 0 4px !important;
}
body.single-product .summary form.cart button.single_add_to_cart_button.button.alt {
  order: 2 !important;
  flex: 1 1 0 !important;
  min-height: 52px !important;
  padding: 0 18px !important;
  background: transparent !important;
  color: var(--shb-brown) !important;
  border: 2px solid var(--shb-brown) !important;
  border-radius: var(--shb-radius) !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  text-transform: none !important;
  box-shadow: none !important;
}
body.single-product .summary form.cart button.single_add_to_cart_button.button.alt:hover {
  background: var(--shb-brown) !important;
  color: #fff !important;
  border-color: var(--shb-brown) !important;
}
body.single-product .summary form.cart button.shb-buy-now-btn.button.alt {
  order: 1 !important;
  flex: 1 1 0 !important;
  min-height: 52px !important;
  padding: 0 18px !important;
  background: var(--shb-deep) !important;
  color: var(--shb-gold) !important;
  border: 2px solid var(--shb-gold) !important;
  border-radius: var(--shb-radius) !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  text-transform: none !important;
  box-shadow: none !important;
}
body.single-product .summary form.cart button.shb-buy-now-btn.button.alt:hover {
  background: #7a5529 !important;
  color: #e6c979 !important;
}
body.single-product .summary form.cart .shb-var-note {
  flex: 1 1 100% !important;
  order: 5 !important;
  margin: 2px 0 0 !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  background: var(--shb-ivory) !important;
  border: 1px solid var(--shb-brown) !important;
  color: var(--shb-text) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-align: center !important;
}
body.single-product .summary table.shop_attributes {
  margin-top: 18px !important;
}

/* Sticky bar on the product page (mobile and tablet). */
.shb-sticky-buy {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--shb-tb) + env(safe-area-inset-bottom, 0px));
  z-index: 9990;
  display: none;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fffdf9;
  border-top: 1px solid var(--shb-line);
  box-shadow: 0 -6px 18px rgba(58, 45, 31, .12);
}
.shb-sticky-buy.shb-sb-on { display: grid; }
.shb-sticky-buy .shb-sb-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--shb-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shb-sticky-buy .shb-sb-price del { font-size: 12px; opacity: .6; margin-inline-end: 6px; }
.shb-sticky-buy .shb-sb-cart {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 2px solid var(--shb-brown);
  border-radius: var(--shb-radius);
  color: var(--shb-brown) !important;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none !important;
  background: transparent;
}
.shb-sticky-buy .shb-sb-primary {
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--shb-radius);
  border: 2px solid var(--shb-gold);
  background: var(--shb-deep);
  color: var(--shb-gold);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

/* 5A. Coupon behind a link. */
body.woocommerce-cart .cart_totals .shb-deposit-box {
  margin: 12px 0 6px !important;
}
body.woocommerce-cart .shb-coupon-link {
  display: block;
  margin: 6px 0 12px;
  text-align: center;
  color: var(--shb-brown) !important;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline !important;
}
body.woocommerce-cart .cart-actions .coupon.shb-coupon-collapsed {
  display: none !important;
}
body.woocommerce-cart .wd-cart-action-row.shb-actions-empty {
  display: none !important;
}
body.woocommerce-cart .cart_totals .cart-totals-inner > h2 {
  font-size: 16px;
  margin: 0 0 10px;
  color: var(--shb-text);
}
body.woocommerce-cart .cart_totals tr.order-total th,
body.woocommerce-cart .cart_totals tr.order-total td {
  font-size: 17px;
  font-weight: 800;
  color: var(--shb-deep);
}

/* Sticky إتمام الطلب bar on the cart. */
.shb-sticky-cart {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--shb-tb) + env(safe-area-inset-bottom, 0px));
  z-index: 9990;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fffdf9;
  border-top: 1px solid var(--shb-line);
  box-shadow: 0 -6px 18px rgba(58, 45, 31, .12);
}
.shb-sticky-cart.shb-sc-on { display: flex; }
.shb-sticky-cart .shb-sc-amount {
  font-size: 14px;
  color: var(--shb-text);
  white-space: nowrap;
}
.shb-sticky-cart .shb-sc-amount strong { color: var(--shb-deep); font-size: 15px; }
.shb-sticky-cart .shb-sc-btn {
  flex: 0 0 auto;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
  border-radius: var(--shb-radius);
  border: 2px solid var(--shb-gold);
  background: var(--shb-deep);
  color: var(--shb-gold) !important;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none !important;
}

/* Cart redesign, phone and tablet. */
@media (max-width: 1024px) {
  body.woocommerce-cart .cart-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  body.woocommerce-cart .woocommerce-cart-form { order: 1; margin: 0; }
  body.woocommerce-cart .cart_totals { order: 2; width: 100% !important; float: none !important; }
  body.woocommerce-cart table.shop_table.cart {
    display: block;
    border: 0 !important;
    background: transparent !important;
  }
  body.woocommerce-cart table.shop_table.cart thead { display: none; }
  body.woocommerce-cart table.shop_table.cart tbody { display: block; }
  body.woocommerce-cart table.shop_table.cart td::before { display: none !important; content: none !important; }

  body.woocommerce-cart tr.cart_item {
    display: grid;
    grid-template-columns: 82px 1fr;
    grid-template-areas:
      "img name"
      "img price"
      "qty remove";
    gap: 4px 12px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--shb-line);
    border-radius: 16px;
    padding: 12px;
    margin: 0 0 12px !important;
  }
  body.woocommerce-cart tr.cart_item td {
    border: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }
  body.woocommerce-cart td.product-thumbnail { grid-area: img; }
  body.woocommerce-cart td.product-thumbnail img {
    width: 82px;
    height: 82px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
  }
  body.woocommerce-cart td.product-name {
    grid-area: name;
    font-size: 15px;
    font-weight: 800;
    color: var(--shb-text);
    line-height: 1.6;
  }
  body.woocommerce-cart td.product-name a { color: inherit !important; }
  body.woocommerce-cart td.product-price { display: none !important; }
  body.woocommerce-cart td.product-subtotal {
    grid-area: price;
    font-size: 16px;
    font-weight: 800;
    color: var(--shb-deep);
    justify-self: start;
  }
  body.woocommerce-cart td.product-quantity { grid-area: qty; justify-self: start; }
  body.woocommerce-cart td.product-quantity .quantity {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--shb-ivory);
    border-radius: 10px;
    padding: 2px 6px;
  }
  body.woocommerce-cart td.product-remove { grid-area: remove; justify-self: end; }
  body.woocommerce-cart td.product-remove a.remove {
    display: inline-block;
    color: var(--shb-brown) !important;
    text-decoration: underline !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
    line-height: 1.4 !important;
    font-size: 0 !important;
  }
  body.woocommerce-cart td.product-remove a.remove::before {
    content: "حذف";
    font-size: 13px;
    font-weight: 700;
  }

  body.woocommerce-cart .cart_totals,
  body.woocommerce-cart .cart_totals .cart-totals-inner {
    background: #fff;
    border: 1px solid var(--shb-line);
    border-radius: 16px;
    padding: 14px;
  }
  body.woocommerce-cart .cart_totals table.shop_table {
    border: 0 !important;
    margin: 0;
  }
  body.woocommerce-cart .cart_totals table.shop_table th,
  body.woocommerce-cart .cart_totals table.shop_table td {
    border: 0 !important;
    padding: 7px 0 !important;
    font-size: 14px;
  }
  body.woocommerce-cart .woocommerce-shipping-totals .woocommerce-shipping-destination,
  body.woocommerce-cart .woocommerce-shipping-totals .shipping-calculator-button {
    display: none !important;
  }
}

/* 3. Checkout: country filled in as Egypt, kept in the form, out of sight. */
body.woocommerce-checkout #billing_country_field {
  display: none !important;
}
body.woocommerce-checkout #billing_phone_field .description {
  font-size: 12px;
  line-height: 1.6;
  color: #6b5a45;
}

/* 7. Error box. */
body.woocommerce-checkout .woocommerce-error .shb-first-missing {
  font-weight: 800;
  color: var(--shb-deep);
}
body.woocommerce-checkout .shb-other-in-cart {
  margin: 0 0 10px;
  padding: 10px 14px;
  background: var(--shb-ivory);
  border: 1px dashed var(--shb-brown);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--shb-text);
}

body.woocommerce-cart.shb-cart-js .cart_totals .wc-proceed-to-checkout {
  display: none !important;
}
body.woocommerce-cart .shb-continue-shopping {
  display: block;
  margin: 4px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--shb-brown) !important;
  text-decoration: underline !important;
}

@media (max-width: 1024px) {
  /* Leave room for the site's floating visual-search button at the bottom left. */
  .shb-sticky-buy,
  .shb-sticky-cart {
    padding-inline-end: 72px;
  }
}

/* Narrow phones: the sticky bar has to hold a price, the cart and a button
   next to the floating visual-search bubble without clipping the price. */
@media (max-width: 480px) {
  .shb-sticky-buy,
  .shb-sticky-cart { gap: 6px; padding-inline-start: 10px; padding-inline-end: 66px; }
  .shb-sticky-buy .shb-sb-price { font-size: 12.5px; }
  .shb-sticky-buy .shb-sb-price del { font-size: 10.5px; }
  .shb-sticky-buy .shb-sb-cart { padding: 6px 10px; font-size: 12px; gap: 3px; }
  .shb-sticky-buy .shb-sb-primary { padding: 0 12px; font-size: 13px; }
}
