/* ==========================================================================
   DeviceHub — Product Card Component
   Path: assets/css/components/product-card.css
   Depends on: global.css

   This is the shared card used on: home sections, archive, search results.
   Do NOT put grid layout here — that belongs in the page-level CSS.
   ========================================================================== */

/* ==========================================================================
   1. Card shell
   ========================================================================== */

.devhub-product-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(251, 251, 252, 0.98)
  );
  border: 1px solid rgba(228, 231, 236, 0.95);
  border-radius: calc(var(--devhub-radius-md) + 2px);
  --devhub-card-pad: 16px;
  padding: var(--devhub-card-pad);
  position: relative;
  overflow: hidden;
  box-shadow: var(--devhub-shadow-card);
  transition:
    border-color var(--devhub-transition),
    box-shadow var(--devhub-transition);
}

.devhub-product-card:hover {
  border-color: rgba(255, 102, 0, 0.2);
  box-shadow: var(--devhub-shadow-hover);
}

.devhub-product-card::before {
  display: none;
}

.devhub-product-card:hover::before {
  opacity: 0;
}

/* ==========================================================================
   2. Badge
   ========================================================================== */

.devhub-product-card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--devhub-primary);
  color: var(--devhub-white);
  font-size: var(--devhub-text-lg);
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: var(--devhub-radius-full);
  z-index: 1;
  box-shadow: 0 10px 18px rgba(255, 102, 0, 0.22);
}

/* ==========================================================================
   3. Image
   ========================================================================== */

.devhub-product-card__img-wrap {
  display: block;
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-radius: calc(var(--devhub-radius-md) - 2px);
  background: var(--devhub-white);
  margin-bottom: 14px;
}

.devhub-product-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.devhub-product-card__offer-badge {
  display: none;
}

.devhub-product-card__img-placeholder {
  width: 100%;
  height: 100%;
  background: var(--devhub-bg);
}

/* ==========================================================================
   4. Body
   ========================================================================== */

.devhub-product-card__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.devhub-product-card__name {
  width: 100%;
  max-width: 100%;
  font-size: var(--devhub-text-xl);
  font-weight: 700;
  color: var(--devhub-black);
  line-height: 1.45;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.devhub-product-card__name:hover {
  color: var(--devhub-primary);
}

.devhub-product-card__labels {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.devhub-product-card__bundle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  box-shadow: none;
  width: fit-content;
}

.gold-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 34px;
  height: 64px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 5px 7px rgba(140, 20, 20, 0.28));
  transform: scale(0.53);
  transform-origin: top left;
}

.gold-badge__ribbon {
  position: absolute;
  top: 40px;
  left: 21px;
  width: 22px;
  height: 55px;
  background: #c62828;
  transform-origin: top center;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  z-index: 1;
}

.gold-badge__ribbon--left {
  transform: rotate(-22deg);
}

.gold-badge__ribbon--right {
  transform: rotate(22deg);
}

.gold-badge__medallion {
  position: absolute;
  top: 0;
  left: 2px;
  width: 60px;
  height: 60px;
  z-index: 2;
  background:
    radial-gradient(circle 8px at 54px 30px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 50.78px 42px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 42px 50.78px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 30px 54px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 18px 50.78px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 9.2px 42px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 6px 30px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 9.2px 18px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 18px 9.2px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 30px 6px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 42px 9.2px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 8px at 50.78px 18px, #ef5350 98%, transparent 100%),
    radial-gradient(circle 23px at 30px 30px, #ef5350 98%, transparent 100%);
}

.gold-badge__disc {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #b71c1c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff5f5;
  font: 800 12px/1 "Poppins", system-ui, sans-serif;
  letter-spacing: 0.3px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.18);
}

@media (max-width: 767px) {
  .gold-badge {
    width: 30px;
    height: 57px;
    transform: scale(0.47);
  }
}

@media (max-width: 575px) {
  .gold-badge {
    width: 27px;
    height: 51px;
    transform: scale(0.42);
  }
}

.devhub-product-card__bundle {
  background: linear-gradient(180deg, #fff3ea 0%, #ffe7d6 100%);
  color: #c45508;
  border: 1px solid rgba(255, 102, 0, 0.18);
}

/* Small open-box icon before the label (it replaces the old orange dot). */
.devhub-product-card__bundle::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 0;
  background: currentColor;
  -webkit-mask: url("../../images/bundle-pkg-icon.svg") center / contain
    no-repeat;
  mask: url("../../images/bundle-pkg-icon.svg") center / contain no-repeat;
  flex: 0 0 13px;
}

.devhub-product-card__price {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 5px;
  width: 100%;
  min-width: 0;
  font-size: var(--devhub-text-2xl);
  font-weight: 700;
  color: var(--devhub-black);
  white-space: nowrap;
}

.devhub-product-card__price-prefix {
  font-size: 0.56em;
  font-weight: 700;
  color: var(--devhub-mid);
  white-space: nowrap;
}

.devhub-product-card__price del {
  order: 2;
  font-size: var(--devhub-text-lg);
  color: #8f8f8f;
  font-weight: 500;
  white-space: nowrap;
}

.devhub-product-card__price del .woocommerce-Price-amount,
.devhub-product-card__price del .woocommerce-Price-amount bdi,
.devhub-product-card__price del .woocommerce-Price-amount bdi * {
  color: #8f8f8f !important;
}

.devhub-product-card__price ins {
  order: 1;
  text-decoration: none;
  white-space: nowrap;
}

.devhub-product-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
  padding: 9px 16px;
  border-radius: var(--devhub-radius-md);
  background: var(--devhub-primary);
  color: var(--devhub-white);
  font-size: var(--devhub-text-xl);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background-color var(--devhub-transition),
    opacity var(--devhub-transition),
    transform var(--devhub-transition);
}

.devhub-product-card__action:hover {
  background: var(--devhub-primary-dark);
  color: var(--devhub-white);
}

.devhub-product-card__action--disabled {
  background: #d0d5dd !important;
  color: var(--devhub-white) !important;
  cursor: not-allowed;
}

.devhub-product-card__action--disabled:hover,
.devhub-product-card__action--disabled:focus,
.devhub-product-card__action--disabled:focus-visible,
.devhub-product-card__action--disabled:active {
  background: #d0d5dd !important;
  color: var(--devhub-white) !important;
  box-shadow: none !important;
  transform: none !important;
}

/* The button is a compact, fully rounded (pill) button, centred at the bottom of the card, right
   under the price, always visible (desktop and touch). It keeps the card padding
   around it (no edge-to-edge band), and cards in a row share a height so the
   buttons line up. When the product is out of stock the button is disabled; the
   rest of the card still opens the product. */
.devhub-product-card {
  display: flex;
  flex-direction: column;
}

.devhub-product-card__body {
  flex: 1 1 auto;
  padding-bottom: 10px;
}

.devhub-product-card__action {
  display: flex;
  width: fit-content;
  min-width: 128px;
  max-width: 100%;
  min-height: 36px;
  margin: 4px auto 0;
  border-radius: var(--devhub-radius-full);
  background: var(--devhub-primary);
  box-shadow: none;
}

.devhub-product-card__action--disabled {
  background: #d0d5dd !important;
  pointer-events: none;
}

/* ==========================================================================
   5. Stock status
   ========================================================================== */

.devhub-product-card__stock {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  font-size: var(--devhub-text-xl) !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Dot indicator */
.devhub-product-card__stock::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.devhub-product-card__stock--in {
  color: var(--devhub-success);
}
.devhub-product-card__stock--out {
  color: var(--devhub-danger);
}

/* ── Promo starburst badge on card image ─────────────────────────────────── */

.devhub-product-card__promo-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 58px;
  height: 58px;
  background: radial-gradient(circle, #e8001e 0%, #b00018 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(200, 0, 30, 0.4);
  z-index: 5;
  clip-path: polygon(
    50% 0%,
    61% 15%,
    79% 9%,
    73% 27%,
    93% 29%,
    83% 44%,
    100% 50%,
    83% 56%,
    93% 71%,
    73% 73%,
    79% 91%,
    61% 85%,
    50% 100%,
    39% 85%,
    21% 91%,
    27% 73%,
    7% 71%,
    17% 56%,
    0% 50%,
    17% 44%,
    7% 29%,
    27% 27%,
    21% 9%,
    39% 15%
  );
  pointer-events: none;
}

.devhub-product-card__promo-badge-pct {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.devhub-product-card__promo-badge-off {
  color: rgba(255, 255, 255, 0.85);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
