/**
 * Aqua Store 2.0.1 — sale/store/order layout
 * Skill: responsive-design-os
 * Container queries + intrinsic grids + overflow guards.
 * Visual identity (aqua, radii, RTL) kept.
 */

/* Fixed shop columns — auto-fit + 1fr stretched 1–2 cards across the row */
.sale-products-grid,
.store-products-grid,
.grid-4.sale-products-grid,
.grid-4.store-products-grid,
.sale-products-grid.products-count-1,
.store-products-grid.products-count-1,
.sale-products-grid.products-count-2,
.store-products-grid.products-count-2,
.sale-products-grid.products-count-3,
.store-products-grid.products-count-3,
.sale-products-grid.products-count-4,
.store-products-grid.products-count-4,
.woocommerce ul.products,
.brl-wc-wrap .woocommerce ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: clamp(0.75rem, 2vw, 1.25rem) !important;
  width: 100% !important;
  justify-content: start !important;
  align-items: stretch !important;
  container-type: inline-size;
}

.sale-page,
.store-page,
.site-content {
  min-width: 0;
}

.sale-page .sale-hero {
  padding-block: clamp(1.25rem, 4vw, 2.25rem);
  text-align: center;
}

.sale-page .sale-hero h1 {
  font-size: var(--text-xl, clamp(1.35rem, 1.15rem + 0.8vw, 1.85rem));
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sale-page .sale-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.sale-page .sale-toolbar select,
.sale-page .sale-toolbar .btn {
  min-height: 44px;
}

.product-card,
.sale-products-grid .product-card,
.store-products-grid .product-card {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: visible !important;
}

.product-card > a:first-child {
  display: block !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  line-height: 0 !important;
}

.product-card .product-thumb {
  position: relative !important;
  overflow: hidden !important;
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
}

.product-card .product-thumb img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
}

.product-card .product-body,
.sale-products-grid .product-card .product-body,
.store-products-grid .product-card .product-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.4rem !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  padding: 14px 14px 16px !important;
}

.product-card .meta {
  min-height: 1.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card h3,
.sale-products-grid .product-card h3,
.store-products-grid .product-card h3 {
  min-height: 2.6em !important;
  max-height: 2.6em !important;
  margin: 0 !important;
  line-height: 1.3 !important;
  overflow: hidden !important;
}

.product-card h3 a,
.sale-products-grid .product-card h3 a,
.store-products-grid .product-card h3 a {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
  overflow-wrap: anywhere !important;
}

.product-card .row-between,
.product-card .price {
  min-height: 2.4em !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: baseline !important;
  justify-content: center !important;
  gap: 6px !important;
}

.product-card .product-actions {
  display: flex !important;
  align-items: center !important;
  margin-top: auto !important;
  width: 100% !important;
  min-height: 44px !important;
  height: 44px !important;
}

.product-card .product-actions .buy-form,
.product-card .product-actions .btn-add-cart,
.product-card .product-actions .product-unavailable {
  width: 100% !important;
  margin: 0 !important;
}

.badge-sale {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--danger, #d21f32);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.product-card .price.is-sale .price-now {
  color: var(--danger, #d21f32);
  font-weight: 700;
}

.product-card .price-old {
  text-decoration: line-through;
  color: var(--mute);
}

/* Buy form must remain usable — never clip qty + submit */
.product-card .buy-form,
.sale-products-grid .product-card .buy-form,
.store-products-grid .product-card .buy-form {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  height: auto !important;
  min-height: 44px !important;
  margin-top: auto !important;
  overflow: visible !important;
}

.product-card .buy-form .qty,
.sale-products-grid .product-card .buy-form .qty,
.store-products-grid .product-card .buy-form .qty {
  flex: 0 0 48px !important;
  width: 48px !important;
  min-width: 48px !important;
  height: 44px !important;
  min-height: 44px !important;
}

.product-card .buy-form .btn-add-cart,
.sale-products-grid .product-card .buy-form .btn-add-cart,
.store-products-grid .product-card .buy-form .btn-add-cart,
.sale-products-grid .product-card > .btn-add-cart,
.store-products-grid .product-card > .btn-add-cart {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 44px !important;
  min-height: 44px !important;
  max-width: 100% !important;
}

@container (max-width: 420px) {
  .sale-products-grid,
  .store-products-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1023px) {
  .sale-products-grid,
  .store-products-grid,
  .grid-4.sale-products-grid,
  .grid-4.store-products-grid,
  .woocommerce ul.products,
  .brl-wc-wrap .woocommerce ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 767px) {
  .sale-products-grid,
  .store-products-grid,
  .grid-4.sale-products-grid,
  .grid-4.store-products-grid,
  .woocommerce ul.products,
  .brl-wc-wrap .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .sale-page .sale-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .sale-page .sale-toolbar .toolbar-actions,
  .sale-page .sale-toolbar select {
    width: 100%;
  }
}

@media (max-width: 419px) {
  .sale-products-grid,
  .store-products-grid,
  .grid-4.sale-products-grid,
  .grid-4.store-products-grid,
  .woocommerce ul.products,
  .brl-wc-wrap .woocommerce ul.products {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  .sale-products-grid.products-count-1,
  .store-products-grid.products-count-1,
  .sale-products-grid.products-count-2,
  .store-products-grid.products-count-2,
  .sale-products-grid.products-count-3,
  .store-products-grid.products-count-3,
  .sale-products-grid.products-count-4,
  .store-products-grid.products-count-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
