/* =============================================
   DealDoctor.Pro - Additional CSS (FULL REPLACEMENT)
   Paste into: Appearance > Customize > Additional CSS
   Click Publish. Then hard refresh / clear cache.
   ============================================= */

/* Hide header image on all pages except home */
body:not(.home) .custom-header,
body:not(.home) #content > a > img.custom-header {
  display: none !important;
}

/* Shop / product archive width */
body.woocommerce-shop #primary,
body.post-type-archive-product #primary,
body.tax-product_cat #primary,
body.tax-product_tag #primary {
  max-width: 1200px;
  width: 95%;
  margin-left: auto;
  margin-right: auto;
}

/* 3-column grid on product archives */
body.woocommerce-shop ul.products,
body.post-type-archive-product ul.products,
body.tax-product_cat ul.products,
body.tax-product_tag ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 26px !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Fix blank tile caused by clearfix pseudo-elements becoming grid items */
body.woocommerce-shop ul.products::before,
body.woocommerce-shop ul.products::after,
body.post-type-archive-product ul.products::before,
body.post-type-archive-product ul.products::after,
body.tax-product_cat ul.products::before,
body.tax-product_cat ul.products::after,
body.tax-product_tag ul.products::before,
body.tax-product_tag ul.products::after {
  content: none !important;
  display: none !important;
}

/* Product card baseline:
   Flex inside each tile so the button can be pushed to the bottom */
body.woocommerce-shop ul.products li.product,
body.post-type-archive-product ul.products li.product,
body.tax-product_cat ul.products li.product,
body.tax-product_tag ul.products li.product {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  clear: none !important;
  max-width: 100% !important;

  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
}

/* Do NOT constrain the link wrapper (it may contain title/price) */
body.woocommerce-shop ul.products li.product a.woocommerce-LoopProduct-link,
body.post-type-archive-product ul.products li.product a.woocommerce-LoopProduct-link,
body.tax-product_cat ul.products li.product a.woocommerce-LoopProduct-link,
body.tax-product_tag ul.products li.product a.woocommerce-LoopProduct-link {
  display: block;
  overflow: visible !important;
}

/* Images: consistent, no distortion */
body.woocommerce-shop ul.products li.product img,
body.post-type-archive-product ul.products li.product img,
body.tax-product_cat ul.products li.product img,
body.tax-product_tag ul.products li.product img {
  width: 100% !important;
  height: 240px !important;
  object-fit: contain !important;
  background: #f9f9f9;
  border-radius: 6px;
  display: block !important;
}

/* Titles: NO TRUNCATION (let them wrap naturally) */
body.woocommerce-shop ul.products li.product .woocommerce-loop-product__title,
body.post-type-archive-product ul.products li.product .woocommerce-loop-product__title,
body.tax-product_cat ul.products li.product .woocommerce-loop-product__title,
body.tax-product_tag ul.products li.product .woocommerce-loop-product__title {
  display: block !important;
  overflow: visible !important;
  white-space: normal !important;
  margin-top: 14px !important;
  margin-bottom: 10px !important;
}

/* Price spacing (and ensure visible) */
body.woocommerce-shop ul.products li.product .price,
body.post-type-archive-product ul.products li.product .price,
body.tax-product_cat ul.products li.product .price,
body.tax-product_tag ul.products li.product .price {
  display: block !important;
  visibility: visible !important;
  margin-bottom: 12px !important;
}

/* Button alignment: keep all buttons aligned at the bottom of each tile */
body.woocommerce-shop ul.products li.product .button,
body.post-type-archive-product ul.products li.product .button,
body.tax-product_cat ul.products li.product .button,
body.tax-product_tag ul.products li.product .button {
  margin-top: auto !important;
}

/* Sale badge: consistent top-right */
body.woocommerce-shop ul.products li.product .onsale,
body.post-type-archive-product ul.products li.product .onsale,
body.tax-product_cat ul.products li.product .onsale,
body.tax-product_tag ul.products li.product .onsale {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  z-index: 5 !important;
}

/* Tablet: 2 columns */
@media (max-width: 768px) {
  body.woocommerce-shop ul.products,
  body.post-type-archive-product ul.products,
  body.tax-product_cat ul.products,
  body.tax-product_tag ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px !important;
  }

  body.woocommerce-shop ul.products li.product img,
  body.post-type-archive-product ul.products li.product img,
  body.tax-product_cat ul.products li.product img,
  body.tax-product_tag ul.products li.product img {
    height: 220px !important;
  }
}

/* Mobile: 1 column */
@media (max-width: 480px) {
  body.woocommerce-shop ul.products,
  body.post-type-archive-product ul.products,
  body.tax-product_cat ul.products,
  body.tax-product_tag ul.products {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  body.woocommerce-shop ul.products li.product img,
  body.post-type-archive-product ul.products li.product img,
  body.tax-product_cat ul.products li.product img,
  body.tax-product_tag ul.products li.product img {
    height: 200px !important;
  }
}
