/* ========== Filter / Category Browse Page ========== */

.wk-filter-page {
  background: #fafafa;
  min-height: 60vh;
  overflow-x: hidden;
}

/* Hero — compact editorial */
.wk-filter-hero {
  position: relative;
  overflow: hidden;
}

.wk-filter-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wk-filter-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(24, 16, 48, .88) 0%, rgba(88, 28, 135, .55) 48%, rgba(37, 99, 235, .22) 100%);
}

.wk-filter-hero-content {
  position: relative;
  z-index: 1;
  color: #fff;
  padding-top: 20px;
  padding-bottom: 20px;
}

.wk-filter-hero .wk-filter-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  color: rgba(255, 255, 255, .7);
  margin: 0 0 12px;
}

.wk-filter-hero .wk-filter-crumb a { color: #fff; font-weight: 500; opacity: .8; }
.wk-filter-hero .wk-filter-crumb a:hover { opacity: 1; }
.wk-filter-hero .wk-filter-crumb span { color: #fff; font-weight: 700; }
.wk-filter-hero .wk-filter-crumb i,
.wk-filter-hero .wk-filter-crumb svg {
  display: block;
  flex-shrink: 0;
  opacity: .75;
  width: 14px;
  height: 14px;
}

.wk-filter-hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.wk-filter-hero-label {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
}

.wk-filter-hero-content h1 {
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 800;
  margin: 8px 0 4px;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.wk-filter-hero-content p {
  margin: 0;
  opacity: .85;
  font-size: 13px;
  max-width: 420px;
  line-height: 1.4;
}

.wk-filter-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.wk-filter-hero-meta span {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .16);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Sticky tools — one compact strip */
.wk-filter-sticky {
  position: sticky;
  top: 64px;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid #eee;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.wk-filter-cats {
  border-bottom: 1px solid #f3f4f6;
  padding: 8px 0;
}

.wk-filter-cats-track {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.wk-filter-cats-track::-webkit-scrollbar { display: none; }

.wk-filter-cats-split {
  width: 1px;
  height: 18px;
  background: #e5e7eb;
  flex-shrink: 0;
  margin: 0 4px;
}

.wk-filter-subcats-track {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.wk-filter-cats-track .wk-filter-pill { text-decoration: none; }

.wk-filter-pill {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--wk-font);
  background: #f3f4f6;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}

.wk-filter-pill:hover { background: #e5e7eb; }

.wk-filter-pill.active {
  background: #7c3aed;
  color: #fff;
}

.wk-filter-pill--ghost {
  background: #fff;
  border: 1px solid #e5e7eb;
}

.wk-filter-pill--ghost.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

/* Toolbar row */
.wk-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  min-height: 48px;
}

.wk-filter-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1 1 auto;
  min-width: 0;
}

.wk-filter-tabs::-webkit-scrollbar { display: none; }

.wk-filter-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--wk-font);
  background: transparent;
  color: #6b7280;
  cursor: pointer;
}

.wk-filter-tab:hover { background: #f3f4f6; color: #111827; }

.wk-filter-tab.active {
  background: #111827;
  color: #fff;
}

.wk-filter-hot {
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
}

.wk-filter-count {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

.wk-filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wk-filter-select {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: var(--wk-font);
  background: #fff;
  cursor: pointer;
  max-width: 130px;
}

.wk-filter-select:focus {
  outline: none;
  border-color: #a78bfa;
}

.wk-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--wk-font);
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.wk-filter-btn:hover { background: #f9fafb; }

.wk-filter-btn.active {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #6d28d9;
}

.wk-filter-btn-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wk-filter-btn-count[hidden] { display: none !important; }

.wk-filter-view {
  display: flex;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 2px;
}

.wk-filter-view button {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 6px 8px;
  color: #4b5563;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.wk-filter-view button.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

/* Filter panel — compact, closed by default */
.wk-filter-main { padding: 16px 0 56px; }

.wk-filter-backdrop {
  display: none;
}

.wk-filter-panel {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.wk-filter-drawer-head,
.wk-filter-drawer-foot {
  display: none;
}

.wk-filter-panel-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
}

.wk-filter-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 8px;
}

.wk-filter-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.wk-filter-quick button {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #4b5563;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--wk-font);
  cursor: pointer;
}

.wk-filter-quick button:hover,
.wk-filter-quick button.is-active {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
}

.wk-filter-range {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
}

.wk-filter-range input {
  width: 96px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: var(--wk-font);
}

.wk-filter-range input:focus {
  outline: none;
  border-color: #a78bfa;
}

.wk-filter-range span { color: #9ca3af; }

.wk-filter-rating {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wk-filter-rating button {
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--wk-font);
  background: #fff;
  color: #4b5563;
  cursor: pointer;
}

.wk-filter-rating button.active {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #6d28d9;
}

.wk-filter-clear {
  border: none;
  background: transparent;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--wk-font);
  cursor: pointer;
  padding: 6px 0;
  margin-left: auto;
}

.wk-product-grid--filter {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.wk-product-grid--filter.wk-product-grid--list { grid-template-columns: 1fr; }

.wk-product-grid--filter.wk-product-grid--list .wk-product {
  flex-direction: row;
  max-height: 160px;
}

.wk-product-grid--filter.wk-product-grid--list .wk-product-media {
  width: 160px;
  flex-shrink: 0;
  aspect-ratio: 1;
}

.wk-product-grid--filter.wk-product-grid--list .wk-product-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wk-product-discount--below { margin-top: 2px; }

.wk-filter-empty {
  text-align: center;
  padding: 40px 16px;
  background: #fff;
  border: 1px dashed #e5e7eb;
  border-radius: 16px;
  color: #6b7280;
}

.wk-filter-empty h3 { margin: 8px 0 6px; color: #111827; font-size: 16px; }
.wk-filter-empty p { margin: 0 0 12px; font-size: 13px; }
.wk-filter-empty-link { color: #6d28d9; font-weight: 700; font-size: 13px; }

@media (max-width: 1200px) {
  .wk-product-grid--filter { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .wk-product-grid--filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wk-filter-count { display: none; }
}

@media (max-width: 991.98px) {
  .wk-filter-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
  }

  .wk-filter-backdrop.is-visible,
  .wk-filter-backdrop:not([hidden]) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .wk-filter-backdrop[hidden] {
    display: block !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .wk-filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1101;
    width: min(320px, 88vw);
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0 20px 20px 0;
    box-shadow: 12px 0 40px rgba(15, 23, 42, .18);
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform .26s cubic-bezier(.22, 1, .36, 1);
    overflow: hidden;
  }

  .wk-filter-panel[hidden] {
    display: flex !important;
    transform: translateX(-105%);
    pointer-events: none;
  }

  .wk-filter-panel.is-open,
  .wk-filter-page.is-filters-open .wk-filter-panel {
    transform: translateX(0);
    pointer-events: auto;
  }

  .wk-filter-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 16px 16px 14px;
    border-bottom: 1px solid #f3f4f6;
  }

  .wk-filter-drawer-head h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #111827;
  }

  .wk-filter-drawer-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f3f4f6;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .wk-filter-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .wk-filter-panel-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .wk-filter-clear--inline { display: none; }

  .wk-filter-range { max-width: none; }

  .wk-filter-range input { flex: 1 1 0; width: auto; }

  .wk-filter-quick { flex-wrap: wrap; }

  .wk-filter-quick button { flex: 1 1 auto; text-align: center; }

  .wk-filter-rating { display: grid; grid-template-columns: repeat(4, 1fr); }

  .wk-filter-rating button { text-align: center; padding: 8px 6px; }

  .wk-filter-drawer-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #f3f4f6;
    background: #fff;
  }

  .wk-filter-drawer-foot .wk-filter-clear {
    margin: 0;
    padding: 12px 10px;
  }

  .wk-filter-apply {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    background: #7c3aed;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--wk-font);
    cursor: pointer;
  }

  body.wk-filter-drawer-open {
    overflow: hidden;
    touch-action: none;
  }
}

@media (max-width: 767.98px) {
  .wk-filter-sticky { top: 56px; }
  .wk-filter-hero-content {
    padding-top: 28px;
    padding-bottom: 24px;
  }
  .wk-filter-hero-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .wk-filter-hero-content p { display: none; }
  .wk-filter-hero .wk-filter-crumb {
    margin: 0 0 14px;
    font-size: 12px;
    gap: 5px;
  }
  .wk-filter-hero-content h1 { font-size: 22px; margin: 8px 0 4px; }
  .wk-filter-hero-meta span { font-size: 10px; padding: 4px 8px; }
  .wk-filter-cats { padding: 8px 0; }
  .wk-filter-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 10px;
  }
  .wk-filter-tabs { order: 2; width: 100%; }
  .wk-filter-controls { margin-left: auto; }
  .wk-filter-select { max-width: 118px; padding: 8px 8px; font-size: 12px; }
  .wk-filter-btn { padding: 8px 12px; }
  .wk-filter-view { display: none; }
  .wk-filter-main { padding: 12px 0 24px; }
  .wk-product-grid--filter { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wk-product-grid--filter .wk-product { min-width: 0; }
  .wk-product-grid--filter .wk-product-wish {
    width: 30px;
    height: 30px;
    top: 8px;
    right: 8px;
  }
  .wk-product-grid--filter .wk-product-badges-left { top: 8px; left: 8px; }
  .wk-product-grid--filter .wk-price-save { display: none; }
}

@media (max-width: 560px) {
  .wk-product-grid--filter.wk-product-grid--list .wk-product { flex-direction: column; max-height: none; }
  .wk-product-grid--filter.wk-product-grid--list .wk-product-media { width: 100%; }
  .wk-filter-hero .wk-filter-crumb i,
  .wk-filter-hero .wk-filter-crumb svg { width: 12px; height: 12px; }
}
