/* ============================================================
   iDEALCAR — PRODUCTS / SHOP PAGE
   ============================================================ */

.content-section { max-width: var(--max-width); margin: 0 auto; padding: 44px 24px 80px; }
.page-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; margin-bottom: 8px; }
.page-subtitle { color: var(--color-text-muted); margin-bottom: 30px; font-size: 15px; }

/* ── LAYOUT: left filter sidebar + right products panel ──── */
.products-layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.filter-sidebar {
  flex: 0 0 270px;
  width: 270px;
  position: sticky;
  top: calc(var(--header-height) + var(--banner-height) + 20px);
  max-height: calc(100vh - var(--header-height) - var(--banner-height) - 40px);
  overflow-y: auto;
  padding-right: 4px;
}

.filter-sidebar-toggle {
  display: none; /* shown only on mobile/tablet */
  width: 100%;
  align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border: 2px solid var(--color-border); border-radius: var(--radius-sm);
  background: #fff; font-size: 14px; font-weight: 700;
  margin-bottom: 14px;
}
.filter-sidebar-toggle span { display: flex; align-items: center; gap: 8px; }
.filter-sidebar-toggle .chevron { transition: transform var(--transition); }
.filter-sidebar-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.filter-sidebar-body { display: flex; flex-direction: column; gap: 18px; }

.search-bar-wrapper { position: relative; }
.search-bar-wrapper input {
  width: 100%; padding: 13px 20px 13px 46px; border: 2px solid var(--color-border);
  border-radius: var(--radius-sm); font-size: 15px; outline: none;
  transition: border-color var(--transition);
}
.search-bar-wrapper input:focus { border-color: var(--color-red); }
.search-bar-wrapper .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #999; pointer-events: none; }

.results-count { font-size: 13.5px; color: var(--color-text-muted); font-weight: 600; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-row.filter-col { flex-direction: column; align-items: stretch; }

.brand-btn, .category-btn, .vehicle-btn {
  padding: 9px 18px; border: 2px solid var(--color-border); border-radius: 30px;
  background: #fff; font-size: 13px; font-weight: 600; transition: all var(--transition);
  text-align: left;
}
.filter-col .brand-btn, .filter-col .category-btn, .filter-col .vehicle-btn { border-radius: var(--radius-sm); }
.brand-btn.active, .category-btn.active, .vehicle-btn.active {
  background: var(--color-gradient); border-color: transparent; color: #fff;
}
.brand-btn:hover, .category-btn:hover, .vehicle-btn:hover { border-color: var(--color-red); color: var(--color-red); }
.brand-btn.active:hover, .category-btn.active:hover, .vehicle-btn.active:hover { color: #fff; }

/* ── Accordion filter groups (Brand / Category / Vehicle Fitment) ── */
.filter-group {
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden;
}
.filter-group-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--color-bg-soft); border: none;
  font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--color-text); cursor: pointer;
}
.filter-group-header .chevron { transition: transform var(--transition); flex-shrink: 0; }
.filter-group.open .filter-group-header .chevron,
.filter-group-header[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.filter-group-header:hover { color: var(--color-red); }

.filter-group-body {
  max-height: 0; overflow: hidden;
  transition: max-height var(--transition);
}
.filter-group.open .filter-group-body { max-height: 320px; overflow-y: auto; }
.filter-group-body .filter-row { padding: 12px; }

/* Sort/Filter-by isn't collapsible — always visible, styled like the accordion groups */
.filter-group:has(.sort-wrapper) { border: none; }
.sort-wrapper { display: flex; flex-direction: column; gap: 8px; }
.sort-wrapper label {
  font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--color-text-muted);
}
.sort-wrapper select {
  padding: 11px 14px; border: 2px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; cursor: pointer; transition: border-color var(--transition);
  width: 100%;
}
.sort-wrapper select:focus { border-color: var(--color-red); }

/* ── Right panel: product grid with dividing lines between items ── */
.products-main { flex: 1; min-width: 0; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.product-card {
  position: relative; border: none; border-radius: 0;
  overflow: hidden; background: #fff; display: flex; flex-direction: column;
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-6px); position: relative; z-index: 1; }
.product-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--color-gradient); color: #fff; font-size: 11px; font-weight: 700;
  padding: 5px 12px; border-radius: 20px;
}
.product-image { width: 100%; height: 190px; object-fit: cover; background: var(--color-bg-soft); cursor: zoom-in; transition: transform 0.5s var(--ease); }
.product-card:hover .product-image { transform: scale(1.07); }
.product-info { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.product-brand { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--color-red); margin-bottom: 5px; }
.product-title { font-size: 15.5px; font-weight: 700; line-height: 1.35; margin-bottom: 8px; }
.product-description {
  font-size: 13px; color: var(--color-text-muted); line-height: 1.6; margin-bottom: 12px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

.product-meta-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.meta-tag { font-size: 11px; padding: 3px 9px; border-radius: 12px; background: var(--color-bg-soft); color: #555; font-weight: 600; }
.meta-tag.vehicle { background: #e8f0fe; color: #1a56db; }

.product-footer { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.product-footer .quote-btn, .product-footer .learn-more-btn {
  flex: 1; min-width: 0; padding: 10px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.no-products { text-align: center; padding: 70px 20px; color: var(--color-text-muted); font-size: 15px; grid-column: 1 / -1; }

/* ── Tablet: sidebar becomes a collapsible panel stacked above the grid ── */
@media (max-width: 900px) {
  .products-layout { flex-direction: column; gap: 16px; }

  .filter-sidebar {
    width: 100%; flex-basis: auto;
    position: static; max-height: none; overflow-y: visible;
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    padding: 14px;
  }
  .filter-sidebar-toggle { display: flex; margin-bottom: 0; border: none; padding: 0; }

  .filter-sidebar-body {
    max-height: 0; overflow: hidden; margin-top: 0;
    transition: max-height var(--transition), margin-top var(--transition);
  }
  .filter-sidebar-body.open { max-height: 2000px; margin-top: 16px; overflow-y: auto; }
}

@media (max-width: 560px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .product-image { height: 130px; }
  .product-info { padding: 12px; }
  .product-title { font-size: 13px; }
  .product-description { display: none; }
  .product-footer { flex-direction: column; align-items: stretch; gap: 8px; }
  .quote-btn, .learn-more-btn { justify-content: center; width: 100%; }
}
