/* === Shop Enhancements - Alimentari Paoletti === */

/* Equal-height cards: stretch all cards in each row */
.products-grid .row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: stretch !important;
}
.products-grid .row > div.product {
  display: flex !important;
  flex-direction: column !important;
}
.product-block.grid {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  transition: transform .18s ease, box-shadow .18s ease;
  border-radius: 10px !important;
  overflow: hidden;
}
.product-block.grid:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.11) !important;
}

/* Fixed image area: same height for placeholder and real images */
.product-block .image,
.product-block figure.image {
  height: 200px !important;
  max-height: 200px !important;
  min-height: 200px !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  display: block !important;
}
.product-block .image a,
.product-block figure.image a {
  display: block !important;
  height: 200px !important;
  overflow: hidden !important;
}
.product-block .image img,
.product-block figure.image img,
.product-block .image .wp-post-image,
.product-block .image img.woocommerce-placeholder {
  display: block !important;
  width: 100% !important;
  height: 200px !important;
  max-height: 200px !important;
  object-fit: contain !important;
  object-position: center !important;
  transition: transform .3s ease;
}
.product-block:hover .image img {
  transform: scale(1.05);
}

/* Card body grows to fill remaining height */
.product-block .product-block__info,
.product-block .caption,
.product-block .product-block__body {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Price */
.product-block .price ins,
.product-block .price .woocommerce-Price-amount {
  color: #0d5220 !important;
  font-weight: 700 !important;
}
.product-block .price del {
  opacity: .5;
  font-size: .82rem;
}

/* Add to cart */
.product-block .btn-add-to-cart,
.product-block .add_to_cart_button,
.btn.btn-add-to-cart {
  background: #1a8035 !important;
  border-color: #1a8035 !important;
  border-radius: 7px !important;
  transition: background .15s, transform .1s !important;
}
.product-block .btn-add-to-cart:hover,
.product-block .add_to_cart_button:hover,
.btn.btn-add-to-cart:hover {
  background: #0d5220 !important;
  border-color: #0d5220 !important;
  transform: translateY(-1px);
}

/* Infinite scroll */
#ap-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  width: 100%;
  color: #666;
  font-size: .9rem;
}
.ap-spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid #ddd;
  border-top-color: #1a8035;
  border-radius: 50%;
  animation: ap-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }
.ap-end-msg { color: #999; font-size: .85rem; }

/* Live search dropdown */
#ap-search-dd {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  z-index: 9999;
  max-height: 360px;
  overflow-y: auto;
}
.ap-dd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f2f2f2;
  transition: background .12s;
}
.ap-dd-item:last-child { border-bottom: none; }
.ap-dd-item:hover { background: #f4f8f3; }
.ap-dd-item img,
.ap-dd-img-placeholder {
  width: 46px; height: 46px;
  object-fit: contain;
  border-radius: 6px;
  background: #f8f8f8;
  flex-shrink: 0;
}
.ap-dd-info { display: flex; flex-direction: column; gap: 2px; }
.ap-dd-name {
  font-size: .85rem;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
}
.ap-dd-price {
  font-size: .82rem;
  color: #1a8035;
  font-weight: 700;
}
.ap-dd-empty {
  padding: 18px;
  text-align: center;
  color: #999;
  font-size: .88rem;
}

/* Responsive columns */
@media (min-width: 1200px) {
  .woocommerce .products-grid .row > div.product,
  .products-grid .row > div.product {
    flex: 0 0 20% !important;
    max-width: 20% !important;
    width: 20% !important;
  }
}
@media (min-width: 1440px) {
  .woocommerce .products-grid .row > div.product,
  .products-grid .row > div.product {
    flex: 0 0 16.6667% !important;
    max-width: 16.6667% !important;
    width: 16.6667% !important;
  }
}
