/**
 * Cart Page Modernisation – Custom Styles
 *
 * Override via functions-for-woo plugin.
 * Contains all cart page layout and styling.
 *
 * @package Functions-For-Woo
 */

/* ============================================
   START – Non‑empty Cart Page (Two‑column)
   ============================================ */

/* ── Two‑column layout ── */
.ffw-cart-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-items: flex-start;
  margin-top: 10px;
}

.ffw-cart-column-left {
  flex: 1 1 62%;
  min-width: 0;
}

.ffw-cart-column-right {
  flex: 1 1 33%;
  min-width: 280px;
}

/* Cart container + table always span full width */
.woocommerce .ffw-cart-column-left .cart_container {
  width: 100%;
}

.woocommerce .ffw-cart-column-left .cart_container table.shop_table.cart {
  width: 100%;
  table-layout: auto;
}

.woocommerce table.shop_table {
    border-collapse: collapse !important;
}

/* ── Thick bottom border on each cart item row ── */
.woocommerce-cart-form__cart-item.cart_item td {
  border-bottom: 2px solid #e5e5e5 !important;
}

/* ── Table header ── */
.woocommerce .ffw-cart-column-left .cart_container thead th {
  background: transparent;
  color: #222;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 12px;
  border-bottom: 1px solid #e5e5e5;
  text-align: left;
}

/* ── Table body cells ── */
.woocommerce .ffw-cart-column-left .cart_container td {
  padding: 18px 12px;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.woocommerce .ffw-cart-column-left .cart_container td.product-thumbnail-name {
  padding: 18px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}

.ffw-product-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ffw-product-thumb {
  flex: 0 0 auto;
}

.ffw-product-thumb img {
  max-width: 70px;
  height: auto;
  border-radius: 6px;
  display: block;
}

.ffw-product-details {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 600;
  font-size: 16px;
}

.ffw-product-details a {
  color: #222;
  text-decoration: none;
}

.ffw-product-details a:hover {
  color: var(--wooPrimary);
}

.woocommerce .ffw-cart-column-left .cart_container td.product-price,
.woocommerce .ffw-cart-column-left .cart_container td.product-quantity,
.woocommerce .ffw-cart-column-left .cart_container td.product-subtotal {
  text-align: left;
  font-weight: 700;
  color: var(--wooPrimary);
}

/* ── Pill‑shaped quantity selector ── */
.woocommerce .ffw-cart-column-left .cart_container .quantity {
  display: inline-flex;
  align-items: center;
  border: 1px solid #a09999;
  border-radius: 30px;
  overflow: hidden;
  background: #fff;
  height: 48px;
}

.woocommerce .ffw-cart-column-left .cart_container .quantity .woo-minus,
.woocommerce .ffw-cart-column-left .cart_container .quantity .woo-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 48px;
  margin: 0;
  border: none !important;
  background: transparent !important;
  color: var(--wooPrimary) !important;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
  border-radius: 0 !important;
  line-height: 1;
  outline: none !important;
}

.woocommerce .ffw-cart-column-left .cart_container .quantity .woo-minus::before {
  font-family: FontAwesome;
  content: "\f068";
  font-size: 12px;
}

.woocommerce .ffw-cart-column-left .cart_container .quantity .woo-plus::before {
  font-family: FontAwesome;
  content: "\f067";
  font-size: 12px;
}

.woocommerce .ffw-cart-column-left .cart_container .quantity .woo-minus:hover,
.woocommerce .ffw-cart-column-left .cart_container .quantity .woo-plus:hover {
  background: #f0f0f0 !important;
  color: #333 !important;
}

.woocommerce .ffw-cart-column-left .cart_container .quantity .qty {
  width: 56px;
  height: 48px;
  border: none;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  -moz-appearance: textfield;
  padding: 0;
  margin: 0;
  background: #fff;
}

.woocommerce .ffw-cart-column-left .cart_container .quantity .qty::-webkit-inner-spin-button,
.woocommerce .ffw-cart-column-left .cart_container .quantity .qty::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Circular remove button (rightmost column) ── */
.woocommerce .ffw-cart-column-left .cart_container td.product-remove {
  width: 60px;
  text-align: center;
}

.woocommerce .ffw-cart-column-left .cart_container td.product-remove a.remove,
.woocommerce .ffw-cart-column-left .cart_container a.remove.ffw-remove-icon,
.woocommerce .cart_container td.product-remove a.remove,
.woocommerce table.cart td.product-remove a.remove,
.woocommerce a.remove.remove_from_cart_button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 45px !important;
  height: 45px !important;
  border: 1.5px solid #ccc !important;
  border-radius: 50% !important;
  color: #999 !important;
  background: #fff !important;
  font-size: 22px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  padding: 0 0 3px 0 !important;
  margin: 0 !important;
  transition: all 0.25s ease !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
}

.woocommerce .ffw-cart-column-left .cart_container td.product-remove a.remove:hover,
.woocommerce .ffw-cart-column-left .cart_container a.remove.ffw-remove-icon:hover,
.woocommerce .cart_container td.product-remove a.remove:hover,
.woocommerce table.cart td.product-remove a.remove:hover,
.woocommerce a.remove.remove_from_cart_button:hover {
  background: var(--wooSecondary) !important;
  border-color: var(--wooSecondary) !important;
  color: #fff !important;
}

@media (min-width: 769px) {
  .woocommerce .ffw-cart-column-left .cart_container td.product-remove a.remove,
  .woocommerce .ffw-cart-column-left .cart_container a.remove.ffw-remove-icon,
  .woocommerce .cart_container td.product-remove a.remove {
    padding-top: 2px !important;
  }
}

/* ── Actions row (coupon left + update cart right) ── */
.woocommerce .ffw-cart-column-left .cart_container td.actions {
  border-bottom: none;
}

.ffw-actions-row {
  width: 100%;
}

.ffw-actions-left {
  width: 100%;
}

/* Override legacy global coupon styles that break the side‑by‑side layout */
.woocommerce .ffw-cart-column-left .cart_container .shop_table .actions .coupon {
  width: 100% !important;
}
.woocommerce .ffw-cart-column-left .cart_container .shop_table .actions .coupon input {
  width: auto !important;
  float: none !important;
}
.woocommerce .ffw-cart-column-left .cart_container .shop_table .actions .coupon button {
  width: auto !important;
  float: none !important;
}
.woocommerce .ffw-cart-column-left .cart_container .shop_table td.actions .button {
  float: none !important;
}

/* Coupon label */
.ffw-coupon-label {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: #000000;
  margin-bottom: 10px;
  text-align: left;
}

/* Coupon row — coupon fields left, update cart right */
.ffw-coupon-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 60px;
  flex-wrap: nowrap !important;
  width: 100%;
}

.ffw-coupon-fields {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

/* Update cart button inside coupon-row — pushed to the right via space-between */
.woocommerce .ffw-cart-column-left .cart_container .ffw-coupon-row button[name="update_cart"] {
  flex: 0 0 auto;
}

.woocommerce .ffw-cart-column-left .cart_container .coupon input#coupon_code {
  flex: 1 1 180px;
  min-width: 120px;
  padding: 12px 16px;
  border: 1px solid #000000;
  border-radius: 6px;
  font-size: 14px;
  color: black;
  outline: none;
  background: #fff;
  height: auto;
  min-height: 48px;
  width: auto !important;
  float: none !important;
}

.woocommerce .ffw-cart-column-left .cart_container .coupon input#coupon_code::placeholder {
  color: #999;
  opacity: 1;
}

.woocommerce .ffw-cart-column-left .cart_container .coupon input#coupon_code:focus {
  border-color: var(--wooPrimary);
}

.woocommerce .ffw-cart-column-left .cart_container .coupon button.button {
  height: 48px;
  padding: 0 28px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 6px !important;
  background: var(--wooPrimary) !important;
  color: #fff !important;
  white-space: nowrap;
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  line-height: 48px !important;
}

.woocommerce .ffw-cart-column-left .cart_container .coupon button.button:hover {
  background: var(--wooSecondary) !important;
}

/* ── Update Cart button (outline/ghost style) ── */
.woocommerce .ffw-cart-column-left .cart_container .ffw-coupon-row button[name="update_cart"],
.woocommerce .ffw-cart-column-left .cart_container td.actions button[name="update_cart"] {
  height: 48px;
  padding: 0 28px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 2px solid var(--wooPrimary) !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--wooPrimary) !important;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0;
  line-height: 44px !important;
  white-space: nowrap;
}

.woocommerce .ffw-cart-column-left .cart_container td.actions button[name="update_cart"]:hover {
  background: var(--wooSecondary) !important;
  border-color: var(--wooSecondary) !important;
  color: #fff !important;
}

/* ── Summary box (right column) ── */
.ffw-cart-totals.cart_totals {
  width: 100% !important;
  float: none !important;
  border: 1px solid #222;
  padding: 42px 42px 50px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Summary heading */
.ffw-cart-totals h2 {
  display: block !important;
  font-size: 22px;
  font-weight: 700;
  color: #000;
  margin: 0 0 20px;
  padding: 0 0 14px;
  text-align: left;
}

/* Totals table inside summary */
.ffw-cart-totals .shop_table {
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  width: 100%;
}

.ffw-cart-totals .shop_table tr {
  border: none;
}

.ffw-cart-totals .shop_table tr.cart-subtotal,
.ffw-cart-totals .shop_table tr.cart-discount,
.ffw-cart-totals .shop_table tr.shipping,
.ffw-cart-totals .shop_table tr.fee,
.ffw-cart-totals .shop_table tr.tax-rate,
.ffw-cart-totals .shop_table tr.tax-total {
  border-bottom: 1px solid #e5e5e5;
}

.ffw-cart-totals .shop_table th,
.ffw-cart-totals .shop_table td {
  background: transparent !important;
  border: none !important;
  padding: 10px 0;
  font-size: 15px;
  vertical-align: top;
}

.ffw-cart-totals .shop_table th {
  font-weight: 600;
  color: #444;
  text-align: left;
  width: 50%;
}

.ffw-cart-totals .shop_table td {
  text-align: right;
  font-weight: 600;
  color: var(--wooPrimary);
}

/* Shipping row td left-aligned for calculator */
.ffw-cart-totals .shop_table tr.shipping td {
  text-align: left;
  color: var(--wooPrimary);
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

/* Prevent long shipping destinations from breaking the summary layout */
.ffw-cart-totals .woocommerce-shipping-destination {
  word-break: break-word;
  overflow-wrap: break-word;
}

.ffw-cart-totals .shop_table tr.shipping td small {
  display: block;
  color: #888;
  font-size: 13px;
  font-weight: 400;
  margin-top: 4px;
}

.ffw-cart-totals .shop_table tr.shipping td a {
  color: var(--wooPrimary);
  font-size: 13px;
  text-decoration: underline;
}

/* Shipping calculator row – spans both columns via colspan="2" */
.ffw-cart-totals .shop_table tr.shipping-calculator td {
  text-align: left;
  padding: 10px 0;
}

/* Shipping calculator toggle button */
.ffw-cart-totals .shipping-calculator-button {
  color: var(--wooPrimary) !important;
  font-weight: 600;
  text-decoration: underline;
}

/* Shipping calculator form inside summary – left-aligned */
.ffw-cart-totals .shipping-calculator-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
}

.ffw-cart-totals .shipping-calculator-form p {
  margin: 0 0 3px;
  text-align: left;
}

.ffw-cart-totals .shipping-calculator-form p label {
  text-align: left;
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #444;
  margin-bottom: 4px;
}

.ffw-cart-totals .shipping-calculator-form select,
.ffw-cart-totals .shipping-calculator-form input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #444;
  background: #fff;
  height: auto;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ffw-cart-totals .shipping-calculator-form input#calc_shipping_city,
.ffw-cart-totals .shipping-calculator-form input#calc_shipping_postcode {
  padding-block: 20px;
}

.ffw-cart-totals .shipping-calculator-form input::placeholder {
  color: #999;
  opacity: 1;
}

/* Allow long country names to wrap inside shipping calculator selects */
.ffw-cart-totals .shipping-calculator-form select option {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* Allow long country names to wrap inside Select2 rendered element */
.ffw-cart-totals .shipping-calculator-form .select2-container .select2-selection--single {
  display: flex;
  align-items: center;
  height: auto !important;
  min-height: 44px;
  border-radius: 8px !important;
  border: 1px solid #4b4b4b !important;
  padding-inline: 5px;
}

.ffw-cart-totals .shipping-calculator-form .select2-container .select2-selection--single .select2-selection__arrow {
  height: 44px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.ffw-cart-totals .shipping-calculator-form .select2-selection__placeholder {
  color: #999;
}

.ffw-cart-totals .shipping-calculator-form .select2-selection__rendered {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: break-word;
  height: auto !important;
  line-height: 1.4 !important;
  padding-right: 28px !important;
}

.ffw-cart-totals .shipping-calculator-form select:focus,
.ffw-cart-totals .shipping-calculator-form input:focus {
  outline: none;
  border-color: var(--wooPrimary);
}

.ffw-cart-totals .shipping-calculator-form button.button {
  width: auto;
  padding: 12px 24px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  background: #000 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .ffw-cart-totals .shipping-calculator-form button.button {
    width: 100%;
    padding: 12px !important;
  }
}

.ffw-cart-totals .shipping-calculator-form button.button:hover {
  background: #333 !important;
}

/* Order total row */
.ffw-cart-totals .shop_table tr.order-total th,
.ffw-cart-totals .shop_table tr.order-total td {
  padding-top: 16px;
  padding-bottom: 4px;
  font-size: 18px;
  font-weight: 400;
}

.ffw-cart-totals .shop_table tr.order-total th {
  color: #000;
}

.ffw-cart-totals .shop_table tr.order-total td {
  color: var(--wooPrimary);
  font-size: 20px;
}

/* Divider below total */
.ffw-cart-totals .shop_table tr.order-total + tr,
.ffw-cart-totals .shop_table tr.order-total {
  border-bottom: none;
}
.ffw-cart-totals .ffw-total-divider {
  width: 100%;
  height: 1px;
  background: #ccc;
  margin: 10px 0 0;
}

/* ── Checkout button ── */
.ffw-cart-totals .wc-proceed-to-checkout {
  padding: 0;
  margin-top: 20px;
  text-align: center;
}

.ffw-cart-totals .wc-proceed-to-checkout a.checkout-button {
  display: block;
  width: 100%;
  padding: 16px 20px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff !important;
  background: var(--wooPrimary) !important;
  border: none !important;
  border-radius: var(--border-radius) !important;
  text-align: center;
  line-height: 1.4 !important;
  transition: background 0.3s ease;
  float: none !important;
  max-width: none !important;
}

.ffw-cart-totals .wc-proceed-to-checkout a.checkout-button:hover {
  background: var(--wooSecondary) !important;
}

/* Cross-sells in left column */
.woocommerce .ffw-cart-column-left .cart-collaterals {
  width: 100%;
  margin-top: 30px;
}

.woocommerce .ffw-cart-column-left .cart-collaterals .cross-sells {
  width: 100%;
  float: none;
}

.woocommerce .ffw-cart-column-left .cart-collaterals .cross-sells h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── Fix conflicting legacy styles ── */
.woocommerce .ffw-cart-totals.cart_totals .shop_table th {
  border-right: none !important;
  font-weight: 400 !important;
}

/* ── Shipping calculator: mobile override ── */
/* WooCommerce smallscreen.css sets all td::before to show data-title.
   Our shipping-calculator <td> has no data-title, so hide the pseudo. */
.woocommerce .ffw-cart-totals table.shop_table_responsive tbody tr.shipping-calculator td::before,
.woocommerce-page .ffw-cart-totals table.shop_table_responsive tbody tr.shipping-calculator td::before {
  content: none !important;
}

/* ============================================
   END – Non‑empty Cart Page (Two‑column)
   ============================================ */

/* ============================================
   START - Empty Cart Page
   ============================================ */

.ffw-empty-cart-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  text-align: center;
}

/* Empty cart content container */
.ffw-empty-cart-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Cart illustration */
.ffw-empty-cart-icon {
  margin-bottom: 30px;
  position: relative;
}

.ffw-cart-image {
  width: 220px;
  height: 200px;
  background: url('../../images/cart-empty-icon.png') no-repeat center center;
  background-size: contain;
  opacity: 0.7;
}

/* Headline */
.ffw-empty-cart-headline {
  font-size: 28px;
  font-weight: 600;
  color: #000;
  margin: 0 0 30px;
  line-height: 1.3;
}

/* ============================================
   END - Empty Cart Page
   ============================================ */

/* Go Shopping button */
.woocommerce .ffw-go-shopping-btn,
.ffw-go-shopping-btn {
  display: inline-block;
  padding: 8px 40px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #fff !important;
  background: var(--wooPrimary) !important;
  border: none !important;
  border-radius: 30px !important;
  cursor: pointer;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: 0.5px;
  transition: background 0.3s ease;
  line-height: 1.4 !important;
  width: 200px;
}

.woocommerce .ffw-go-shopping-btn:hover,
.ffw-go-shopping-btn:hover {
  background: var(--wooSecondary) !important;
  color: #fff !important;
}