/* v4.0.2: responsive product-card, filter, and checkout stability pass */

/* Product carousel/card alignment: products with no visible price still reserve price space. */
.woocommerce ul.products li.product,
.woocommerce .edd-product-section ul.products li.product,
.woocommerce .edd-carousel-viewport ul.products li.product {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100% !important;
}

.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
.woocommerce .edd-product-section ul.products li.product a.woocommerce-LoopProduct-link,
.woocommerce .edd-carousel-viewport ul.products li.product a.woocommerce-LoopProduct-link {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.woocommerce .edd-product-section .woocommerce-loop-product__title,
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  min-height: 3.1em !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

.woocommerce ul.products li.product .price,
.woocommerce .edd-product-section ul.products li.product .price {
  min-height: 28px !important;
  display: block !important;
  line-height: 1.15 !important;
}

.woocommerce ul.products li.product .price:empty::before,
.woocommerce .edd-product-section ul.products li.product .price:empty::before {
  content: "\00a0";
  display: block;
}

.woocommerce ul.products li.product .button,
.woocommerce .edd-product-section ul.products li.product .button,
.woocommerce .edd-carousel-viewport ul.products li.product .button {
  margin-top: auto !important;
  min-height: 52px !important;
  width: 100% !important;
}

/* Keep horizontal carousels responsive without oversized cards. */
.woocommerce .edd-product-section .edd-carousel-viewport ul.products li.product {
  flex-basis: clamp(230px, 22vw, 292px) !important;
  width: clamp(230px, 22vw, 292px) !important;
}

.woocommerce .edd-product-section .edd-carousel-viewport ul.products li.product img {
  height: clamp(170px, 15vw, 220px) !important;
  object-fit: contain !important;
  background: #fff !important;
}

/* Shop filter usability + iOS tap reliability. */
.edd-filter-actions {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.edd-filter-submit.button,
.edd-filter-reset.button {
  width: 100% !important;
  min-height: 46px !important;
  padding: 12px 14px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  text-align: center !important;
}

.edd-filter-reset.button {
  background: #fff !important;
  color: #10141a !important;
  border-color: #d9dee7 !important;
  box-shadow: none !important;
}

.edd-category-check,
.edd-filter-field select,
.edd-filter-field input,
.edd-filter-submit,
.edd-filter-reset,
.edd-shop-engine-chip {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(225, 6, 0, .12);
}

/* Cart coupon/update row: never stack awkwardly on desktop; stack cleanly on phones. */
.woocommerce-cart table.cart td.actions .coupon,
.woocommerce-cart .coupon {
  display: flex !important;
  align-items: stretch !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  max-width: 100% !important;
}

.woocommerce-cart table.cart td.actions .coupon .input-text,
.woocommerce-cart .coupon .input-text,
.woocommerce-cart .coupon input[name="coupon_code"] {
  flex: 1 1 230px !important;
  min-width: 220px !important;
  min-height: 46px !important;
  width: auto !important;
}

.woocommerce-cart table.cart td.actions .coupon .button,
.woocommerce-cart .coupon .button,
.woocommerce-cart button[name="update_cart"] {
  min-height: 46px !important;
  width: auto !important;
  flex: 0 0 auto !important;
  padding: 12px 22px !important;
  white-space: nowrap !important;
}

.woocommerce-cart table.cart td.actions {
  text-align: left !important;
}

/* PayPal/card fields: avoid giant placeholders and double borders while preserving iframe click targets. */
.woocommerce-checkout .ppcp-card-fields--container {
  padding: 14px !important;
  border-radius: 16px !important;
  background: #f7f8fa !important;
}

.woocommerce-checkout .ppcp-card-field--container {
  margin: 0 0 14px !important;
}

.woocommerce-checkout .ppcp-card-field--container:last-child {
  margin-bottom: 0 !important;
}

.woocommerce-checkout .ppcp-card-field--label {
  display: block !important;
  margin: 0 0 7px !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  font-weight: 900 !important;
  color: #10141a !important;
}

.woocommerce-checkout #ppcp-card-name,
.woocommerce-checkout #ppcp-card-number,
.woocommerce-checkout #ppcp-card-exp,
.woocommerce-checkout #ppcp-card-cvv,
.woocommerce-checkout .ppcp-card-field iframe {
  min-height: 46px !important;
  height: 46px !important;
  max-height: 52px !important;
  border-radius: 10px !important;
  font-size: 16px !important;
}

.woocommerce-checkout .ppcp-card-field--container input,
.woocommerce-checkout .ppcp-card-field--container .InputElement {
  font-size: 16px !important;
  line-height: 46px !important;
}

/* Checkout layout should stay readable and not create strange empty boxes. */
.woocommerce-checkout form.checkout {
  gap: clamp(18px, 2vw, 30px) !important;
  align-items: start !important;
}

.woocommerce-checkout .col2-set,
.woocommerce-checkout #order_review,
.woocommerce-checkout .woocommerce-additional-fields {
  min-width: 0 !important;
}

.woocommerce-checkout textarea,
.woocommerce-checkout input.input-text,
.woocommerce-checkout select {
  font-size: 16px !important;
}

@media (max-width: 900px) {
  .woocommerce .edd-product-section .edd-carousel-viewport ul.products li.product {
    flex-basis: min(78vw, 300px) !important;
    width: min(78vw, 300px) !important;
  }

  .woocommerce .edd-product-section .edd-carousel-viewport ul.products li.product img {
    height: 190px !important;
  }

  .edd-shop-filters {
    z-index: 100030 !important;
  }

  .edd-filter-actions {
    position: sticky !important;
    bottom: 0 !important;
    background: #fff !important;
    padding: 12px 0 max(12px, env(safe-area-inset-bottom)) !important;
    margin: 16px 0 0 !important;
    border-top: 1px solid #e6e9ee !important;
  }
}

@media (max-width: 640px) {
  .woocommerce-products-header__title,
  .product_title,
  .woocommerce-cart h1,
  .woocommerce-checkout h1 {
    font-size: clamp(38px, 13vw, 58px) !important;
    letter-spacing: -.055em !important;
  }

  .edd-product-section__head--bar {
    gap: 8px !important;
  }

  .edd-product-section__head--bar h2 {
    font-size: 20px !important;
  }

  .edd-section-actions {
    gap: 6px !important;
  }

  .woocommerce-cart .coupon {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .woocommerce-cart .coupon input[name="coupon_code"],
  .woocommerce-cart .coupon .button,
  .woocommerce-cart button[name="update_cart"] {
    width: 100% !important;
    min-width: 0 !important;
  }
}
