/* Cart page */

.ms-cart-page,
.woocommerce-cart .woocommerce-notices-wrapper,
.woocommerce-cart .cart-empty,
.woocommerce-cart .return-to-shop {
  width: min(100% - var(--ms-container-gutter), var(--ms-container));
  max-width: none;
}

.woocommerce-cart .ms-main,
.ms-cart-page {
  padding: 58px 0 88px;
}

.ms-cart-page__header {
  margin-bottom: 36px;
}

.ms-cart-table-wrap {
  overflow-x: auto;
}

.ms-cart-table,
.woocommerce table.shop_table.ms-cart-table,
.ms-cart-totals table.shop_table {
  width: 100%;
  border: 0;
  border-collapse: collapse;
  background: transparent;
}

.ms-cart-table thead th {
  padding: 0 12px 14px;
  border-bottom: 1px solid rgba(31, 41, 48, 0.2);
  color: var(--ms-color-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
}

.ms-cart-table td {
  padding: 24px 12px;
  border-bottom: 1px solid rgba(31, 41, 48, 0.14);
  vertical-align: middle;
  font-size: 13px;
}

.ms-cart-table .product-remove {
  width: 34px;
  padding-left: 0;
  text-align: center;
}

.ms-cart-remove,
.woocommerce a.remove.ms-cart-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--ms-color-text) !important;
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
}

.ms-cart-remove:hover,
.woocommerce a.remove.ms-cart-remove:hover {
  background: var(--ms-color-text);
  color: #fff !important;
}

.ms-cart-table .product-thumbnail {
  width: 96px;
}

.ms-cart-table .product-thumbnail img {
  width: 58px;
  height: auto;
  aspect-ratio: 7 / 10;
  object-fit: contain;
  background: var(--ms-color-product-bg);
}

.ms-cart-table .product-name {
  min-width: 220px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ms-cart-table .product-name a {
  color: var(--ms-color-text);
}

.ms-cart-table .product-price,
.ms-cart-table .product-subtotal {
  white-space: nowrap;
  color: var(--ms-color-muted);
}

.ms-cart-table .product-subtotal {
  font-weight: 700;
  color: var(--ms-color-text);
}

.quantity {
  display: inline-flex;
  align-items: stretch;
  min-height: 38px;
  background: var(--ms-color-input);
}

.quantity .qty {
  width: 52px;
  min-height: 38px;
  border: 0;
  padding: 0 6px;
  background: transparent;
  text-align: center;
}

.ms-qty-button {
  width: 34px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--ms-color-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
}

.ms-qty-button:hover {
  background: rgba(31, 41, 48, 0.08);
}

.ms-cart-actions-row td {
  border-bottom: 0;
  padding: 26px 0 0;
}

.ms-cart-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.ms-cart-coupon {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 10px;
}

.ms-cart-coupon div {
  display: flex;
  align-items: start;
  gap: 10px;
}

.ms-cart-coupon .input-text {
  min-width: 230px;
}

.ms-cart-coupon .coupon-error-notice {
  font-size: 13px !important;
}

.ms-cart-lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  gap: clamp(28px, 4vw, 54px);
  align-items: start;
}

:where(.woocommerce)
  .select2-container
  .select2-selection--single
  .select2-selection__rendered {
  padding-bottom: 0 !important;
  padding-top: 0 !important;
}

.ms-cart-shipping-box,
.ms-cart-totals {
  padding: 30px 28px;
}

.ms-cart-shipping-box h2,
.ms-cart-totals h2 {
  margin: 0 0 22px;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ms-shipping-calculator p {
  margin: 0 0 12px;
}

.ms-shipping-calculator .shipping-calculator-button {
  display: inline-block;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ms-cart-shipping-box input,
.ms-cart-shipping-box select,
.ms-cart-coupon .input-text {
  width: 100%;
  min-height: 42px;
  border: 0;
  padding: 0 14px;
  background: var(--ms-color-input);
  font-family: inherit;
}

.ms-cart-totals table th,
.ms-cart-totals table td {
  padding: 14px 0;
  border-bottom: 1px solid rgba(31, 41, 48, 0.14);
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.ms-cart-totals table th {
  width: 34%;
}

.ms-cart-totals table td {
  width: 66%;
}

.ms-cart-totals table td {
  text-align: right;
}

.ms-cart-totals .order-total th,
.ms-cart-totals .order-total td {
  padding-top: 20px;
  border-bottom: 0;
  font-size: 16px;
  font-weight: 700;
}

.ms-cart-totals .woocommerce-shipping-methods {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ms-cart-totals .woocommerce-shipping-methods li {
  margin-bottom: 8px;
}

.ms-cart-totals .woocommerce-shipping-destination {
  margin-top: 12px;
  color: var(--ms-color-muted);
  font-size: 12px;
  text-align: left;
}

.ms-cart-totals .woocommerce-shipping-calculator,
.ms-cart-totals .shipping-calculator-button {
  display: none !important;
}

.ms-proceed-to-checkout {
  margin-top: 24px;
}

.ms-proceed-to-checkout .checkout-button,
.woocommerce .ms-proceed-to-checkout .checkout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 0;
  background: var(--ms-color-green-dark) !important;
  color: var(--ms-color-text) !important;
  font-family: var(--ms-font-mono) !important;
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1rem;
  text-transform: uppercase;
}

.woocommerce-cart .woocommerce-notices-wrapper {
  margin: 24px auto 0;
  padding: 0;
}

.woocommerce-cart .cart-empty,
.woocommerce-cart .return-to-shop {
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}

.woocommerce-cart .cart-empty {
  padding-left: 16px !important;
}

.woocommerce .ms-cart-collaterals .ms-cart-totals {
  width: 100% !important;
  float: none;
}

.ms-free-shipping-notification {
  margin-top: 0;
  font-weight: 600;
  padding: 1rem;
  text-align: center;
  background-color: var(--ms-color-cream);
}

@media (max-width: 900px) {
  .ms-cart-lower {
    grid-template-columns: 1fr;
  }

  .ms-cart-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ms-cart-coupon {
    align-items: stretch;
    flex-direction: column;
  }

  .ms-cart-update {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .woocommerce table.shop_table_responsive.ms-cart-table thead {
    display: none;
  }

  .woocommerce table.shop_table_responsive.ms-cart-table tr {
    display: block;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(31, 41, 48, 0.18);
    background: rgba(255, 255, 255, 0.28);
  }

  .woocommerce table.shop_table_responsive.ms-cart-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    border-bottom: 1px solid rgba(31, 41, 48, 0.08);
    padding: 14px 12px;
    text-align: right !important;
  }

  /* .woocommerce table.shop_table_responsive.ms-cart-table td::before {
    content: attr(data-title);
    color: var(--ms-color-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: left;
    text-transform: uppercase;
  } */

  .woocommerce table.shop_table_responsive.ms-cart-table .product-remove,
  .woocommerce table.shop_table_responsive.ms-cart-table .product-thumbnail {
    justify-content: center;
  }

  .woocommerce
    table.shop_table_responsive.ms-cart-table
    .product-remove::before,
  .woocommerce
    table.shop_table_responsive.ms-cart-table
    .product-thumbnail::before,
  .woocommerce
    table.shop_table_responsive.ms-cart-table
    .ms-cart-actions-row
    td::before {
    display: none;
  }

  .ms-cart-actions-row {
    border-bottom: 0 !important;
  }

  .ms-cart-actions-row td {
    display: block !important;
  }
}

/* Full-width cart when rendered inside the WordPress Cart page content. */
.woocommerce-cart .ms-page-content .ms-cart-page,
.woocommerce-cart .ms-page-content .woocommerce-cart-form,
.woocommerce-cart .ms-page-content .ms-cart-table-wrap,
.woocommerce-cart .ms-page-content .ms-cart-lower {
  width: 100%;
  max-width: none;
}

.woocommerce-cart .ms-page-content .ms-cart-page {
  padding-top: 0;
}

@media (max-width: 900px) {
  .woocommerce .ms-cart-totals table.shop_table_responsive tr,
  .woocommerce-page .ms-cart-totals table.shop_table_responsive tr {
    display: table-row !important;
  }

  .woocommerce .ms-cart-totals table.shop_table_responsive td,
  .woocommerce-page .ms-cart-totals table.shop_table_responsive td {
    display: table-cell !important;
  }

  .ms-cart-table .ms-cart-actions .input-text,
  .ms-cart-table .ms-cart-actions button {
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  /* Hide the default cart table header */
  .woocommerce-cart-form table.cart thead {
    display: none;
  }

  /* Convert table to block layout */
  .woocommerce-cart-form table.cart,
  .woocommerce-cart-form table.cart tbody,
  .woocommerce-cart-form table.cart tr,
  .woocommerce-cart-form table.cart td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  /* Add space between products */
  .woocommerce-cart-form table.cart tr {
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
  }

  /* Make the image and removal button look good side-by-side */
  .woocommerce-cart-form table.cart td.product-remove,
  .woocommerce-cart-form table.cart td.product-name,
  .woocommerce-cart-form table.cart td.product-thumbnail {
    display: inline-block;
    width: auto;
    border: none;
    padding: 5px 0 15px 5px;
  }

  /* Align item name and details */

  .woocommerce-cart-form table.cart td.product-price,
  .woocommerce-cart-form table.cart td.product-quantity,
  .woocommerce-cart-form table.cart td.product-subtotal {
    border: none;
    padding: 5px 0;
    text-align: left;
  }

  /* Add labels before values (e.g., "Price: $20") using pseudo-elements */
  .woocommerce-cart-form table.cart td.product-price::before {
    content: "Price: ";
    font-weight: bold;
  }

  .woocommerce-cart-form table.cart td.product-subtotal::before {
    content: "Subtotal: ";
    font-weight: bold;
  }
  .woocommerce table.shop_table_responsive tr td.product-name {
    text-align: left !important;
  }

  .woocommerce table.shop_table_responsive tr td.product-thumbnail::before,
  .woocommerce-page table.shop_table_responsive tr td.product-thumbnail::before,
  .woocommerce table.shop_table_responsive tr td.product-name::before,
  .woocommerce-page table.shop_table_responsive tr td.product-name::before {
    content: "";
    display: none;
  }

  .woocommerce table.shop_table_responsive tr:nth-child(2n) td,
  .woocommerce-page table.shop_table_responsive tr:nth-child(2n) td {
    background-color: var(--ms-color-panel) !important;
  }

  .woocommerce table.shop_table_responsive tr td.product-price,
  .woocommerce table.shop_table_responsive tr td.product-quantity,
  .woocommerce table.shop_table_responsive tr td.product-subtotal {
    border: 0 !important;
    display: flex !important;
    text-align: right !important;
    justify-content: space-between;
    align-items: center;
  }

  .woocommerce table.shop_table_responsive tr:nth-last-child(-n + 2) {
    border: 0 !important;
  }
}
