/**
 * OEM ASTRA J — Recommendation card design system
 * Shared visual language (More From / Top Selling)
 */

:root {
  --oem-rec-bg: #1a1a1a;
  --oem-rec-border: rgba(246, 195, 67, 0.22);
  --oem-rec-gold: #f6c343;
  --oem-rec-brand: #d71920;
  --oem-rec-text: #ffffff;
  --oem-rec-muted: rgba(185, 185, 185, 0.88);
  --oem-rec-radius: 12px;
  --oem-rec-transition: 250ms ease;
  --oem-rec-height-scale: 1.1;
  --oem-rec-layout-min-h: calc(154px * var(--oem-rec-height-scale));
  --oem-rec-card-min-h: calc(163px * var(--oem-rec-height-scale));
  --oem-rec-media-min-h: calc(86px * var(--oem-rec-height-scale));
  --oem-rec-img-max-h: calc(106px * var(--oem-rec-height-scale));
  --oem-rec-img-scale: 1.3;
  --oem-rec-img-scale-hover: 1.32;
  --oem-rec-media-col: 39.9%;
}

/* —— Card shell —— */
.oem-rec-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--oem-rec-bg);
  border: 1px solid var(--oem-rec-border);
  border-radius: var(--oem-rec-radius);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--oem-rec-transition),
    border-color var(--oem-rec-transition),
    box-shadow var(--oem-rec-transition);
}

.oem-rec-card:hover {
  transform: translateY(-3px);
  border-color: rgba(246, 195, 67, 0.48);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(246, 195, 67, 0.12),
    0 0 18px rgba(246, 195, 67, 0.1);
  z-index: 2;
}

/* —— Engine compat badges (top-right) —— */
.oem-rec-card__compat {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 1px;
  max-width: calc(100% - 12px);
  pointer-events: none;
}

.oem-rec-card__compat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(246, 195, 67, 0.28);
  font-family: var(--font-en, system-ui, sans-serif);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: rgba(246, 195, 67, 0.95);
  white-space: nowrap;
  flex-shrink: 0;
}

.oem-rec-card__compat-pill--14 {
  padding: 2px 5px;
  border-radius: 7px;
  font-size: 9px;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #e83939 0%, #c41e1e 100%);
  border-color: rgba(215, 25, 32, 0.55);
  color: #fff;
  box-shadow: 0 2px 6px rgba(215, 25, 32, 0.28);
}

.oem-rec-card__compat-pill--16 {
  background: rgba(10, 25, 70, 0.42);
  border-color: rgba(147, 197, 253, 0.45);
  color: #dbeafe;
  box-shadow: 0 2px 6px rgba(10, 25, 70, 0.28);
}

.oem-rec-card__compat-sep {
  font-family: var(--font-en, system-ui, sans-serif);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  color: rgba(246, 195, 67, 0.78);
  flex-shrink: 0;
  margin: 0 -1px;
}

/* —— Horizontal grid layout —— */
.oem-rec-card__layout {
  display: grid;
  grid-template-columns: var(--oem-rec-media-col) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 0;
  padding: 0 8px 8px 0;
  flex: 1;
  min-height: var(--oem-rec-layout-min-h);
  height: 100%;
  box-sizing: border-box;
}

/* —— Product image (hero left, top → price divider) —— */
.oem-rec-card__media {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 80% 70% at 50% 55%, rgba(255, 255, 255, 0.05) 0%, transparent 68%),
    linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
  border-radius: calc(var(--oem-rec-radius) - 1px) 0 0 0;
}

.oem-rec-card__media::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(246, 195, 67, 0.04) 0%, transparent 58%);
  pointer-events: none;
  z-index: 0;
}

.oem-rec-card__media img,
.oem-rec-card__media .product-brand-fallback,
.oem-rec-card .top-selling-img-wrap img,
.oem-rec-card .top-selling-img-wrap .product-brand-fallback {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 0;
  object-fit: cover;
  object-position: center center;
  transform: none;
  transform-origin: center center;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
  transition: transform var(--oem-rec-transition);
}

.oem-rec-card__media .product-brand-fallback,
.oem-rec-card .top-selling-img-wrap .product-brand-fallback {
  object-fit: contain;
  width: 72%;
  height: 72%;
  margin: auto;
}

.oem-rec-card:hover .oem-rec-card__media img:not(.product-brand-fallback),
.oem-rec-card:hover .top-selling-img-wrap img:not(.product-brand-fallback) {
  transform: scale(1.03);
}

/* —— Info column (brand logo + name) —— */
.oem-rec-card__info,
.oem-rec-card .oem-rec-card__info.top-selling-footer {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 0.5cm;
  padding-inline-end: 2px;
  padding-bottom: 0;
  padding-inline-start: 0;
}

.oem-rec-card__brand,
.oem-rec-card .top-selling-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(20px * 1.1);
}

.oem-rec-card__brand-logo,
.oem-rec-card .top-selling-brand-logo {
  display: block;
  height: calc(20px * 1.1);
  max-width: calc(90px * 1.1);
  width: auto;
  margin-inline: auto;
  object-fit: contain;
  object-position: center center;
  filter: brightness(1.05);
}

.oem-rec-card__brand-text,
.oem-rec-card .top-selling-brand-fallback {
  display: none;
  font-family: var(--font-en, system-ui, sans-serif);
  font-size: calc(9px * 1.1);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--oem-rec-brand);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

.oem-rec-card__name,
.oem-rec-card .top-selling-name {
  font-size: calc(12px * 1.1);
  font-weight: 700;
  color: var(--oem-rec-text);
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  margin: 0;
}

/* —— Bottom bar: price row + cart —— */
.oem-rec-card__bar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.oem-rec-card__price {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0;
  overflow: hidden;
}

.oem-rec-card__price .product-price-block,
.oem-rec-card__price .product-price--inline {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 4px 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.oem-rec-card__price .product-price-sale,
.oem-rec-card__price .product-price--single {
  font-family: var(--font-en, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 800;
  color: var(--oem-rec-gold) !important;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.oem-rec-card__price .product-price-sale span,
.oem-rec-card__price .product-price--single span {
  font-size: 8px !important;
  font-weight: 600 !important;
  color: rgba(246, 195, 67, 0.72) !important;
}

.oem-rec-card__price .product-price-compare {
  font-size: 9px !important;
  font-weight: 500 !important;
  color: var(--oem-rec-muted) !important;
  text-decoration: line-through;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oem-rec-card__price .product-price-compare span {
  font-size: 7px !important;
  color: var(--oem-rec-muted) !important;
}

.oem-rec-card__price .product-price-badge {
  font-size: 8px !important;
  font-weight: 800 !important;
  color: #1a1408 !important;
  background: rgba(246, 195, 67, 0.92) !important;
  border: 1px solid rgba(246, 195, 67, 0.55);
  border-radius: 6px;
  padding: 1px 4px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Beat legacy grid price rules from enhancements.css */
.top-parts-grid .oem-rec-card .oem-rec-card__price .product-price-sale,
.top-parts-grid .oem-rec-card .oem-rec-card__price .product-price--single {
  font-size: 13px !important;
  font-weight: 800 !important;
  color: var(--oem-rec-gold) !important;
}

.top-parts-grid .oem-rec-card .oem-rec-card__price .product-price-sale span,
.top-parts-grid .oem-rec-card .oem-rec-card__price .product-price--single span {
  font-size: 8px !important;
  font-weight: 600 !important;
  color: rgba(246, 195, 67, 0.72) !important;
}

.top-parts-grid .oem-rec-card .oem-rec-card__price .product-price-compare {
  font-size: 9px !important;
}

.top-parts-grid .oem-rec-card .oem-rec-card__price .product-price-badge {
  font-size: 8px !important;
}

.oem-rec-card__cart {
  flex-shrink: 0;
  margin: 0;
  display: flex;
  align-items: center;
}

.oem-rec-card .top-selling-cart {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: var(--oem-rec-gold);
  color: #111;
  box-shadow: 0 2px 6px rgba(246, 195, 67, 0.22);
  transition:
    transform var(--oem-rec-transition),
    background var(--oem-rec-transition),
    box-shadow var(--oem-rec-transition);
}

.oem-rec-card .top-selling-cart:hover,
.oem-rec-card .top-selling-cart:focus-visible {
  background: #ffd76a;
  transform: translateY(-1px);
  box-shadow:
    0 3px 10px rgba(246, 195, 67, 0.35),
    0 0 8px rgba(246, 195, 67, 0.22);
}

.oem-rec-card .top-selling-cart svg {
  width: 12px;
  height: 12px;
}

/* Hide legacy vertical-only pieces (top-selling stars sit under the product name) */
.oem-rec-card .top-selling-title-row,
.oem-rec-card .product-rating:not(.top-selling-rating),
.oem-rec-card__oem,
.oem-rec-card__stock-col {
  display: none !important;
}

.oem-rec-card .top-selling-footer {
  padding-top: 0.5cm;
  padding-inline-end: 2px;
  padding-bottom: 0;
  padding-inline-start: 0;
  gap: 4px;
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .oem-rec-card,
  .oem-rec-card:hover,
  .oem-rec-card__media img,
  .oem-rec-card__media .product-brand-fallback,
  .oem-rec-card .top-selling-cart,
  .oem-rec-card .top-selling-cart:hover {
    transition: none !important;
    transform: none !important;
  }
}
