/* ====== PLP & Search Results Redesign (PBI #45290) ====== */

:root {
  --red: #C4112F;
  --red-dark: #9E0D25;
  --dark: #333;
  --body: #444;
  --g500: #767676;
  --g400: #999;
  --g300: #bbb;
  --g200: #ddd;
  --g150: #e5e5e5;
  --g100: #eee;
  --g50: #f5f5f5;
  --green: #28a745;
  --amber: #e67e22;
  --font: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --r: 6px;
  --rl: 10px;
}

/* ====== PRODUCT GRID ====== */
#hits .ais-Hits-list,
#hits-m .ais-Hits-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}

#hits .ais-Hits-item,
#hits-m .ais-Hits-item {
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* ====== PRODUCT CARD ====== */
.product-card {
  background: #fff;
  border: 1px solid var(--g200);
  border-radius: var(--rl);
  overflow: hidden;
  text-decoration: none;
  color: var(--body);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
  height: 100%;
}
.product-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.product-card-img {
  aspect-ratio: 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-bottom: 1px solid var(--g150);
  position: relative;
  overflow: hidden;
}
.product-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.product-card-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 1px;
}

.product-card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.product-card-body a {
  text-decoration: none;
  color: inherit;
}
.product-card-brand {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 3px;
}
.product-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.35;
  margin-bottom: 6px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-meta {
  font-size: 11px;
  color: var(--g400);
  margin-bottom: 10px;
}
.product-card-meta span + span { margin-left: 8px; }
.product-card-pricing {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.product-card-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
}
.product-card-msrp {
  font-size: 13px;
  color: var(--g300);
  text-decoration: line-through;
}
.product-card-msrp.hidden { display: none; }

.product-card-stock {
  font-size: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.stock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.stock-in { background: var(--green); }
.stock-out { background: var(--g300); }
.stock-low { background: var(--amber); }
.in-stock-text { color: var(--green); }
.out-stock-text { color: var(--g400); }
.low-stock-text { color: var(--amber); }

.product-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.product-card-qty {
  width: 52px;
  height: 36px;
  text-align: center;
  border: 1px solid var(--g200);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
}
.product-card-qty:focus { outline: none; border-color: var(--red); }

.btn-add-cart {
  flex: 1;
  padding: 9px;
  border: none;
  background: var(--red);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--r);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
}
.btn-add-cart:hover { background: var(--red-dark); }

.product-card-status {
  width: 100%;
  font-size: 12px;
  min-height: 18px;
}

/* ====== FILTER SIDEBAR ====== */
.SearchFacets {
  position: sticky;
  top: 80px;
}

.FacetList {
  margin-bottom: 20px !important;
}
.FacetList > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--dark) !important;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--g200);
}
.FacetList > span::after {
  content: '\f078'; /* fa-chevron-down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  color: var(--g400);
}

.ais-RefinementList-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
}

.ais-RefinementList-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--body);
  cursor: pointer;
}

.ais-RefinementList-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--g400);
  background: var(--g50);
  padding: 1px 6px;
  border-radius: 10px;
  border: none;
}

.ais-RefinementList-showMore {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--red) !important;
  font-weight: 600;
  cursor: pointer;
  background: none !important;
  border: none !important;
  padding: 4px 0 !important;
}
.ais-RefinementList-showMore::before {
  content: '\f067'; /* fa-plus */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
}
.ais-RefinementList-showMore--disabled {
  display: none;
}

/* ====== TOOLBAR (stats + sort) ====== */
.plp-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--g200);
  margin-bottom: 20px;
}
#stats {
  font-size: 13px;
  color: var(--g500);
}

.plp-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}
.plp-sort label {
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  white-space: nowrap;
}
#cboSortedBy, #cboSortedBy-mobile {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--g200);
  border-radius: var(--r);
  font-size: 13px;
  font-family: var(--font);
}

/* ====== PAGINATION ====== */
.ais-Pagination-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--g200);
  list-style: none;
  padding-left: 0;
}
.ais-Pagination-link {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--g200);
  background: #fff;
  border-radius: var(--r);
  font-family: var(--font);
  font-size: 13px;
  color: var(--body);
  cursor: pointer;
  text-decoration: none;
  padding: 0 8px;
}
.ais-Pagination-link:hover {
  border-color: var(--red);
  color: var(--red);
}
.ais-Pagination-item--selected .ais-Pagination-link {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 700;
}
.ais-Pagination-item--disabled .ais-Pagination-link {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ====== SEARCH SUGGESTIONS ====== */
.search-suggest {
  font-size: 13px;
  color: var(--g500);
  margin-top: 6px;
}
.search-suggest a {
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
}
.search-suggest a:hover {
  text-decoration: underline;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
  #hits .ais-Hits-list {
    grid-template-columns: repeat(3, 1fr);
  }
  .SearchFacets {
    position: static;
  }
}
@media (max-width: 768px) {
  #hits .ais-Hits-list,
  #hits-m .ais-Hits-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .product-card-price {
    font-size: 16px;
  }
}
