/* ============================================
   Mobile cart compactness (cart page only)
   Desktop layout intentionally unchanged.
   ============================================ */

@media (max-width: 767px) {
  body.woocommerce-cart .site-main,
  body.woocommerce-cart .content-area,
  body.woocommerce-cart .woocommerce {
    padding-left: 0;
    padding-right: 0;
  }

  body.woocommerce-cart .woocommerce {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Tighten top spacing (theme adds large page-header + site-content padding) */
  body.woocommerce-cart .site-content-wrapper .site-content,
  body.woocommerce-cart .site-content {
    padding-top: 12px !important;
    padding-bottom: 16px !important;
  }

  body.woocommerce-cart .page-header-content {
    margin: 0 0 10px !important;
    padding: 0 !important;
  }

  body.woocommerce-cart .page-header-content .woocommerce-breadcrumb,
  body.woocommerce-cart .woocommerce-breadcrumb {
    margin: 0 0 2px !important;
    padding: 0 !important;
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
  }

  body.woocommerce-cart .page-header-content .page-title,
  body.woocommerce-cart .page-title,
  body.woocommerce-cart h1.entry-title,
  body.woocommerce-cart .kitify-post-title,
  body.woocommerce-cart .elementor-heading-title,
  body.woocommerce-cart .elementor-widget-heading .elementor-heading-title {
    font-size: 1.45rem !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.15 !important;
  }

  body.woocommerce-cart .elementor-section,
  body.woocommerce-cart .elementor-widget:not(:last-child) {
    margin-bottom: 0 !important;
  }

  body.woocommerce-cart .elementor-element.elementor-widget-woocommerce-cart-page,
  body.woocommerce-cart .woocommerce {
    margin-top: 0 !important;
  }

  /* Flatten classic responsive table into compact rows */
  body.woocommerce-cart table.shop_table_responsive.cart,
  body.woocommerce-cart table.shop_table.cart {
    display: block !important;
    border: 0 !important;
    margin: 0 0 4px !important;
  }

  body.woocommerce-cart table.shop_table.cart thead {
    display: none;
  }

  body.woocommerce-cart table.shop_table.cart tbody,
  body.woocommerce-cart table.shop_table.cart tr,
  body.woocommerce-cart table.shop_table.cart td {
    display: block;
    width: 100%;
  }

  body.woocommerce-cart table.shop_table.cart tr.cart_item {
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb name name"
      "thumb price qty";
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
    padding: 8px 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border-light, #e0e0e0) !important;
    background: transparent !important;
    min-height: 0 !important;
  }

  body.woocommerce-cart table.shop_table.cart tr.cart_item td {
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: left !important;
    background: transparent !important;
    float: none !important;
    clear: none !important;
    min-height: 0 !important;
    line-height: 1.25 !important;
  }

  body.woocommerce-cart table.shop_table.cart tr.cart_item td::before {
    display: none !important;
    content: none !important;
  }

  body.woocommerce-cart .cart_item .product-thumbnail {
    grid-area: thumb;
    grid-row: 1 / span 2;
    width: 64px !important;
    align-self: center;
  }

  body.woocommerce-cart .cart_item .product-thumbnail a,
  body.woocommerce-cart .cart_item .product-thumbnail img {
    display: block;
    width: 64px !important;
    max-width: 64px !important;
    height: 64px !important;
    object-fit: contain;
    margin: 0 !important;
    border-radius: 8px;
  }

  body.woocommerce-cart .cart_item .product-name {
    grid-area: name;
    display: block !important;
    float: none !important;
    font-size: 0.95rem !important;
    font-weight: 700;
    line-height: 1.2 !important;
    color: var(--color-gray-dark, #333);
  }

  body.woocommerce-cart .cart_item .product-name > a:not(.remove),
  body.woocommerce-cart table.shop_table.cart .product-name a:not(.remove) {
    display: inline !important;
    float: none !important;
    color: inherit !important;
    text-decoration: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
  }

  /* Theme adds a large margin-top on .remove — force it compact */
  body.woocommerce-cart .cart_item .product-name .remove,
  body.woocommerce-cart table.shop_table.cart .product-name a.remove {
    display: block !important;
    width: fit-content !important;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: var(--color-gray-text, #555) !important;
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: underline !important;
    line-height: 1.2 !important;
    float: none !important;
    position: static !important;
  }

  body.woocommerce-cart .cart_item .product-name .remove:hover,
  body.woocommerce-cart .cart_item .product-name .remove:focus {
    color: var(--color-primary, #83b020) !important;
  }

  /* Price + qty share one row */
  body.woocommerce-cart .cart_item .product-price {
    grid-area: price;
    display: block !important;
    font-size: 0.92rem !important;
    font-weight: 700;
    line-height: 1.2 !important;
    color: var(--color-gray-dark, #333);
  }

  body.woocommerce-cart .cart_item .product-quantity {
    grid-area: qty;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.woocommerce-cart .cart_item .product-quantity .quantity {
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    width: auto !important;
    max-width: none !important;
    height: 30px !important;
    min-height: 30px !important;
    position: relative;
  }

  body.woocommerce-cart .cart_item .product-quantity .qty-button,
  body.woocommerce-cart .cart_item .product-quantity .minus,
  body.woocommerce-cart .cart_item .product-quantity .plus,
  body.woocommerce-cart .cart_item .product-quantity .qty-btn {
    width: 26px !important;
    height: 30px !important;
    min-height: 30px !important;
    line-height: 30px !important;
    padding: 0 !important;
    font-size: 13px !important;
  }

  body.woocommerce-cart .cart_item .product-quantity .qty {
    width: 40px !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 4px !important;
    margin: 0 !important;
    border: 1px solid var(--color-gray-border, #d3d3d3) !important;
    border-radius: 6px !important;
    text-align: center;
    font-size: 0.88rem !important;
    background: #fff;
    line-height: 30px !important;
  }

  /* Hide line subtotal on mobile — unit price is enough in compact view */
  body.woocommerce-cart .cart_item .product-subtotal {
    display: none !important;
  }

  /* Actions row: hide update button; collapse coupon */
  body.woocommerce-cart table.shop_table.cart tr.cart_item + tr,
  body.woocommerce-cart table.shop_table.cart td.actions {
    display: block;
    padding: 10px 0 0 !important;
    border: 0 !important;
  }

  body.woocommerce-cart table.shop_table.cart td.actions .button[name="update_cart"] {
    display: none !important;
  }

  body.woocommerce-cart .coupon {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body.woocommerce-cart .coupon label {
    display: none;
  }

  body.woocommerce-cart .ksupps-coupon-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0 !important;
    padding: 6px 0 !important;
    border: 0;
    background: transparent;
    color: var(--color-gray-text, #555);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
  }

  body.woocommerce-cart .ksupps-coupon-toggle::before {
    content: "";
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid currentColor;
    transition: transform 0.2s ease;
  }

  body.woocommerce-cart .ksupps-coupon-toggle.is-open::before {
    transform: rotate(90deg);
  }

  body.woocommerce-cart .ksupps-coupon-fields {
    display: none;
    gap: 8px;
    margin: 0 0 8px;
  }

  body.woocommerce-cart .ksupps-coupon-fields.is-open {
    display: flex;
    flex-wrap: wrap;
  }

  body.woocommerce-cart .ksupps-coupon-fields .input-text {
    flex: 1 1 160px;
    min-height: 42px;
    margin: 0;
  }

  body.woocommerce-cart .ksupps-coupon-fields .button {
    flex: 0 0 auto;
    min-height: 42px;
  }

  /* Free shipping progress — also shown above product list on mobile via order */
  body.woocommerce-cart .cart_totals .ksupps-fs-progress {
    margin: 0 0 14px;
  }

  body.woocommerce-cart .ksupps-fs-progress {
    margin: 8px 0 10px !important;
    padding: 10px 12px 8px !important;
    border-radius: 12px;
    background: #eef6df;
    color: var(--color-gray-dark, #333);
  }

  body.woocommerce-cart .woocommerce-cart-form > .ksupps-fs-progress {
    margin-top: 8px !important;
  }

  body.woocommerce-cart .ksupps-fs-progress.is-unlocked {
    background: #e4f4e2;
  }

  body.woocommerce-cart .ksupps-fs-progress__label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
  }

  body.woocommerce-cart .ksupps-fs-progress__icon {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--color-primary, #83b020);
  }

  body.woocommerce-cart .ksupps-fs-progress__track {
    height: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  body.woocommerce-cart .ksupps-fs-progress__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--color-primary, #83b020);
    transition: width 0.35s ease;
  }

  body.woocommerce-cart .ksupps-fs-progress__note {
    margin: 8px 0 0;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-gray-text, #555);
    line-height: 1.35;
  }

  /* Order totals — beat theme specificity */
  body.woocommerce-cart .cart-collaterals {
    margin-top: 4px;
    width: 100%;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals {
    width: 100% !important;
    float: none !important;
    padding: 12px;
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: 12px;
    background: #fafafa;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals > h2 {
    margin: 0 0 10px;
    font-size: 1.02rem;
    font-weight: 700;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table,
  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tbody {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 2px 12px;
    width: 100% !important;
    padding: 8px 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #ececec !important;
    background: transparent !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr th,
  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr td {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 0.92rem;
    line-height: 1.3;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr th {
    grid-column: 1;
    font-weight: 600;
    text-align: left !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr td {
    grid-column: 2;
    text-align: right !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr td::before,
  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr th::before {
    display: none !important;
    content: none !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.woocommerce-shipping-totals {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label methods"
      "notes notes";
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.woocommerce-shipping-totals th {
    grid-area: label;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.woocommerce-shipping-totals td {
    grid-area: notes;
    grid-column: 1 / -1;
    text-align: left !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.order-total {
    border-bottom: 0 !important;
    padding-top: 10px !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.order-total th,
  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.order-total td {
    font-size: 1.02rem;
    font-weight: 700;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals .woocommerce-shipping-methods {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals .woocommerce-shipping-methods li {
    margin: 0;
    padding: 0;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals .woocommerce-shipping-destination {
    margin: 0 0 2px !important;
    padding: 0 !important;
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
    color: var(--color-gray-text, #555);
  }

  /* Keep shipping label + cost on one visual row */
  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.woocommerce-shipping-totals {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label methods"
      "notes notes";
  }

  body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr.woocommerce-shipping-totals td {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals .woocommerce-shipping-methods {
    justify-content: flex-start;
    margin: 0 !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals .shipping-calculator-button {
    font-size: 0.8rem;
    line-height: 1.3;
    text-decoration: underline;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals .shipping-calculator-form {
    margin-top: 8px !important;
  }

  /* Original checkout slot: keep space so layout doesn't jump; button itself floats */
  body.woocommerce-cart .cart-collaterals .cart_totals .wc-proceed-to-checkout {
    display: none !important;
  }

  body.woocommerce-cart.ksupps-has-floating-checkout {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.woocommerce-cart .ksupps-floating-checkout {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100040;
    display: block;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border-light, #e0e0e0);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  body.woocommerce-cart .ksupps-floating-checkout .checkout-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin: 0 !important;
    border-radius: 8px;
    background: #111 !important;
    border-color: #111 !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    text-decoration: none !important;
  }

  body.woocommerce-cart .ksupps-floating-checkout .checkout-button:hover,
  body.woocommerce-cart .ksupps-floating-checkout .checkout-button:focus {
    background: #000 !important;
    color: #fff !important;
  }

  /* Compact qty +/- controls from theme */
  body.woocommerce-cart .cart_item .quantity {
    position: relative;
    width: auto;
    max-width: 110px;
  }

  body.woocommerce-cart .cart_item .quantity .qty-button {
    width: 28px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 14px !important;
  }

  /* Actions row: coupon is moved under checkout via JS */
  body.woocommerce-cart table.shop_table.cart td.actions {
    padding: 0 !important;
    min-height: 0 !important;
  }

  body.woocommerce-cart table.shop_table.cart tr.ksupps-actions-empty {
    display: none !important;
  }

  body.woocommerce-cart .cart_totals .coupon {
    margin-top: 4px;
  }

  /* Cross-sells below fold */
  body.woocommerce-cart .cross-sells {
    margin-top: 28px;
  }
}

/* Coupon toggle helper is unused on desktop */
@media (min-width: 768px) {
  body.woocommerce-cart .ksupps-coupon-toggle {
    display: none !important;
  }

  body.woocommerce-cart .ksupps-coupon-fields {
    display: contents;
  }

  body.woocommerce-cart .ksupps-fs-progress {
    margin: 16px 0 20px;
    padding: 16px 18px 14px;
    border-radius: 12px;
    background: #eef6df;
  }

  body.woocommerce-cart .ksupps-fs-progress.is-unlocked {
    background: #e4f4e2;
  }

  body.woocommerce-cart .ksupps-fs-progress__label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 600;
  }

  body.woocommerce-cart .ksupps-fs-progress__icon {
    color: var(--color-primary, #83b020);
  }

  body.woocommerce-cart .ksupps-fs-progress__track {
    height: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  body.woocommerce-cart .ksupps-fs-progress__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--color-primary, #83b020);
  }

  body.woocommerce-cart .ksupps-fs-progress__note {
    margin: 8px 0 0;
    font-size: 0.78rem;
    color: var(--color-gray-text, #555);
  }
}
