/**
 * TWD Vehicle Fitment - Product Archive Card Design
 *
 * Dedicated stylesheet for WooCommerce product grid & archive cards.
 * Matches exact high-converting specification design:
 * - Brand pill badge (top left)
 * - Model | Finish prominent heading
 * - 3-column spec tiles (Size, Bolt Pattern, Offset)
 * - Big blue price with strikethrough regular price
 * - Clean SKU line
 * - Side-by-side Action Row: Quantity Stepper + Add To Cart Button
 * - Affirm financing text
 * - Sale badge pill (-39%)
 *
 * TO CUSTOMIZE: You can change the CSS variables below!
 */

:root {
  /* Brand & Button Colors */
  --twdvf-card-brand-bg: #003764;
  --twdvf-card-brand-color: #ffffff;
  --twdvf-card-btn-bg: #003764;
  --twdvf-card-btn-hover: #002544;
  --twdvf-card-btn-color: #ffffff;

  /* Typography Colors */
  --twdvf-card-heading-color: #0b1526;
  --twdvf-card-sep-color: #94a3b8;
  --twdvf-card-price-color: #00487a;
  --twdvf-card-price-del: #94a3b8;
  --twdvf-card-sku-color: #64748b;

  /* Spec Tiles */
  --twdvf-card-spec-bg: #eaf1f8;
  --twdvf-card-spec-label: #475569;
  --twdvf-card-spec-val: #0b1526;

  /* Card Container */
  --twdvf-card-bg: #ffffff;
  --twdvf-card-border: #e2e8f0;
  --twdvf-card-border-hover: #cbd5e1;
  --twdvf-card-radius: 14px;
  --twdvf-card-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  --twdvf-card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.08);

  /* Sale Badge */
  --twdvf-card-sale-bg: #ffffff;
  --twdvf-card-sale-border: #003764;
  --twdvf-card-sale-color: #003764;
}

/* ==========================================================================
   1. Card Outer Shell
   ========================================================================== */
.product-grid-item .product-wrapper,
.wd-product.product-grid-item .wd-product-wrapper {
  background: var(--twdvf-card-bg) !important;
  border: 1px solid var(--twdvf-card-border) !important;
  border-radius: var(--twdvf-card-radius) !important;
  padding: 16px 18px 18px 18px !important;
  box-shadow: var(--twdvf-card-shadow) !important;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  position: relative !important;
}

.product-grid-item .product-wrapper:hover,
.wd-product.product-grid-item .wd-product-wrapper:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--twdvf-card-shadow-hover) !important;
  border-color: var(--twdvf-card-border-hover) !important;
}

/* ==========================================================================
   2. Image & Sale Badge (-39%)
   ========================================================================== */
.product-grid-item .wd-product-thumb,
.product-grid-item .product-element-top {
  position: relative !important;
  margin-bottom: 12px !important;
  width: 100% !important;
  text-align: center !important;
}

.product-grid-item .wd-product-thumb img,
.product-grid-item .product-image-link img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  margin: 0 auto !important;
  display: block !important;
}

/* Sale Discount Pill Badge (Top Right) */
.product-grid-item .product-labels,
.product-grid-item .labels-rounded {
  position: absolute !important;
  top: 6px !important;
  right: 6px !important;
  left: auto !important;
  z-index: 4 !important;
}

.product-grid-item .product-label.onsale,
.product-grid-item span.onsale {
  background: var(--twdvf-card-sale-bg) !important;
  color: var(--twdvf-card-sale-color) !important;
  border: 1.5px solid var(--twdvf-card-sale-border) !important;
  border-radius: 6px !important;
  padding: 2px 8px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  min-width: auto !important;
  min-height: auto !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
  display: inline-block !important;
}

/* Hide floating WoodMart hover buttons for clean look */
.product-grid-item .wd-buttons {
  display: none !important;
}

/* ==========================================================================
   3. Title Card & Heading Structure
   ========================================================================== */
.wd-entities-title {
  margin: 0 0 4px 0 !important;
  text-align: left !important;
  width: 100% !important;
}

.wd-entities-title a {
  text-decoration: none !important;
  color: inherit !important;
  display: block !important;
}

.twdvf-title-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  text-align: left !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Brand Pill Tag (e.g. FUEL FORGED) */
.twdvf-title-brand {
  display: inline-block !important;
  background: var(--twdvf-card-brand-bg) !important;
  color: var(--twdvf-card-brand-color) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  line-height: 1.3 !important;
  margin-bottom: 6px !important;
  text-align: left !important;
}

/* Model | Finish Heading Line */
.twdvf-title-heading {
  display: flex !important;
  align-items: baseline !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  width: 100% !important;
  margin: 2px 0 6px 0 !important;
  text-align: left !important;
}

.twdvf-title-model {
  display: inline !important;
  font-size: 21px !important;
  font-weight: 900 !important;
  color: var(--twdvf-card-heading-color) !important;
  letter-spacing: -0.02em !important;
  line-height: 1.15 !important;
}

.twdvf-title-sep {
  display: inline !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  color: var(--twdvf-card-sep-color) !important;
  margin: 0 3px !important;
  line-height: 1 !important;
}

.twdvf-title-finish {
  display: inline !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  color: var(--twdvf-card-heading-color) !important;
  text-transform: uppercase !important;
  line-height: 1.15 !important;
}

/* ==========================================================================
   4. 3-Column Spec Tiles (SIZE | BOLT PATTERN | OFFSET)
   ========================================================================== */
.twdvf-title-specs-grid,
.twdvf-title-specs {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px !important;
  width: 100% !important;
  margin: 8px 0 10px 0 !important;
  text-align: center !important;
}

.twdvf-spec-tile {
  background: var(--twdvf-card-spec-bg) !important;
  border-radius: 6px !important;
  padding: 6px 4px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  box-sizing: border-box !important;
  min-height: 44px !important;
}

.twdvf-spec-label {
  display: block !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: var(--twdvf-card-spec-label) !important;
  margin-bottom: 2px !important;
  line-height: 1.1 !important;
}

.twdvf-spec-val,
.twdvf-badge-size,
.twdvf-badge-spec {
  display: block !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  color: var(--twdvf-card-spec-val) !important;
  line-height: 1.2 !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  text-transform: none !important;
}

/* ==========================================================================
   5. Price Section ($815.00 $1,328.45)
   ========================================================================== */
.product-grid-item span.price,
.product-grid-item .price {
  display: flex !important;
  align-items: baseline !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin: 4px 0 2px 0 !important;
  text-align: left !important;
  width: 100% !important;
  line-height: 1.2 !important;
}

/* Sale Price ($815.00) */
.product-grid-item span.price ins,
.product-grid-item span.price > .amount,
.product-grid-item span.price ins .amount {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: var(--twdvf-card-price-color) !important;
  text-decoration: none !important;
  order: 1 !important;
}

/* Original Strikethrough Price ($1,328.45) */
.product-grid-item span.price del,
.product-grid-item span.price del .amount {
  font-size: 14.5px !important;
  font-weight: 500 !important;
  color: var(--twdvf-card-price-del) !important;
  text-decoration: line-through !important;
  order: 2 !important;
  opacity: 0.85 !important;
}

/* ==========================================================================
   6. SKU Line (SKU FF001MD2000XXE)
   ========================================================================== */
.twdvf-card-sku {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 5px !important;
  font-size: 12px !important;
  margin: 2px 0 10px 0 !important;
  text-align: left !important;
  width: 100% !important;
}

.twdvf-card-sku span {
  font-weight: 700 !important;
  color: var(--twdvf-card-sku-color) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

.twdvf-card-sku strong {
  font-weight: 800 !important;
  color: var(--twdvf-card-heading-color) !important;
  letter-spacing: 0.02em !important;
}

/* ==========================================================================
   7. Action Row: Quantity Stepper + ADD TO CART Button
   ========================================================================== */
.twdvf-card-action-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
  margin: 6px 0 6px 0 !important;
}

/* Quantity Stepper [ -  4  + ] */
.twdvf-card-quantity {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex: 0 0 105px !important;
  width: 105px !important;
  height: 42px !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
  padding: 0 2px !important;
  margin: 0 !important;
}

.twdvf-card-quantity button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 38px !important;
  background: transparent !important;
  border: none !important;
  color: #0f172a !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.twdvf-card-quantity button:hover {
  background: #f1f5f9 !important;
  border-radius: 4px !important;
  color: var(--twdvf-card-brand-bg) !important;
}

.twdvf-card-quantity input[type="number"],
.twdvf-card-quantity input[data-twdvf-quantity-input] {
  width: 40px !important;
  height: 38px !important;
  border: none !important;
  background: transparent !important;
  text-align: center !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  -moz-appearance: textfield !important;
}

.twdvf-card-quantity input[type="number"]::-webkit-outer-spin-button,
.twdvf-card-quantity input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

/* ADD TO CART Button */
.twdvf-card-action-row .wd-add-btn,
.product-grid-item .wd-add-btn {
  flex: 1 1 auto !important;
  margin: 0 !important;
  position: static !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.twdvf-card-action-row .wd-add-btn a.button,
.product-grid-item .wd-add-btn a.button,
.product-grid-item a.add_to_cart_button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  background: var(--twdvf-card-btn-bg) !important;
  color: var(--twdvf-card-btn-color) !important;
  height: 42px !important;
  line-height: 42px !important;
  padding: 0 14px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border: none !important;
  box-shadow: none !important;
  transition: background 0.18s ease !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.twdvf-card-action-row .wd-add-btn a.button:hover,
.product-grid-item .wd-add-btn a.button:hover,
.product-grid-item a.add_to_cart_button:hover {
  background: var(--twdvf-card-btn-hover) !important;
  color: var(--twdvf-card-btn-color) !important;
}

/* SVG Shopping Cart Icon inside ADD TO CART */
.twdvf-card-action-row .wd-add-btn a.button::before,
.product-grid-item .wd-add-btn a.button::before {
  content: "" !important;
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  background-color: currentColor !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'%3E%3C/circle%3E%3Ccircle cx='20' cy='21' r='1'%3E%3C/circle%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'%3E%3C/path%3E%3C/svg%3E") no-repeat center !important;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'%3E%3C/circle%3E%3Ccircle cx='20' cy='21' r='1'%3E%3C/circle%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'%3E%3C/path%3E%3C/svg%3E") no-repeat center !important;
  mask-size: contain !important;
  -webkit-mask-size: contain !important;
  flex-shrink: 0 !important;
}

.product-grid-item .wd-add-btn .wd-action-icon {
  display: none !important;
}

.product-grid-item .wd-add-btn .wd-action-text {
  display: inline !important;
  font-weight: 800 !important;
  letter-spacing: 0.05em !important;
}

/* ==========================================================================
   8. Affirm Financing Text
   ========================================================================== */
.product-grid-item .affirm-as-low-as,
.product-grid-item #learn-more {
  font-size: 12px !important;
  color: #475569 !important;
  text-align: center !important;
  margin: 6px auto 0 auto !important;
  width: 100% !important;
  line-height: 1.4 !important;
}

/* ==========================================================================
   9. Cleanups & Suppress Redundant Elements
   ========================================================================== */
/* Hide duplicate categories line in WoodMart */
.product-grid-item .wd-product-cats,
.product-grid-item .product-cats,
.product-grid-item .woocommerce-loop-product__categories,
.wd-entities-title + .wd-product-cats,
.woocommerce-loop-product__title + .wd-product-cats {
  display: none !important;
}
