
/* ============================================================
   TechnicianMarket Filter Bar + Grid — v3.2 Mobile-First
   ============================================================ */
:root {
  --tm-black:  #0a0a0a;
  --tm-dark:   #1a1a1a;
  --tm-gray:   #6b7280;
  --tm-light:  #f4f4f5;
  --tm-border: #e4e4e7;
  --tm-white:  #ffffff;
  --tm-accent: #dc2626;
  --tm-green:  #16a34a;
  --tm-radius: 8px;
  --tm-shadow: 0 4px 24px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.05);
  --tm-font:   -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Shop Header ─────────────────────────────────────── */
.tm-shop-header {
  padding: 20px 0 14px;
  border-bottom: 2px solid var(--tm-black);
  margin-bottom: 0;
  width: 100%;
}
.tm-shop-title {
  font-family: var(--tm-font);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 800;
  color: var(--tm-black);
  margin: 0 0 4px;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.tm-shop-title span { color: var(--tm-accent); }
.tm-shop-subtitle {
  font-size: 13px;
  color: var(--tm-gray);
  margin: 0;
}

/* ── Filter Bar ──────────────────────────────────────── */
.tm-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--tm-white);
  border: 1.5px solid var(--tm-border);
  border-radius: var(--tm-radius);
  padding: 7px 10px;
  margin: 14px 0 0;
  position: relative;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

/* ── SKU Search ──────────────────────────────────────── */
.tm-fb-search {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 140px;
  max-width: 240px;
  background: var(--tm-light);
  border: 1.5px solid transparent;
  border-radius: calc(var(--tm-radius) - 2px);
  padding: 0 10px;
  height: 38px;
  transition: border-color .15s;
  box-sizing: border-box;
}
.tm-fb-search:focus-within {
  border-color: #2563eb;
  background: var(--tm-white);
}
.tm-fb-search input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 13.5px;
  color: var(--tm-black);
  width: 100%;
  font-family: var(--tm-font);
}
.tm-fb-search input::placeholder { color: var(--tm-gray); }

/* ── Buttons ─────────────────────────────────────────── */
.tm-fb-btn-wrap { position: relative; flex-shrink: 0; }
.tm-fb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 13px;
  background: var(--tm-white);
  border: 1.5px solid var(--tm-border);
  border-radius: var(--tm-radius);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tm-dark);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: border-color .15s, background .15s;
  font-family: var(--tm-font);
}
.tm-fb-btn:hover { border-color: var(--tm-black); background: var(--tm-light); }
.tm-fb-btn--active {
  background: var(--tm-black) !important;
  color: var(--tm-white) !important;
  border-color: var(--tm-black) !important;
}
.tm-fb-btn--toggle { background: var(--tm-light); }
.tm-fb-btn--toggle.tm-fb-btn--active {
  background: #dcfce7 !important;
  border-color: var(--tm-green) !important;
  color: var(--tm-green) !important;
}
.tm-fb-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  background: var(--tm-accent);
  border-radius: 50%;
  border: 1.5px solid var(--tm-white);
}
.tm-fb-btn--active .tm-fb-dot { border-color: var(--tm-black); }

/* Mobile toggle */
.tm-fb-mobile-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  background: var(--tm-black);
  border: none;
  border-radius: var(--tm-radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--tm-white);
  cursor: pointer;
  margin-left: auto;
  font-family: var(--tm-font);
}
.tm-fb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  background: var(--tm-accent);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

/* ── Dropdowns ───────────────────────────────────────── */
.tm-fb-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--tm-white);
  border: 1.5px solid var(--tm-border);
  border-radius: 10px;
  box-shadow: var(--tm-shadow);
  z-index: 99999;
  padding: 16px;
  animation: tmDrop .15s ease;
}
.tm-fb-dropdown--wide { min-width: 300px; }
.tm-fb-dropdown.is-open { display: block; }
@keyframes tmDrop {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── Vehicle Selector ────────────────────────────────── */
.tm-vs-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.tm-vs-col label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--tm-gray);
  margin-bottom: 4px;
}
.tm-vs-col select {
  width: 100%;
  height: 38px;
  border: 1.5px solid var(--tm-border);
  border-radius: var(--tm-radius);
  font-size: 13px;
  padding: 0 10px;
  background: var(--tm-white);
  cursor: pointer;
  font-family: var(--tm-font);
}
.tm-vs-col select:disabled { opacity: .4; cursor: not-allowed; }
.tm-vs-col select:focus { border-color: var(--tm-black); outline: none; }
.tm-vs-actions { display: flex; gap: 8px; }
.tm-btn-primary {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  background: var(--tm-black);
  color: var(--tm-white);
  border: none;
  border-radius: var(--tm-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--tm-font);
  transition: background .15s;
}
.tm-btn-primary:hover { background: var(--tm-accent); }
.tm-btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.tm-btn-ghost {
  height: 40px;
  padding: 0 14px;
  background: transparent;
  border: 1.5px solid var(--tm-border);
  border-radius: var(--tm-radius);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--tm-font);
}

/* ── Brand Dropdown ──────────────────────────────────── */
.tm-brand-search-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--tm-border);
  border-radius: var(--tm-radius);
  padding: 0 10px;
  height: 38px;
  margin-bottom: 8px;
}
.tm-brand-search-wrap input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 13.5px;
  width: 100%;
  font-family: var(--tm-font);
}
.tm-brand-list {
  max-height: 240px;
  overflow-y: auto;
}
.tm-brand-list::-webkit-scrollbar { width: 3px; }
.tm-brand-list::-webkit-scrollbar-thumb { background: var(--tm-border); border-radius: 3px; }
.tm-brand-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background .1s;
}
.tm-brand-item:hover { background: var(--tm-light); }
.tm-brand-item.active { background: var(--tm-black); color: var(--tm-white); font-weight: 600; }
.tm-brand-count {
  font-size: 11px;
  color: var(--tm-gray);
  background: var(--tm-light);
  padding: 1px 6px;
  border-radius: 10px;
}
.tm-brand-item.active .tm-brand-count { background: rgba(255,255,255,.15); color: rgba(255,255,255,.7); }
.tm-brand-loading { padding: 20px; text-align: center; color: var(--tm-gray); font-size: 13px; }

/* ── Price Dropdown ──────────────────────────────────── */
.tm-price-inputs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}
.tm-price-inputs label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--tm-gray);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tm-price-inputs input {
  height: 38px;
  width: 90px;
  border: 1.5px solid var(--tm-border);
  border-radius: var(--tm-radius);
  padding: 0 10px;
  font-size: 13.5px;
  font-family: var(--tm-font);
}
.tm-price-inputs span { font-size: 16px; color: var(--tm-gray); padding-bottom: 8px; }
.tm-price-shortcuts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tm-price-quick {
  font-size: 12px;
  padding: 4px 10px;
  border: 1.5px solid var(--tm-border);
  border-radius: 20px;
  background: var(--tm-white);
  cursor: pointer;
  font-family: var(--tm-font);
  transition: background .1s;
}
.tm-price-quick:hover { background: var(--tm-light); border-color: var(--tm-black); }

/* ── Results Bar ─────────────────────────────────────── */
.tm-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
  min-height: 28px;
  width: 100%;
}
#tm-results-count {
  font-size: 13px;
  color: var(--tm-gray);
  font-weight: 500;
}
.tm-clear-all {
  font-size: 13px;
  color: var(--tm-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-family: var(--tm-font);
}

/* ── WC Overrides ────────────────────────────────────── */
.woocommerce-result-count { display: none !important; }
.wp-block-query-title { display: none !important; }
.page-title { display: none !important; }

/* Sort dropdown */
.woocommerce-ordering { margin: 0 0 16px 0 !important; }
.woocommerce-ordering select {
  height: 38px;
  border: 1.5px solid var(--tm-border) !important;
  border-radius: var(--tm-radius) !important;
  padding: 0 12px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  background: var(--tm-white) !important;
  cursor: pointer;
  box-shadow: none !important;
  font-family: var(--tm-font) !important;
}
.woocommerce-ordering select:focus { border-color: var(--tm-black) !important; outline: none !important; }

/* ── Product Grid — Responsive ───────────────────────── */
.woocommerce ul.products,
ul.wc-block-grid__products,
.wp-block-woocommerce-product-collection ul {
  display: grid !important;
  gap: 14px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  /* Default: 5 columns on large desktop */
  grid-template-columns: repeat(5, 1fr) !important;
}

/* ── Product Cards ───────────────────────────────────── */
.woocommerce ul.products li.product {
  border: 1.5px solid var(--tm-border) !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: var(--tm-white) !important;
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  transition: transform .2s, box-shadow .2s, border-color .2s !important;
  display: flex !important;
  flex-direction: column !important;
}
.woocommerce ul.products li.product:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 28px rgba(0,0,0,.1) !important;
  border-color: #a1a1aa !important;
}
/* Consistent image box */
.woocommerce ul.products li.product img,
.woocommerce ul.products li.product .wp-post-image {
  width: 100% !important;
  height: 160px !important;
  object-fit: contain !important;
  padding: 10px !important;
  background: var(--tm-light) !important;
  display: block !important;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  padding: 8px 10px 4px !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  color: var(--tm-dark) !important;
  flex: 1 !important;
}
.woocommerce ul.products li.product .price {
  padding: 0 10px 6px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: var(--tm-black) !important;
  display: block !important;
}
.woocommerce ul.products li.product .button {
  display: block !important;
  margin: 0 10px 10px !important;
  text-align: center !important;
  padding: 8px 10px !important;
  border-radius: var(--tm-radius) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  background: var(--tm-black) !important;
  color: var(--tm-white) !important;
  border: none !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: background .15s !important;
  font-family: var(--tm-font) !important;
}
.woocommerce ul.products li.product .button:hover { background: var(--tm-accent) !important; }

/* Product page trust signals */
.tm-stock-info {
  padding: 10px 14px;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #86efac;
  margin: 10px 0;
  font-size: 14px;
  font-weight: 500;
}
.tm-fitment-info {
  padding: 10px 14px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  margin: 10px 0;
  font-size: 14px;
  font-weight: 500;
}

/* ── RESPONSIVE BREAKPOINTS ──────────────────────────── */

/* Large desktop 1400px+ → 5 columns */
@media (min-width: 1400px) {
  .woocommerce ul.products,
  ul.wc-block-grid__products {
    grid-template-columns: repeat(5, 1fr) !important;
  }
  .woocommerce ul.products li.product img { height: 160px !important; }
}

/* Desktop 1100-1399px → 4 columns */
@media (max-width: 1399px) and (min-width: 1100px) {
  .woocommerce ul.products,
  ul.wc-block-grid__products {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Small desktop / large tablet 768-1099px → 3 columns */
@media (max-width: 1099px) and (min-width: 768px) {
  .woocommerce ul.products,
  ul.wc-block-grid__products {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }
  .woocommerce ul.products li.product img { height: 150px !important; }
}

/* Tablet portrait 480-767px → 2 columns */
@media (max-width: 767px) and (min-width: 480px) {
  .woocommerce ul.products,
  ul.wc-block-grid__products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .woocommerce ul.products li.product img { height: 140px !important; }
}

/* Phone < 480px → 2 columns */
@media (max-width: 479px) {
  .woocommerce ul.products,
  ul.wc-block-grid__products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .woocommerce ul.products li.product img { height: 120px !important; }
  .woocommerce ul.products li.product .price { font-size: 13px !important; }
  .woocommerce ul.products li.product .button { font-size: 11px !important; padding: 7px 8px !important; }
}

/* ── Mobile Filter Bar ───────────────────────────────── */
@media (max-width: 767px) {

  /* Hide desktop filters, show mobile toggle */
  .tm-fb-btn-wrap,
  .tm-fb-btn--toggle {
    display: none !important;
  }
  .tm-fb-mobile-toggle {
    display: inline-flex !important;
    flex-shrink: 0;
  }
  .tm-fb-search {
    flex: 1;
    max-width: none;
  }

  /* Open state */
  .tm-filter-bar.tm-mobile-open .tm-fb-btn-wrap,
  .tm-filter-bar.tm-mobile-open .tm-fb-btn--toggle {
    display: flex !important;
    width: 100% !important;
  }
  .tm-filter-bar.tm-mobile-open {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }
  .tm-filter-bar.tm-mobile-open .tm-fb-btn {
    width: 100% !important;
    justify-content: space-between !important;
    height: 44px !important;
    font-size: 15px !important;
  }
  .tm-filter-bar.tm-mobile-open .tm-fb-mobile-toggle {
    width: 100% !important;
    justify-content: center !important;
    background: var(--tm-light) !important;
    color: var(--tm-dark) !important;
    border: 1.5px solid var(--tm-border) !important;
  }

  /* Dropdowns static on mobile */
  .tm-fb-dropdown {
    position: static !important;
    box-shadow: none !important;
    animation: none !important;
    border-radius: var(--tm-radius) !important;
    margin-top: 4px !important;
  }
  .tm-vehicle-selector { width: 100% !important; }
  .tm-vs-row { grid-template-columns: 1fr !important; }
  .tm-vs-col select { height: 44px !important; font-size: 15px !important; }
  .tm-btn-primary { height: 44px !important; font-size: 15px !important; }

  /* Sort + count on mobile */
  .woocommerce-ordering select { width: 100% !important; }
  .tm-shop-header { padding: 14px 0 10px; }
  .tm-shop-title { font-size: 22px; }
}

/* ══ CRITICAL OVERRIDES v3.2 ══════════════════════════════ */

/* Hide "Shop" H1 — filter bar is the hero */
h1.wp-block-post-title,
.wp-block-query-title,
.woocommerce-products-header h1,
.woocommerce-products-header,
h1.page-title,
.entry-title { display: none !important; }

/* Fix filter bar full width alignment */
.wc-block-grid,
.wp-block-woocommerce-product-collection,
.wc-block-product-template {
  width: 100% !important;
}

/* 5 COLUMNS — maximum specificity */
.woocommerce ul.products.columns-3,
.woocommerce ul.products.columns-4,
.woocommerce ul.products.columns-5,
.woocommerce ul.products {
  grid-template-columns: repeat(5, 1fr) !important;
}

/* Block editor product collection grid */
.wp-block-woocommerce-product-template,
.wc-block-product-template {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 14px !important;
}

/* 4 col at 1200px */
@media (max-width: 1300px) and (min-width: 1000px) {
  .woocommerce ul.products,
  .wp-block-woocommerce-product-template { grid-template-columns: repeat(4, 1fr) !important; }
}
/* 3 col at tablet */
@media (max-width: 999px) and (min-width: 680px) {
  .woocommerce ul.products,
  .wp-block-woocommerce-product-template { grid-template-columns: repeat(3, 1fr) !important; }
}
/* 2 col on phone */
@media (max-width: 679px) {
  .woocommerce ul.products,
  .wp-block-woocommerce-product-template { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
}

/* Product card clean minimal style */
.woocommerce ul.products li.product,
.wc-block-product-template li {
  border: 1px solid var(--tm-border) !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #fff !important;
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  transition: box-shadow .2s, border-color .2s !important;
}
.woocommerce ul.products li.product:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.09) !important;
  border-color: #a1a1aa !important;
}
.woocommerce ul.products li.product img {
  width: 100% !important;
  height: 155px !important;
  object-fit: contain !important;
  background: #f9fafb !important;
  padding: 10px !important;
  box-sizing: border-box !important;
  display: block !important;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  padding: 8px 10px 4px !important;
  flex: 1 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}
.woocommerce ul.products li.product .price {
  padding: 2px 10px 6px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #0a0a0a !important;
}
.woocommerce ul.products li.product .button {
  display: block !important;
  margin: 0 10px 10px !important;
  padding: 8px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  background: #0a0a0a !important;
  color: #fff !important;
  text-align: center !important;
  border: none !important;
  text-decoration: none !important;
}
.woocommerce ul.products li.product .button:hover { background: #dc2626 !important; }

/* Pagination clean */
.wc-block-pagination, .woocommerce-pagination {
  margin: 24px 0 !important;
  text-align: center !important;
}
