/* ══════════════════════════════════════════════════════════
   TargetWeb — Shared Product Card
   Single source of truth for the product card used by:
     - Shop / category / search archives (.tw-shop-grid ul.products li.product)
     - Homepage "Featured Equipment" (.tw-product-card)
   Both render the same inner classes (see inc/product-card.php),
   so any change here applies everywhere.
   ══════════════════════════════════════════════════════════ */

/* ── Card shell ─────────────────────────────────────────── */
.tw-shop-grid ul.products li.product,
.tw-product-card {
  position: relative !important;
  list-style: none !important;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  display: flex !important;
  flex-direction: column !important;
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.tw-shop-grid ul.products li.product:hover,
.tw-product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .09);
  transform: translateY(-2px);
}

/* The product link wraps badge + thumb + title + price */
.tw-shop-grid ul.products li.product > a,
.tw-product-card > a.woocommerce-LoopProduct-link {
  display: block;
  text-decoration: none !important;
  color: inherit;
}

/* ── Thumbnail (primary + hover image) ──────────────────── */
.tw-card-thumb {
  position: relative;
  display: block;
  width: 100%;
  height: 200px;
  background: #fff;
  overflow: hidden;
}
.tw-shop-grid ul.products li.product a img,
.tw-card-thumb img {
  width: 100% !important;
  height: 200px !important;
  object-fit: contain !important;
  background: #fff !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  display: block !important;
  margin: 0 !important;
}
.tw-card-thumb img[src*="woocommerce-placeholder"],
.tw-card-thumb img[src*="placeholder.png"] {
  padding: 24px !important;
  opacity: .5;
}

/* Second image reveals on hover — sits directly over the primary */
.tw-card-thumb__img--secondary {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.tw-shop-grid ul.products li.product:hover .tw-card-thumb__img--secondary,
.tw-product-card:hover .tw-card-thumb__img--secondary {
  opacity: 1;
}
/* Keep the primary visible for touch devices, where there is no hover */
@media (hover: none) {
  .tw-card-thumb__img--secondary {
    display: none !important;
  }
}

/* ── Title ──────────────────────────────────────────────── */
.tw-shop-grid ul.products li.product .woocommerce-loop-product__title,
.tw-product-card .woocommerce-loop-product__title {
  font-family: var(--font-heading, 'Oswald', sans-serif);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px 4px;
  margin: 0;
  color: var(--color-dark, #111) !important;
  flex: 1;
  line-height: 1.4;
}

/* ── Price ──────────────────────────────────────────────── */
.tw-shop-grid ul.products li.product .price,
.tw-product-card .price {
  padding: 4px 14px 8px;
  margin: 0;
  font-weight: 700;
  color: var(--color-primary, #c00) !important;
  display: flex !important;
  align-items: baseline !important;
  gap: 8px;
  font-size: 15px;
  flex-wrap: wrap;
}
.tw-shop-grid ul.products li.product .price del,
.tw-product-card .price del {
  order: 1;
  color: #999 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  text-decoration: line-through !important;
}
.tw-shop-grid ul.products li.product .price ins,
.tw-product-card .price ins {
  order: 2;
  text-decoration: none !important;
  color: var(--color-primary, #c00) !important;
  font-weight: 700 !important;
}

/* ── Add to cart / Call for Price button ────────────────── */
.tw-shop-grid ul.products li.product .button,
.tw-shop-grid ul.products li.product .add_to_cart_button,
.tw-shop-grid ul.products li.product .tw-btn,
.tw-product-card .button,
.tw-product-card .add_to_cart_button,
.tw-product-card .tw-btn {
  display: block !important;
  margin: auto 14px 14px !important;
  padding: 9px !important;
  text-align: center !important;
  background: var(--color-primary, #c00) !important;
  color: #fff !important;
  font-family: var(--font-heading, 'Oswald', sans-serif) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  border-radius: 0 !important;
  border: none !important;
  cursor: pointer !important;
  width: auto !important;
  float: none !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  transition: background .2s !important;
}
.tw-shop-grid ul.products li.product .button:hover,
.tw-shop-grid ul.products li.product .add_to_cart_button:hover,
.tw-shop-grid ul.products li.product .tw-btn:hover,
.tw-product-card .button:hover,
.tw-product-card .add_to_cart_button:hover,
.tw-product-card .tw-btn:hover {
  background: var(--color-dark, #111) !important;
  color: #fff !important;
}

/* ── Add-to-cart feedback (assets/js/add-to-cart-feedback.js) ──── */

/* WooCommerce appends a "View cart" link after the button on AJAX adds.
   The in-button "Added" state below replaces it. */
li.product a.added_to_cart,
.tw-product-card a.added_to_cart {
  display: none !important;
}

/* Adding… — spinner alongside the label */
.tw-shop-grid ul.products li.product .add_to_cart_button.tw-atc--loading,
.tw-product-card .add_to_cart_button.tw-atc--loading {
  pointer-events: none !important;
  opacity: .92;
}
.tw-shop-grid ul.products li.product .add_to_cart_button.tw-atc--loading::after,
.tw-product-card .add_to_cart_button.tw-atc--loading::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tw-atc-spin .6s linear infinite;
}

/* Added — green confirmation with a check, then JS restores the label */
.tw-shop-grid ul.products li.product .add_to_cart_button.tw-atc--added,
.tw-product-card .add_to_cart_button.tw-atc--added {
  background: #2e9e4f !important;
  animation: tw-atc-pop .32s ease;
}
.tw-shop-grid ul.products li.product .add_to_cart_button.tw-atc--added::before,
.tw-product-card .add_to_cart_button.tw-atc--added::before {
  content: "\2713";
  margin-right: 6px;
  font-weight: 700;
}

@keyframes tw-atc-spin {
  to { transform: rotate(360deg); }
}
@keyframes tw-atc-pop {
  0%, 100% { transform: scale(1); }
  45%      { transform: scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .tw-shop-grid ul.products li.product .add_to_cart_button.tw-atc--loading::after,
  .tw-product-card .add_to_cart_button.tw-atc--loading::after,
  .tw-shop-grid ul.products li.product .add_to_cart_button.tw-atc--added,
  .tw-product-card .add_to_cart_button.tw-atc--added {
    animation: none;
  }
}

/* ── Sale badge ─────────────────────────────────────────── */
.tw-shop-grid ul.products li.product .onsale,
.tw-product-card .onsale {
  background: var(--color-primary, #c00) !important;
  color: #fff !important;
  border-radius: 0 !important;
  position: absolute !important;
  top: 10px !important;
  left: 10px !important;
  margin: 0 !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  line-height: 1.4 !important;
  min-height: 0 !important;
  min-width: 0 !important;
  width: auto !important;
  height: auto !important;
  z-index: 5 !important;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 560px) {
  .tw-card-thumb {
    height: 150px;
  }
  .tw-shop-grid ul.products li.product a img,
  .tw-card-thumb img {
    height: 150px !important;
    padding: 8px !important;
  }
  .tw-shop-grid ul.products li.product .woocommerce-loop-product__title,
  .tw-product-card .woocommerce-loop-product__title {
    font-size: 13px;
    padding: 8px 10px 2px;
  }
  .tw-shop-grid ul.products li.product .price,
  .tw-product-card .price {
    font-size: 13px;
    padding: 2px 10px 6px;
  }
  .tw-shop-grid ul.products li.product .button,
  .tw-product-card .button,
  .tw-product-card .add_to_cart_button {
    font-size: 12px;
    padding: 8px !important;
    margin: auto 10px 10px !important;
  }
}
