/**
 * Cart Page Modernisation – Responsive Media Queries
 *
 * Override via functions-for-woo plugin.
 * Contains all cart page responsive breakpoints.
 *
 * @package Functions-For-Woo
 */

/* ============================================
   RESPONSIVE – Cart page breakpoints
   ============================================ */

/* Tablet: collapse columns below 1200px */
@media only screen and (max-width: 1200px) {
  .ffw-cart-columns {
    display: block;
  }

  .ffw-cart-column-left,
  .ffw-cart-column-right {
    width: 100%;
  }

  .ffw-cart-column-right {
    max-width: 480px;
    margin: 20px auto 0;
  }
}

/* Tablet / small desktop: summary drops below cart */
@media (max-width: 1180px) {
  .ffw-cart-columns {
    flex-direction: column;
    gap: 24px;
  }

  .ffw-cart-column-left {
    flex: 1 1 100%;
  }

  .ffw-cart-column-right {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* Mobile: stacked layout – keeps table row structure */
@media only screen and (max-width: 768px) {
  .ffw-cart-columns {
    gap: 20px;
    margin-top: 4px;
  }

  /* Stack coupon + update vertically on mobile */
  .ffw-coupon-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px;
  }

  .ffw-coupon-fields {
    flex-direction: column;
    width: 100%;
  }

  .woocommerce .ffw-cart-column-left .cart_container .ffw-coupon-row button[name="update_cart"] {
    width: 100%;
  }

  .woocommerce .ffw-cart-column-left .cart_container td.actions .coupon {
    width: 100% !important;
  }

  .woocommerce .ffw-cart-column-left .cart_container .coupon input#coupon_code {
    flex: 1 1 auto;
    width: 100% !important;
  }

  .woocommerce .ffw-cart-column-left .cart_container .coupon button.button {
    width: 100%;
  }

  .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"] {
    float: none;
    width: 100%;
    text-align: center;
  }

  /* Keep table row layout (no flex cards) */
  .woocommerce .ffw-cart-column-left .cart_container tbody .woocommerce-cart-form__cart-item {
    position: relative;
  }

  .woocommerce .ffw-cart-column-left .cart_container td.product-remove {
    position: absolute;
    top: 83px;
    right: 0px;
    width: auto;
    padding: 0;
    border: none;
  }

  .woocommerce-Price-amount.amount {
    padding-left: 5px;
  }

  .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 a.remove.remove_from_cart_button {
    width: 30px !important;
    height: 30px !important;
    font-size: 18px !important;
    line-height: 1 !important;
    padding: 0 0 1px 0 !important;
  }

  .woocommerce .ffw-cart-column-left .cart_container .ffw-product-thumb img {
    max-width: 65px;
  }

  .woocommerce .ffw-cart-column-left .cart_container .ffw-product-details {
    font-size: 14px;
  }

  /* Summary box adjustments */
  .ffw-cart-totals.cart_totals {
    padding: 20px 16px 18px;
    border-radius: 8px;
  }

  .ffw-cart-column-right {
    max-width: none;
  }

  .ffw-cart-totals h2 {
    font-size: 20px;
    margin-bottom: 14px;
    padding-bottom: 10px;
  }

  .ffw-cart-totals .shop_table th,
  .ffw-cart-totals .shop_table td {
    padding: 8px 0;
    font-size: 14px;
  }

  .ffw-cart-totals .shop_table tr.order-total th,
  .ffw-cart-totals .shop_table tr.order-total td {
    padding-top: 14px;
    font-size: 16px;
  }

  .ffw-cart-totals .shop_table tr.order-total td {
    font-size: 18px;
  }

  /* Checkout button */
  .ffw-cart-totals .wc-proceed-to-checkout a.checkout-button {
    padding: 14px 16px !important;
    font-size: 14px !important;
  }

  /* Stack shipping label above shipping methods on mobile */
  .ffw-cart-totals .shop_table tr.woocommerce-shipping-totals.shipping {
    display: block;
  }

  .ffw-cart-totals .shop_table tr.woocommerce-shipping-totals.shipping th,
  .ffw-cart-totals .shop_table tr.woocommerce-shipping-totals.shipping td {
    display: block;
    width: 100% !important;
    text-align: left;
    padding-left: 11px;
    padding-right: 0;
  }

  .ffw-cart-totals .shop_table tr.woocommerce-shipping-totals.shipping th {
    padding-bottom: 2px;
  }

  .ffw-cart-totals .shop_table tr.woocommerce-shipping-totals.shipping td {
    padding-top: 15px;
    text-align: left !important;
  }

  /* Prevent duplicate "Shipping" label from WooCommerce responsive td::before */
  .woocommerce .ffw-cart-totals table.shop_table_responsive tbody tr.woocommerce-shipping-totals.shipping td::before,
  .woocommerce-page .ffw-cart-totals table.shop_table_responsive tbody tr.woocommerce-shipping-totals.shipping td::before {
    content: none !important;
  }

  /* Hide the "Product" label text but keep the thumbnail and details visible */
  .woocommerce .ffw-cart-column-left .cart_container td.product-thumbnail-name::before {
    display: none;
  }
}

/* Small phones */
@media only screen and (max-width: 480px) {
  .ffw-cart-columns {
    gap: 16px;
  }

  .woocommerce .ffw-cart-column-left .cart_container thead {
    display: none;
  }

  .woocommerce .ffw-cart-column-left .cart_container td.product-thumbnail-name {
    width: 100%;
  }

  .ffw-product-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .ffw-product-details {
    text-align: center;
    font-size: 15px;
  }

  .woocommerce .ffw-cart-column-left .cart_container td.product-price,
  .woocommerce .ffw-cart-column-left .cart_container td.product-subtotal {
    font-size: 14px;
  }

  .woocommerce .ffw-cart-column-left .cart_container .quantity .qty {
    width: 36px;
    height: 36px;
  }

  .woocommerce .ffw-cart-column-left .cart_container .quantity .woo-minus,
  .woocommerce .ffw-cart-column-left .cart_container .quantity .woo-plus {
    width: 30px;
    height: 36px;
  }

  .ffw-cart-totals.cart_totals {
    padding: 16px 14px;
  }

  .ffw-cart-totals .shop_table tr.order-total th,
  .ffw-cart-totals .shop_table tr.order-total td {
    font-size: 16px;
  }

  .ffw-cart-totals .wc-proceed-to-checkout a.checkout-button {
    font-size: 14px !important;
    padding: 14px 16px !important;
  }
}
