/* ==========================================================================
   TOPS SAFETY CONTROL — Products Stylesheet
   Depends on mains.css: reuses tokens (--c-*, --f-*, --ease-*), utility
   classes (.container-tops, .eyebrow, .section-title, .section-lead,
   .section-pad, .btn-tops, .link-flame, .reveal/.reveal-scale, .cut-*,
   .service-hero / .svc-breadcrumb / .svc-hero-tag for the page header).
   This file ONLY contains rules specific to the products catalog
   (toolbar, filters, grid/list cards, pagination, empty state).
   Load AFTER mains.css.
   ========================================================================== */

/* ============================== PRODUCTS HERO ==============================
   Uses the existing .service-hero / .svc-breadcrumb / .svc-hero-tag markup
   from mains.css — category chips double as quick-jump filters. No overrides
   needed here.
   ========================================================================== */

/* ============================== TOOLBAR ==================================== */
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 26px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--c-line-light);
}
.products-count {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  color: var(--c-steel);
  letter-spacing: 0.02em;
}
.products-count strong { color: var(--c-ink); font-weight: 600; }

.products-toolbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.filters-open-btn {
  display: none;
  align-items: center;
  gap: 9px;
  font-family: var(--f-display);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 12px 18px;
  background: var(--c-off-white);
  border: 1px solid var(--c-line-light);
  color: var(--c-ink);
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
  transition: background 0.25s ease;
}
.filters-open-btn:hover { background: var(--c-ink); color: var(--c-white); }
.filters-open-btn .filter-badge {
  background: var(--c-red); color: var(--c-white); font-family: var(--f-mono);
  font-size: 0.64rem; min-width: 17px; height: 17px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}
.filters-open-btn .filter-badge:empty { display: none; }

.products-search { position: relative; width: 260px; }
.products-search input {
  width: 100%; border: 1px solid var(--c-line-light); background: var(--c-off-white);
  padding: 12px 42px 12px 16px; font-size: 0.86rem; font-family: var(--f-body);
  color: var(--c-ink); transition: border-color 0.3s ease;
  clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%, 0 9px);
}
.products-search input:focus { outline: none; border-color: var(--c-red); }
.products-search i {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  color: var(--c-steel); font-size: 0.82rem; pointer-events: none;
}
.products-search .search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--c-steel); cursor: pointer;
  display: none; font-size: 0.8rem; padding: 4px;
}
.products-search.has-value .search-clear { display: block; }
.products-search.has-value i { display: none; }

.products-sort { position: relative; }
.products-sort select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--c-line-light); background: var(--c-off-white);
  padding: 12px 38px 12px 16px; font-size: 0.8rem; font-family: var(--f-mono);
  letter-spacing: 0.02em; color: var(--c-ink); cursor: pointer;
  clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%, 0 9px);
}
.products-sort select:focus { outline: none; border-color: var(--c-red); }
.products-sort::after {
  content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  font-size: 0.66rem; color: var(--c-red); pointer-events: none;
}

.view-toggle { display: flex; border: 1px solid var(--c-line-light); flex: none; }
.view-toggle button {
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  background: var(--c-off-white); border: none; color: var(--c-steel); cursor: pointer;
  transition: all 0.25s ease; font-size: 0.9rem;
}
.view-toggle button:first-child { border-right: 1px solid var(--c-line-light); }
.view-toggle button.is-active { background: var(--c-ink); color: var(--c-white); }
.view-toggle button:hover:not(.is-active) { color: var(--c-ink); }

/* ============================== LAYOUT ====================================== */
.products-layout {
  display: grid;
  grid-template-columns: 272px 1fr;
  gap: 54px;
  align-items: start;
}
.products-main { min-width: 0; }

/* ============================== SIDEBAR / FILTERS ============================ */
.products-sidebar {
  display: flex; flex-direction: column; gap: 30px;
  position: sticky; top: 120px;
}
.filters-panel-head { display: none; }

.filter-group { padding-bottom: 26px; border-bottom: 1px solid var(--c-line-light); }
.filter-group:last-of-type { border-bottom: none; padding-bottom: 0; }
.filter-group h4 {
  font-size: 0.86rem; letter-spacing: 0.03em; margin-bottom: 18px;
  display: flex; align-items: center; gap: 9px;
}
.filter-group h4 i { color: var(--c-red); font-size: 0.8rem; }

.filter-option {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 1px; cursor: pointer; user-select: none;
}
.filter-option-left { display: flex; align-items: center; gap: 11px; }
.filter-option input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--c-red); cursor: pointer; flex: none;
}
.filter-option span.label { font-size: 0.86rem; color: var(--c-ink); transition: color 0.2s ease; }
.filter-option:hover span.label { color: var(--c-red); }
.filter-option .count {
  font-family: var(--f-mono); font-size: 0.66rem; color: var(--c-steel);
  background: var(--c-off-white); padding: 2px 8px; border-radius: 20px; flex: none;
}

.filter-reset {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--c-steel); background: none; border: none;
  cursor: pointer; padding: 0; transition: color 0.2s ease;
}
.filter-reset:hover { color: var(--c-red); }

/* Sidebar promo / help card */
.filter-help-card {
  background: var(--c-black); color: var(--c-white); padding: 26px 22px;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%, 0 14px);
}
.filter-help-card i { color: var(--c-red); font-size: 1.3rem; margin-bottom: 12px; display: block; }
.filter-help-card h5 { font-size: 0.86rem; margin-bottom: 8px; }
.filter-help-card p { font-size: 0.8rem; color: var(--c-steel-light); line-height: 1.6; margin-bottom: 16px; text-transform: none; }
.filter-help-card .btn-tops { width: 100%; justify-content: center; }

/* ============================ ACTIVE FILTER CHIPS ============================ */
.active-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-bottom: 26px;
}
.active-filters:empty { display: none; margin: 0; }
.active-filter-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--c-off-white); color: var(--c-ink);
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.02em;
  padding: 7px 8px 7px 14px; border-radius: 30px;
}
.active-filter-chip button {
  width: 18px; height: 18px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(10,10,11,0.08); color: var(--c-steel); font-size: 0.6rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s ease;
}
.active-filter-chip button:hover { background: var(--c-red); color: var(--c-white); }
.clear-all-filters {
  font-family: var(--f-mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--c-red); text-decoration: underline;
  text-underline-offset: 3px; background: none; border: none; cursor: pointer;
}

/* ================================ PRODUCT GRID ================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

.product-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--c-white);
  border: 1px solid var(--c-line-light);
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out), border-color 0.4s ease;
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%, 0 18px);
}
.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 50px -26px rgba(10,10,11,0.25);
  border-color: transparent;
}

.product-card__media {
  position: relative; height: 216px; overflow: hidden;
  background: var(--c-off-white); flex: none;
}
.product-card__media img {
  width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out);
}
.product-card:hover .product-card__media img { transform: scale(1.07); }

.product-card__badges {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.product-badge {
  font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--c-white); padding: 5px 10px;
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px);
}
.product-badge--new { background: var(--c-red); }
.product-badge--stock { background: var(--c-ink); }
.product-badge--order { background: var(--c-steel); }

.product-card__quote-icon {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-ink); font-size: 0.85rem;
  opacity: 0; transform: translateY(-6px);
  transition: all 0.3s var(--ease-out);
}
.product-card:hover .product-card__quote-icon { opacity: 1; transform: translateY(0); }
.product-card__quote-icon:hover { background: var(--c-red); color: var(--c-white); }

.product-card__body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.product-card__category {
  font-family: var(--f-mono); font-size: 0.64rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--c-red); margin-bottom: 9px; display: block; font-weight: 500;
}
.product-card h3 {
  font-family: var(--f-body); text-transform: none; letter-spacing: 0;
  font-weight: 600; font-size: 1rem; line-height: 1.4; margin-bottom: 9px;
}
.product-card h3 a { color: var(--c-ink); transition: color 0.25s ease; }
.product-card:hover h3 a { color: var(--c-red); }
.product-card p {
  color: var(--c-steel); font-size: 0.83rem; line-height: 1.6;
  margin-bottom: 16px; text-transform: none; flex: 1;
}
.product-card__certs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.product-card__certs span {
  font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.01em;
  color: var(--c-steel); border: 1px solid var(--c-line-light);
  padding: 3px 8px; border-radius: 4px;
}
.product-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; border-top: 1px solid var(--c-line-light); margin-top: auto;
}
.product-card__footer .link-flame { padding-bottom: 0; }
.product-card__cta {
  font-family: var(--f-display); font-size: 0.7rem; letter-spacing: 0.04em;
  text-transform: uppercase; font-weight: 500; color: var(--c-white);
  background: var(--c-ink); padding: 9px 15px; display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.25s ease;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
}
.product-card__cta:hover { background: var(--c-red); }
.product-card__cta i { font-size: 0.68rem; }

/* -------------------------------- LIST VIEW -------------------------------- */
.products-grid.is-list { grid-template-columns: 1fr; gap: 18px; }
.products-grid.is-list .product-card {
  flex-direction: row; clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%, 0 14px);
}
.products-grid.is-list .product-card__media { width: 232px; height: auto; }
.products-grid.is-list .product-card__body { flex-direction: row; align-items: center; gap: 26px; padding: 22px 26px; }
.products-grid.is-list .product-card__main { flex: 1; min-width: 0; }
.products-grid.is-list .product-card p { margin-bottom: 10px; }
.products-grid.is-list .product-card__certs { margin-bottom: 0; }
.products-grid.is-list .product-card__footer {
  border-top: none; padding-top: 0; margin-top: 0; flex-direction: column;
  align-items: flex-end; gap: 12px; flex: none;
}

/* ================================ PAGINATION ================================ */
.products-pagination {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 56px;
}
.products-pagination button, .products-pagination span.pg-dots {
  min-width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 0.8rem; color: var(--c-ink);
  border: 1px solid var(--c-line-light); border-radius: 50%; background: var(--c-white);
  cursor: pointer; transition: all 0.3s ease; padding: 0 4px;
}
.products-pagination button:hover:not(:disabled):not(.is-active) { background: var(--c-off-white); }
.products-pagination button.is-active { background: var(--c-red); border-color: var(--c-red); color: var(--c-white); }
.products-pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.products-pagination .pg-nav { width: auto; padding: 0 18px; border-radius: 30px; gap: 8px; }
.products-pagination span.pg-dots { border: none; cursor: default; }

/* ================================ EMPTY STATES ================================ */
.products-empty {
  display: none;
  text-align: center;
  padding: 90px 20px 70px;
}
.products-empty.is-visible { display: block; }
.products-empty-icon {
  width: 84px; height: 84px; border-radius: 50%; background: var(--c-off-white);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 26px;
}
.products-empty-icon i { font-size: 2rem; color: var(--c-red); }
.products-empty h3 { font-size: 1.3rem; margin-bottom: 12px; }
.products-empty p { color: var(--c-steel); font-size: 0.94rem; line-height: 1.7; max-width: 420px; margin: 0 auto 28px; text-transform: none; }
.products-empty-actions { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* ================================ MOBILE DRAWER ================================ */
.filters-backdrop {
  position: fixed; inset: 0; z-index: 1400;
  background: rgba(10,10,11,0.55);
  opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease;
}
.filters-backdrop.is-open { opacity: 1; visibility: visible; }

/* ================================ RESPONSIVE ================================ */
@media (max-width: 1199px) {
  .products-layout { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-open-btn { display: inline-flex; }

  .products-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1401;
    width: min(86%, 340px); background: var(--c-white);
    padding: 26px 24px 40px; overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.5s var(--ease-out);
    box-shadow: 0 0 60px -10px rgba(10,10,11,0.4);
  }
  .products-sidebar.is-open { transform: translateX(0); }
  .filters-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--c-line-light);
  }
  .filters-panel-head h4 { font-size: 1rem; letter-spacing: 0.02em; }
  .filters-panel-head button {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--c-line-light);
    background: none; color: var(--c-ink); cursor: pointer;
  }
  .filters-apply-btn { display: block; width: 100%; text-align: center; margin-top: 6px; }
}

@media (max-width: 991px) {
  .products-grid.is-list .product-card { flex-direction: column; }
  .products-grid.is-list .product-card__media { width: 100%; height: 200px; }
  .products-grid.is-list .product-card__body { flex-direction: column; align-items: stretch; padding: 20px; }
  .products-grid.is-list .product-card__footer { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (max-width: 767px) {
  .products-grid { grid-template-columns: 1fr; }
  .products-toolbar { flex-direction: column; align-items: stretch; }
  .products-toolbar-right { justify-content: space-between; }
  .products-search { width: 100%; flex: 1; }
  .products-count { text-align: center; }
}

@media (max-width: 575px) {
  .products-toolbar-right { flex-wrap: wrap; }
  .products-sort { flex: 1; }
  .products-sort select { width: 100%; }
}