/*
 Theme Name:   Shoptimizer Child
 Theme URI:    https://youfixthis.instant-manuals.com
 Description:  Child theme for Shoptimizer - Instant Manuals product styling
 Author:       Instant Manuals
 Template:     shoptimizer
 Version:      1.0.7

 COLOR PALETTE:
   --primary:    #1E48A6  (logo blue)
   --primary-h:  #2B5FCC  (hover blue)
   --dark:       #31353B  (logo graphite — headings, table headers)
   --accent:     #E8920D  (amber — CTA, highlights)
   --success:    #28845A  (green — checks, confirmation)
   --text:       #31353B  (body text)
   --text-2:     #6B7280  (secondary text)
   --text-3:     #9CA3AF  (muted text)
   --border:     #E5E7EB  (borders, dividers)
   --bg-alt:     #F4F6F8  (alternate backgrounds)
   --bg-tint:    #EDF1FA  (primary tint — hovers, active)
*/

/* =============================================
   BUTTONS — Subtle hover lift + amber glow
   ============================================= */
.single_add_to_cart_button,
.add_to_cart_button,
.button.alt,
.checkout-button {
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(232, 146, 13, 0.2) !important;
}
.single_add_to_cart_button:hover,
.add_to_cart_button:hover,
.button.alt:hover,
.checkout-button:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(232, 146, 13, 0.4) !important;
}
.single_add_to_cart_button:active,
.add_to_cart_button:active,
.button.alt:active,
.checkout-button:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 6px rgba(232, 146, 13, 0.2) !important;
}

/* =============================================
   HEADER — Mobile logo fix
   ============================================= */
@media (max-width: 768px) {
  .site-branding .custom-logo {
    max-height: 36px !important;
    width: auto !important;
    max-width: none !important;
  }
}

/* =============================================
   SHORT DESCRIPTION - Quick Facts
   ============================================= */

.manual-quick-facts {
  margin: 0 0 5px;
  font-size: 0.93em;
  color: #31353B;
  line-height: 1.7;
}
.manual-quick-facts .fact-row {
  font-weight: 700;
  margin-bottom: 12px;
}
.manual-quick-facts .fact-row .sep {
  color: #D1D5DB;
  margin: 0 6px;
}
.manual-quick-facts .features {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.manual-quick-facts .features li {
  padding: 1px 0;
}
.manual-quick-facts .features .check {
  color: #28845A;
  margin-right: 4px;
}
/* Compatibility block (model/years/serial) */
.compat-block {
  font-size: 0.95em;
  color: #374151;
  margin-bottom: 10px;
}
.compat-row {
  margin-bottom: 2px;
}
.compat-row .pipe {
  font-weight: 400;
  color: #9CA3AF;
}

/* Authority line */
.authority-line {
  font-style: italic;
  color: #6B7280;
  font-size: 0.88em;
  margin: 8px 0 4px;
}

/* Device line */
.device-line {
  color: #6B7280;
  font-size: 0.85em;
  margin: 4px 0 6px;
}

/* Trustpilot Badge */
.im-trustpilot {
  margin: 4px 0 6px;
}
.im-trustpilot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #191919;
  font-size: 0.88em;
  line-height: 1;
}
.im-trustpilot a:hover {
  text-decoration: underline;
  color: #00B67A;
}
.im-tp-star {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.im-tp-text {
  margin-left: 2px;
  white-space: nowrap;
}
.im-tp-logo {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin: 0 1px;
}
@media (max-width: 768px) {
  .im-trustpilot a {
    font-size: 0.82em;
    gap: 4px;
  }
  .im-tp-star {
    width: 15px;
    height: 15px;
  }
}

/* Product title — tighter */
h1.product_title.entry-title {
  font-size: 1.4em !important;
  line-height: 1.25 !important;
}

/* Price - larger and bolder */
.summary .price {
  font-size: 2.8em;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E5E7EB;
}
.summary .price ins {
  font-weight: 800;
}

/* Short description spacing */
.summary .woocommerce-product-details__short-description {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #E5E7EB;
}

/* PDF Preview Link */
.preview-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  margin-top: 8px;
  font-size: 0.9em;
  font-weight: 700;
  color: #1E48A6;
  text-decoration: underline;
}
.preview-pdf-icon {
  width: 0.8em;
  height: 0.8em;
  flex-shrink: 0;
}
.preview-pdf-link:hover {
  color: #2B5FCC;
}

/* Cart Drawer — payment icons (greyscale) */
.im-cart-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  filter: grayscale(100%);
  opacity: 0.4;
}
.im-cart-text {
  font-size: 12px;
  color: #888;
  text-align: center;
}

/* Trust Badges (below Add to Cart) */
.trust-badges {
  font-size: 0.8em;
  color: #6B7280;
  text-align: center;
  margin-top: 12px;
}
.trust-sep {
  margin: 0 8px;
  color: #D1D5DB;
}

/* =============================================
   PRODUCT PAGE - Manual Description Styles
   ============================================= */

/* Pain Hook */
.pain-hook {
  background: #FEF6E7;
  border-left: 4px solid #E8920D;
  padding: 15px 20px;
  margin: 20px 0;
  font-size: 1.05em;
  line-height: 1.6;
  border-radius: 0 4px 4px 0;
}

/* Systems Coverage Table */
.systems-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0 25px;
  font-size: 0.95em;
}
.systems-table thead th {
  background: #31353B;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}
.systems-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #E5E7EB;
}
.systems-table tbody td:nth-child(2) {
  white-space: nowrap;
}
.systems-table tbody tr:nth-child(even) {
  background: #F4F6F8;
}
.systems-table tbody tr:hover {
  background: #EDF1FA;
}

/* Quick Reference Specs Table */
.quick-reference {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0 25px;
  font-size: 0.95em;
}
.quick-reference thead th {
  background: #31353B;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}
.quick-reference tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #E5E7EB;
}
.quick-reference tbody tr:nth-child(even) {
  background: #F4F6F8;
}
.quick-reference tbody td:nth-child(2) {
  font-weight: 600;
  color: #31353B;
}
.quick-reference tbody td:nth-child(3) {
  color: #6B7280;
  font-size: 0.9em;
}

/* Problems List - accordion */
.problems-list {
  margin: 8px 0 20px;
  columns: 2;
  column-gap: 16px;
}
.problem-item {
  break-inside: avoid;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  margin: 6px 0;
  overflow: hidden;
}
.problem-item summary {
  padding: 10px 36px 10px 28px;
  font-size: 0.9em;
  font-weight: 600;
  color: #31353B;
  cursor: pointer;
  background: #fff;
  list-style: none;
  position: relative;
  line-height: 1.35;
}
.problem-item summary::-webkit-details-marker { display: none; }
.problem-item summary::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 16px;
  width: 7px;
  height: 7px;
  background: #e74c3c;
  border-radius: 50%;
}
.problem-item summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1em;
  font-weight: 400;
  color: #9CA3AF;
}
.problem-item[open] summary::after {
  content: "\2212";
}
.problem-item[open] summary {
  border-bottom: 1px solid #E5E7EB;
}
.problem-item .pg {
  color: #9CA3AF;
  font-size: 0.85em;
  font-weight: 400;
}
.problem-body {
  padding: 12px 16px;
  background: #F4F6F8;
}
.problem-solution {
  margin: 0;
  font-size: 0.88em;
  color: #31353B;
  line-height: 1.5;
}
.problem-section {
  display: block;
  margin-top: 8px;
  font-size: 0.8em;
  color: #9CA3AF;
  font-style: italic;
}

/* FAQ Accordion */
.faq-section details {
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  margin: 8px 0;
  overflow: hidden;
}
.faq-section details summary {
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  background: #F4F6F8;
  list-style: none;
  position: relative;
  padding-right: 40px;
}
.faq-section details summary::-webkit-details-marker {
  display: none;
}
.faq-section details summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3em;
  font-weight: 300;
  color: #6B7280;
  transition: transform 0.2s;
}
.faq-section details[open] summary::after {
  content: "\2212";
}
.faq-section details[open] summary {
  border-bottom: 1px solid #E5E7EB;
  background: #EDF1FA;
}
.faq-section details p {
  padding: 15px 18px;
  margin: 0;
  line-height: 1.6;
  color: #31353B;
}

/* Responsive */
@media (max-width: 768px) {
  .manual-quick-facts { font-size: 0.9em; }
  .manual-quick-facts .fact-row { font-size: 0.95em; }
  .compat-block { font-size: 0.85em; }
  .trust-badges { font-size: 0.78em; }
  .systems-table,
  .quick-reference {
    font-size: 0.85em;
  }
  .systems-table thead th,
  .quick-reference thead th,
  .systems-table tbody td,
  .quick-reference tbody td {
    padding: 6px 8px;
  }
  .problems-list {
    columns: 1;
  }
}

/* =============================================
   SHOP/ARCHIVE/SEARCH — Compact List View
   ============================================= */

/* Products container — vertical stack */
.im-list-view ul.products {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Each product — horizontal row */
.im-list-view ul.products li.product {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px !important;
  margin: 0;
  width: 100% !important;
  border-bottom: 1px solid #D1D5DB;
  float: none !important;
}
.im-list-view ul.products li.product:hover {
  background: #F4F6F8;
}
/* Disable all Shoptimizer hover transforms in list view */
.im-list-view ul.products li.product:hover .woocommerce-image__wrapper,
.im-list-view ul.products li.product:hover .woocommerce-image__wrapper img,
.im-list-view ul.products li.product:hover .woocommerce-card__header,
.im-list-view ul.products li.product:hover img {
  transform: none !important;
  transition: none !important;
}

/* Shoptimizer image wrapper — shrink to thumbnail size */
.im-list-view ul.products li.product .woocommerce-image__wrapper {
  flex: 0 0 50px;
  display: flex;
  align-items: center;
}

/* Shoptimizer card header — grid layout: title+meta stacked, price+button right */
.im-list-view ul.products li.product .woocommerce-card__header {
  flex: 1;
  align-self: center !important;
  height: fit-content;
  display: grid !important;
  grid-template-columns: 1fr auto auto;
  grid-template-rows: auto auto;
  gap: 4px 16px;
  align-items: center;
  min-width: 0;
  margin: 0 !important;
  padding: 0;
}

/* Hide Shoptimizer extras not needed in list view */
.im-list-view ul.products li.product .sale-item.product-label,
.im-list-view ul.products li.product .product__categories {
  display: none !important;
}

/* Thumbnail column */
.im-list-thumb {
  flex: 0 0 50px;
  width: 50px;
  height: 65px;
  overflow: hidden;
  border-radius: 3px;
  background: #F4F6F8;
}
.im-list-thumb img {
  width: 50px;
  height: 65px;
  object-fit: cover;
}

/* Title — row 1, left column */
.im-list-view ul.products li.product .woocommerce-loop-product__title {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  font-size: 0.95em;
  font-weight: 700;
  margin: 0;
  padding: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Title link inside the div */
.im-list-view ul.products li.product .woocommerce-loop-product__title a {
  color: inherit;
  text-decoration: none;
}
.im-list-view ul.products li.product .woocommerce-loop-product__title a:hover {
  color: #1E48A6;
}

/* Override Shoptimizer product link (image wrapper link) to not be block */
.im-list-view ul.products li.product a.woocommerce-LoopProduct-link {
  display: contents;
}

/* Meta — row 2, left column (below title) */
.im-list-meta {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

/* Badges */
.im-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.4;
}
.im-badge--service {
  background: #EDF1FA;
  color: #1E48A6;
}
.im-badge--parts {
  background: #E8F5E9;
  color: #28845A;
}
.im-badge--operator {
  background: #F4F6F8;
  color: #6B7280;
}
.im-badge--workshop {
  background: #FEF3E2;
  color: #B5700A;
}

/* Page count */
.im-list-pages {
  font-size: 0.82em;
  color: #9CA3AF;
}

/* Price — spans both rows, stacked vertically (old price above, sale price below) */
.im-list-view ul.products li.product .price {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex !important;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  font-size: 1em;
  font-weight: 700;
  margin: 0;
  padding: 0;
  align-self: center;
}

/* Add to Cart + View Cart buttons — spans both rows, vertically centered */
.im-list-view ul.products li.product .button,
.im-list-view ul.products li.product .add_to_cart_button,
.im-list-view ul.products li.product .added_to_cart {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  width: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  position: static !important;
  opacity: 1 !important;
  padding: 6px 16px;
  font-size: 0.82em;
  white-space: nowrap;
  margin: 0;
  height: auto !important;
  min-height: 0 !important;
}

/* After adding to cart: hide "Add to cart" button, show only "View cart" */
.im-list-view ul.products li.product .button.added {
  display: none !important;
}

/* Hide elements not needed in list view */
.im-list-view ul.products li.product .shoptimizer-out-of-stock,
.im-list-view ul.products li.product .star-rating,
.im-list-view ul.products li.product .attachment-woocommerce_thumbnail {
  display: none !important;
}

/* Results count + sorting — inline */
.im-list-view .woocommerce-result-count,
.im-list-view .woocommerce-ordering {
  margin-bottom: 12px;
}

/* ----- Mobile list view ----- */
@media (max-width: 768px) {
  /* Hide Add to Cart button on mobile — tap product to buy */
  .im-list-view ul.products li.product .button,
  .im-list-view ul.products li.product .add_to_cart_button,
  .im-list-view ul.products li.product .added_to_cart {
    display: none !important;
  }
  .im-list-view ul.products li.product {
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 14px 12px !important;
  }
  /* Row 1: thumb + title + badge */
  .im-list-thumb {
    flex: 0 0 40px;
    width: 40px;
    height: 52px;
  }
  .im-list-thumb img {
    width: 40px;
    height: 52px;
  }
  /* Mobile grid: title full-width, badge+price on row 2 */
  .im-list-view ul.products li.product .woocommerce-card__header {
    grid-template-columns: 1fr auto !important;
    gap: 4px 8px;
  }
  .im-list-view ul.products li.product .woocommerce-loop-product__title {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    font-size: 0.82em;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .im-list-view ul.products li.product .im-list-meta {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }
  .im-list-view ul.products li.product .price {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: center !important;
    font-size: 0.9em;
  }
  .im-list-pages {
    display: none;
  }
}

/* =============================================
   RELATED PRODUCTS — List View (single product page)
   ============================================= */
.im-related-list .related.products > h2 {
  font-size: 1.3em;
  margin-bottom: 16px;
}
/* Override Shoptimizer grid columns — force single column list */
.im-related-list .related.products ul.products {
  grid-template-columns: 1fr !important;
}

/* Brand grid CSS → IM Brand Grid plugin (S59) */

/* Shop page H1 — override Gutenberg inline clamp(16.8px..26px) */
.woocommerce-products-header .page-description h1.wp-block-heading {
  font-size: clamp(1.75rem, 1.5rem + 1.5vw, 2.25rem) !important;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

/* Hide default WC subcategory grid on shop page when list view active */
.im-list-view .woocommerce ul.products li.product-category {
  display: none !important;
}

/* =============================================
   Subcategory pills on parent brand pages
   ============================================= */
.im-subcat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 24px;
  padding: 0;
}
.im-subcat-pill {
  display: inline-block;
  padding: 8px 22px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  /* fallback for unknown types */
  background: #F4F6F8;
  color: #6B7280;
}
.im-subcat-pill:hover {
  filter: brightness(0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}
.im-subcat-pill:active {
  filter: brightness(0.9);
}
/* Reuse badge colors */
.im-subcat-pill.im-badge--service  { background: #EDF1FA; color: #1E48A6; }
.im-subcat-pill.im-badge--parts    { background: #E8F5E9; color: #28845A; }
.im-subcat-pill.im-badge--operator { background: #F4F6F8; color: #6B7280; }
.im-subcat-pill.im-badge--workshop { background: #FEF3E2; color: #B5700A; }

@media (max-width: 768px) {
  .im-subcat-pills {
    gap: 8px;
  }
  .im-subcat-pill {
    padding: 7px 16px;
    font-size: 0.85em;
  }
}

/* Override Shoptimizer mobile card layout for related products — keep list view */
@media (max-width: 992px) {
  .im-related-list .related.products ul.products li.product {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 14px 12px !important;
  }
  .im-related-list .related.products ul.products li.product .woocommerce-image__wrapper {
    flex: 0 0 auto;
  }
  .im-related-list .related.products ul.products li.product .woocommerce-card__header {
    flex: 1;
    min-width: 0;
  }
}

