/* ============================================================
   Storefront filter panel — category page
   Desktop (>=1024px): sticky left sidebar.
   Mobile: bottom sheet opened from the filter button.
   Uses the site's existing CSS variable tokens.
============================================================ */

/* Layout: sidebar + main grid on desktop */
.products-layout {
  display: block;
}

.filters-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .products-layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
  }

  .filters-sidebar {
    display: block;
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    background: var(--bg-card, var(--card, #fff));
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow, 0 4px 12px rgba(0, 0, 0, 0.06));
    padding: 14px;
    scrollbar-width: thin;
  }
}

/* Sidebar / sheet shared pieces */
.fp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fp-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #1a1a1a);
}

.fp-clear-btn {
  background: none;
  border: none;
  color: var(--primary, #1E3A8A);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.fp-clear-btn:hover {
  background: rgba(59, 169, 255, 0.12);
}

.fp-group {
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 10px 2px 12px;
}

.fp-group:first-of-type {
  border-top: none;
}

.fp-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text, #1a1a1a);
}

.fp-group-head .fp-arrow {
  transition: transform 0.18s ease;
  font-size: 11px;
  color: var(--text-muted, #6b7280);
}

.fp-group.fp-collapsed .fp-arrow {
  transform: rotate(-90deg);
}

.fp-group.fp-collapsed .fp-group-body {
  display: none;
}

.fp-group-body {
  margin-top: 8px;
}

.fp-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #1a1a1a);
  user-select: none;
}

.fp-check:hover {
  background: rgba(59, 169, 255, 0.08);
}

.fp-check input[type="checkbox"] {
  accent-color: var(--primary, #1E3A8A);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

.fp-check .fp-count {
  margin-left: auto;
  color: var(--text-muted, #6b7280);
  font-size: 11.5px;
}

.fp-check.fp-checked {
  color: var(--primary, #1E3A8A);
  font-weight: 600;
}

/* price range */
.fp-price-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.fp-price-inputs input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text, #1a1a1a);
  background: var(--bg-card, #fff);
}

.fp-price-inputs .fp-dash {
  color: var(--text-muted, #6b7280);
}

.fp-range {
  width: 100%;
  accent-color: var(--primary, #1E3A8A);
  margin-top: 10px;
}

.fp-price-hint {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  margin-top: 4px;
}

/* rating + discount pills */
.fp-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fp-pill {
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a1a);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.fp-pill:hover {
  border-color: var(--primary, #1E3A8A);
}

.fp-pill.fp-active {
  background: var(--primary, #1E3A8A);
  border-color: var(--primary, #1E3A8A);
  color: #fff;
}

.fp-pill .fp-count {
  font-weight: 500;
  opacity: 0.75;
  margin-left: 4px;
  font-size: 10.5px;
}

/* color swatches */
.fp-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fp-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border, #e2e8f0);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  padding: 0;
  transition: transform 0.12s ease;
}

.fp-swatch:hover {
  transform: scale(1.12);
}

.fp-swatch.fp-active {
  border-color: var(--primary, #1E3A8A);
  box-shadow: 0 0 0 2px var(--primary, #1E3A8A);
}

.fp-swatch[title]:hover::after {
  content: attr(data-label);
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* toggle rows (free delivery / COD / in stock) */
.fp-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #1a1a1a);
  user-select: none;
}

.fp-toggle:hover {
  background: rgba(59, 169, 255, 0.08);
  border-radius: 7px;
}

.fp-toggle .fp-count {
  margin-left: auto;
  color: var(--text-muted, #6b7280);
  font-size: 11.5px;
}

/* applied chips row */
.fp-applied {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.fp-applied[hidden] {
  display: none;
}

.fp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 58, 138, 0.08);
  border: 1px solid rgba(30, 58, 138, 0.22);
  color: var(--primary, #1E3A8A);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
}

.fp-chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
}

.fp-clear-all {
  background: none;
  border: none;
  color: var(--danger, #ef4444);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

/* mobile filter / quick-chip bar */
.fp-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fp-toolbar::-webkit-scrollbar {
  display: none;
}

.fp-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--primary, #1E3A8A);
  background: var(--bg-card, #fff);
  color: var(--primary, #1E3A8A);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.fp-filter-btn:hover {
  background: rgba(30, 58, 138, 0.06);
}

.fp-filter-btn .fp-badge {
  background: var(--primary, #1E3A8A);
  color: #fff;
  border-radius: 10px;
  font-size: 10.5px;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* bottom sheet (mobile) */
.fp-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
  display: none;
}

.fp-sheet-backdrop.fp-open {
  display: block;
}

.fp-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 86vh;
  background: var(--bg-card, #fff);
  border-radius: 16px 16px 0 0;
  z-index: 1201;
  display: none;
  flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
}

.fp-sheet.fp-open {
  display: flex;
}

.fp-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}

.fp-sheet-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  padding: 2px 6px;
}

.fp-sheet-body {
  overflow-y: auto;
  padding: 4px 16px 12px;
  flex: 1;
}

.fp-sheet-foot {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  background: var(--bg-card, #fff);
}

.fp-sheet-foot .fp-reset {
  flex: 0 0 auto;
  border: 1.5px solid var(--border, #e2e8f0);
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a1a);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
}

.fp-sheet-foot .fp-apply {
  flex: 1;
  border: none;
  background: linear-gradient(135deg, var(--primary-light, #3BA9FF) 0%, var(--primary, #1E3A8A) 55%, var(--primary-dark, #142C6E) 100%);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
}

.fp-sheet-foot .fp-apply:disabled {
  opacity: 0.65;
  cursor: default;
}

/* "show more" for long facet lists */
.fp-more-btn {
  background: none;
  border: none;
  color: var(--primary, #1E3A8A);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}

.fp-empty-note {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

@media (min-width: 1024px) {
  .fp-filter-btn.fp-desktop-only-hide {
    display: none;
  }
}
