/* Product cards (shop, categories, home rows).
   Each card is a grid: image / category / name / buttons. The name row takes the spare
   height, so every card in a row has its buttons on the same line.
   The WhatsApp plugin styles #sendbtn with !important, so these rules carry the id too. */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-rows: auto auto 1fr auto;
  column-gap: 6px;
  align-content: start;
  margin-bottom: 2.5em;
}
.woocommerce ul.products li.product .astra-shop-thumbnail-wrap { grid-column: 1 / -1; grid-row: 1; }
.woocommerce ul.products li.product .astra-shop-summary-wrap { display: contents; }
.woocommerce ul.products li.product .ast-woo-product-category {
  grid-column: 1 / -1; grid-row: 2;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin: 10px 0 2px;
}
.woocommerce ul.products li.product .ast-loop-product__link { grid-column: 1 / -1; grid-row: 3; align-self: start; }
/* Names: at most 3 lines, the full name is on the product page */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3;
  overflow: hidden; margin-bottom: 12px; line-height: 1.35;
}
/* Anything else a plugin adds in the summary (price, rating, notes) spans the card */
.woocommerce ul.products li.product .astra-shop-summary-wrap > :not(.ast-woo-product-category):not(.ast-loop-product__link):not(.button):not(.added_to_cart):not(.screen-reader-text) { grid-column: 1 / -1; }

/* Button row: Adicionar | Orçar via WhatsApp | heart */
.woocommerce ul.products li.product .button.add_to_cart_button:not(#sendbtn),
.woocommerce ul.products li.product .button.product_type_simple:not(#sendbtn),
.woocommerce ul.products li.product .button.product_type_variable:not(#sendbtn),
.woocommerce ul.products li.product .button.product_type_external:not(#sendbtn) {
  grid-column: 1; grid-row: 4;
  display: flex; align-items: center; justify-content: center; text-align: center;
  width: 100%; min-height: 42px; margin: 0 !important; padding: .6em .5em; font-size: .8125rem; line-height: 1.2;
}
.woocommerce ul.products li.product .button.added::after { margin-left: .4em; }
.woocommerce ul.products li.product .added_to_cart { grid-column: 1 / -1; grid-row: 5; text-align: center; font-size: .8125rem; padding-top: 6px; }

.woocommerce ul.products li.product a#sendbtn.wa-shop-button {
  grid-column: 2; grid-row: 4;
  display: flex !important; align-items: center; justify-content: center; gap: 5px;
  width: 42px !important; min-height: 42px; margin: 0 !important; padding: 0 !important; position: relative;
  background: #fff !important; color: #178a45 !important; border: 1px solid #25d366 !important; border-radius: inherit;
  box-shadow: none !important; font-size: .8125rem !important; line-height: 1.2 !important; text-align: center; white-space: nowrap;
}
.woocommerce ul.products li.product a#sendbtn.wa-shop-button::before {
  content: "" !important; position: static !important; display: block; width: 18px !important; height: 18px !important; flex: none; margin: 0 !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23178a45' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3.5 20.5 5 16a8.5 8.5 0 1 1 3 3z'/%3E%3Cpath d='M9 9.5c0 3 2.5 5.5 5.5 5.5l1.2-1.4-2-1-1 .8a4 4 0 0 1-2-2l.8-1-1-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.woocommerce ul.products li.product a#sendbtn.wa-shop-button:hover,
.woocommerce ul.products li.product a#sendbtn.wa-shop-button:focus-visible { background: #25d366 !important; color: #fff !important; }
.woocommerce ul.products li.product a#sendbtn.wa-shop-button:hover::before,
.woocommerce ul.products li.product a#sendbtn.wa-shop-button:focus-visible::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3.5 20.5 5 16a8.5 8.5 0 1 1 3 3z'/%3E%3Cpath d='M9 9.5c0 3 2.5 5.5 5.5 5.5l1.2-1.4-2-1-1 .8a4 4 0 0 1-2-2l.8-1-1-2z'/%3E%3C/svg%3E"); }

/* Wishlist: a heart button at the end of the row instead of a text line */
.woocommerce ul.products li.product .tinvwl-loop-button-wrapper {
  grid-column: 3; grid-row: 4; position: relative; margin: 0 !important; padding: 0 !important; display: flex;
}
.woocommerce ul.products li.product .tinvwl-loop-button-wrapper .tinv-wishlist-clear { display: none; }
.woocommerce ul.products li.product .tinvwl_add_to_wishlist_button.tinvwl-loop {
  display: flex !important; align-items: center; justify-content: center;
  width: 42px; height: 100%; min-height: 42px; margin: 0 !important; padding: 0 !important;
  border: 1px solid #d5dbe1; border-radius: 3px; background: #fff;
}
.woocommerce ul.products li.product .tinvwl_add_to_wishlist_button.tinvwl-loop::before { margin: 0 !important; font-size: 18px; }
.woocommerce ul.products li.product .tinvwl_add_to_wishlist_button.tinvwl-loop:hover { border-color: currentColor; }
.woocommerce ul.products li.product .tinvwl_add_to_wishlist-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Cards are narrow (sidebar + 4 columns): WhatsApp shows the icon only; the title attribute and
   an aria-label keep its name for screen readers and on hover */
.woocommerce ul.products li.product a#sendbtn.wa-shop-button { font-size: 0 !important; gap: 0; }
@media (max-width: 544px) {
  .woocommerce ul.products li.product .button.add_to_cart_button:not(#sendbtn) { font-size: .75rem; padding-inline: .3em; }
  .woocommerce ul.products li.product .tinvwl_add_to_wishlist_button.tinvwl-loop { width: 36px; }
}

/* Home "Novidades" block (image + name only): names clamped to 2 lines with a fixed height so rows line up */
.wc-block-grid__product .wc-block-grid__product-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; line-height: 1.35; min-height: calc(2em * 1.35);
}
