/**
 * The "In Stock" corner ribbon shown on product cards (listings, related
 * products, selector results): everywhere except the single product page,
 * which gets the full ribbon image instead.
 *
 * Colours and size come from custom properties the plugin prints inline, so
 * they follow the global ribbon settings without this file being rewritten.
 *
 * The badge positions itself against the nearest positioned ancestor, which in
 * this theme is the .item-img wrapper on every product card.
 */
.agtech-ribbon-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 130px;
  height: 130px;
  overflow: hidden;
  pointer-events: none;
  z-index: 9;
}

.agtech-ribbon-badge--left {
  right: auto;
  left: 0;
}

.agtech-ribbon-badge__text {
  position: absolute;
  top: 30px;
  right: -46px;
  display: block;
  width: 200px;
  padding: 7px 0;
  background: var(--agtech-ribbon-bg-start, #7ac943);
  background: linear-gradient(
    135deg,
    var(--agtech-ribbon-bg-start, #7ac943),
    var(--agtech-ribbon-bg-end, #2e8b2e)
  );
  color: var(--agtech-ribbon-fg, #ffffff);
  font-size: var(--agtech-ribbon-size, 14px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  transform: rotate(45deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.agtech-ribbon-badge--left .agtech-ribbon-badge__text {
  right: auto;
  left: -46px;
  transform: rotate(-45deg);
}

@media (max-width: 640px) {
  .agtech-ribbon-badge {
    width: 96px;
    height: 96px;
  }

  .agtech-ribbon-badge__text {
    top: 20px;
    right: -56px;
    width: 170px;
    padding: 5px 0;
    font-size: calc(var(--agtech-ribbon-size, 14px) - 2px);
  }

  .agtech-ribbon-badge--left .agtech-ribbon-badge__text {
    right: auto;
    left: -56px;
  }
}

/**
 * The single-product ribbon when the plugin injects it into the product image
 * rather than the theme template printing it.
 *
 * Ordinary products are built with Elementor, whose Product Images widget
 * renders the WooCommerce gallery directly, so the ribbon is prepended inside
 * .woocommerce-product-gallery__image and positioned against the gallery.
 */
.woocommerce-product-gallery {
  position: relative;
}

img.agtech-ribbon-single {
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
  max-width: 34%;
  height: auto;
  z-index: 9;
  pointer-events: none;
}

@media (max-width: 640px) {
  img.agtech-ribbon-single {
    max-width: 40%;
  }
}
