/*
 * SoSanh24h Astra Child v3.2.40 — mobile product card alignment.
 * In previous releases the price plugin reserved a 34px grid track for a
 * duplicate buy/compare button that the theme hides on mobile. This theme
 * resets those tracks rather than compressing text inside a tall blank card.
 * Product labels, prices, images, links and functions remain unchanged.
 */
@media (max-width: 740px) {
  .ss-live-prices .ss24-wrap .ss24-grid,
  .ss-category-results .ss24-wrap .ss24-grid,
  .ss24-home-product-list .ss24-wrap .ss24-grid,
  .ss-elementor-slot-homepage .ss24-wrap .ss24-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  /* Four visible tracks only. Any coupon or a real single-shop CTA goes into
     implicit row 5; there is NO sixth fixed track for the hidden blue button. */
  .ss-live-prices .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card,
  .ss-category-results .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card,
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 106px 44px 22px 18px !important;
    grid-auto-rows: min-content !important;
    gap: 3px 0 !important;
    align-content: start !important;
    justify-content: stretch !important;
    min-width: 0 !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 7px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-product-image {
    grid-row: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 106px !important;
    min-height: 106px !important;
    max-height: 106px !important;
    margin: 0 !important;
    padding: 0 0 21px !important;
    position: relative !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-product-image > img,
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-product-image > .ss24-image-placeholder:not([hidden]) {
    height: 83px !important;
    min-height: 0 !important;
    max-height: 83px !important;
    width: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }

  /* Compact orange action: 11px text as before, only a 2–3px inner border gap. */
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-product-image .ss24-hover-compare {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    min-height: 19px !important;
    height: 19px !important;
    width: max-content !important;
    max-width: calc(100% - 4px) !important;
    margin: 0 !important;
    padding: 2px 4px !important;
    border: 1px solid #e86110 !important;
    border-radius: 5px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    color: #fff !important;
    background: #f97316 !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
  }

  /* Allocate three headline lines even if one product uses only two, so that
     names, prices and shop counts align across cards in the same grid row. */
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > h3 {
    grid-row: 2 !important;
    min-width: 0 !important;
    flex-basis: auto !important;
    min-height: 0 !important;
    height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    font-size: clamp(11px, 3vw, 11.7px) !important;
    line-height: 1.27 !important;
    font-weight: 500 !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > h3 .ss24-name-link {
    font: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
  }

  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-price,
  .ss-live-prices .ss24-wrap .ss24-card.ss24-hover-card > .ss24-price,
  .ss-category-results .ss24-wrap .ss24-card.ss24-hover-card > .ss24-price {
    grid-row: 3 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 22px !important;
    max-height: 22px !important;
    flex-basis: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    font-size: clamp(10.8px, 3.05vw, 12px) !important;
    font-weight: 750 !important;
    line-height: 1.24 !important;
    letter-spacing: -0.12px !important;
    color: #e65b25 !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-shop-count {
    grid-row: 4 !important;
    min-height: 0 !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10.2px !important;
    line-height: 1.25 !important;
    color: #657991 !important;
    white-space: nowrap !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-shop-count .ss24-shop-icon {
    font-size: 10px !important;
    margin-right: 2px !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-shop-count[data-ss24-count]::before {
    margin-right: 2px !important;
    font-size: 10px !important;
  }

  /* Hidden duplicate link must not reserve grid space. Do not hide single-shop
     purchase buttons, which stay functional on row 5. */
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > a.ss24-buy.ss24-compare-action {
    display: none !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > a.ss24-buy:not(.ss24-compare-action),
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-coupon-hint,
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-card-stores {
    grid-row: 5 !important;
    margin: 1px 0 0 !important;
    padding-block: 2px !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > a.ss24-buy:not(.ss24-compare-action) {
    justify-self: center !important;
    align-self: start !important;
    min-height: 22px !important;
    height: auto !important;
    padding: 3px 5px !important;
    line-height: 1.15 !important;
    width: max-content !important;
    max-width: 100% !important;
  }
}
@media (max-width: 360px) {
  /* On narrow phones keep price readable: free wrapping only if truly needed. */
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-price {
    font-size: 10.8px !important;
  }
  .ss24-wrap .ss24-grid > .ss24-card.ss24-hover-card > .ss24-product-image .ss24-hover-compare {
    padding: 2px 3px !important;
  }
}
