/* === Facet Filters Layout === */
.rrc-ff-shop-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 48px;
  align-items: stretch;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .rrc-ff-shop-layout {
    grid-template-columns: 1fr;
  }
}

/* === Sidebar === */
.rrc-ff-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(150vh);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.rrc-ff-sidebar::-webkit-scrollbar {
  width: 4px;
}

.rrc-ff-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
}

.rrc-ff-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.rrc-ff-sidebar-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  margin: 0 !important;
}

.rrc-ff-clear-all {
  background: none;
  border: none;
  color: var(--wp--preset--color--secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
  transition: color 0.2s;
}

.rrc-ff-clear-all:hover {
  color: var(--wp--preset--color--primary);
}

/* === Active Filters Pills === */
.rrc-ff-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.rrc-ff-active-filters:empty {
  display: none;
}

.rrc-ff-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wp--preset--color--surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 980px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--wp--preset--color--primary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  line-height: 1.4;
}

.rrc-ff-pill:hover {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.15);
}

.rrc-ff-pill svg {
  flex-shrink: 0;
  opacity: 0.5;
}

/* === Facet Groups === */
.rrc-ff-facet {
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding-bottom: 0;
}

.rrc-ff-facet:last-child {
  border-bottom: none;
}

.rrc-ff-facet-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 0;
  cursor: pointer;
  font-family: inherit;
}

.rrc-ff-facet-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--wp--preset--color--primary);
}

.rrc-ff-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
  opacity: 0.4;
}

.rrc-ff-facet-toggle[aria-expanded="true"] .rrc-ff-chevron {
  transform: rotate(180deg);
}

.rrc-ff-facet-body {
  padding-bottom: 6px;
}

/* === Search Within Facet === */
.rrc-ff-facet-search {
  display: block;
  width: 100%;
  padding: 5px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: var(--wp--preset--color--surface, #f9f9f9);
  color: var(--wp--preset--color--primary);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.rrc-ff-facet-search:focus {
  border-color: rgba(0,0,0,0.25);
}

.rrc-ff-facet-search::placeholder {
  color: var(--wp--preset--color--secondary, #999);
  opacity: 0.7;
}

/* === Checkbox Options === */
.rrc-ff-options {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Scrollable expanded state */
.rrc-ff-options.rrc-ff-options-expanded {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
  position: relative;
}

.rrc-ff-options.rrc-ff-options-expanded::-webkit-scrollbar {
  width: 4px;
}

.rrc-ff-options.rrc-ff-options-expanded::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
}

/* Fade gradient at bottom to hint scrollability */
.rrc-ff-facet-body.rrc-ff-has-scroll::after {
  content: '';
  display: block;
  height: 32px;
  margin-top: -32px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
  pointer-events: none;
}

.rrc-ff-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--wp--preset--color--primary);
  transition: opacity 0.2s;
  user-select: none;
}

.rrc-ff-option-hidden {
  display: none;
}

.rrc-ff-option-disabled {
  display: none;
}

.rrc-ff-option input[type="checkbox"] {
  display: none;
}

.rrc-ff-checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(0,0,0,0.25);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.rrc-ff-option input:checked + .rrc-ff-checkbox {
  background: var(--wp--preset--color--primary);
  border-color: var(--wp--preset--color--primary);
}

.rrc-ff-option input:checked + .rrc-ff-checkbox::after {
  content: '';
  display: block;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-1px);
}

.rrc-ff-option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.rrc-ff-option-count {
  font-size: 12px;
  color: var(--wp--preset--color--secondary);
  flex-shrink: 0;
  transition: opacity 0.15s;
}

/* === Hierarchical Category Depth Indentation (disabled — all flush left) === */
.rrc-ff-option-depth-1,
.rrc-ff-option-depth-2,
.rrc-ff-option-depth-3,
.rrc-ff-option-depth-4 {
  margin-left: 0;
}

/* === Show More / Less === */
.rrc-ff-show-more {
  background: none;
  border: none;
  color: var(--wp--preset--color--secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 0 0;
  transition: color 0.2s;
}

.rrc-ff-show-more:hover {
  color: var(--wp--preset--color--primary);
}

/* === Price Range Slider === */
.rrc-ff-price-display {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--wp--preset--color--primary);
  margin-bottom: 10px;
}

.rrc-ff-price-slider {
  position: relative;
  height: 28px;
}

.rrc-ff-price-slider input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

.rrc-ff-price-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wp--preset--color--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  pointer-events: all;
  margin-top: -7px;
}

.rrc-ff-price-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wp--preset--color--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  pointer-events: all;
}

.rrc-ff-price-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
}

.rrc-ff-price-slider input[type="range"]::-moz-range-track {
  height: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  border: none;
}

#rrc-ff-slider-track {
  position: absolute;
  top: 12px;
  height: 4px;
  background: var(--wp--preset--color--primary);
  border-radius: 4px;
  z-index: 1;
  pointer-events: none;
}

/* === Stock Toggle === */
.rrc-ff-toggle-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
}

.rrc-ff-toggle-option .rrc-ff-option-label {
  font-weight: 500;
}

.rrc-ff-toggle-switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  margin-left: auto;
}

.rrc-ff-toggle-switch input {
  display: none;
}

.rrc-ff-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.12);
  border-radius: 22px;
  transition: background 0.25s;
  cursor: pointer;
}

.rrc-ff-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.25s;
}

.rrc-ff-toggle-switch input:checked + .rrc-ff-toggle-slider {
  background: var(--wp--preset--color--primary);
}

.rrc-ff-toggle-switch input:checked + .rrc-ff-toggle-slider::after {
  transform: translateX(16px);
}

/* === Product Grid === */
.rrc-ff-grid-wrapper {
  position: relative;
  min-height: 200px;
  min-width: 0;
}

.rrc-ff-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.rrc-ff-result-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--wp--preset--color--secondary);
}

.rrc-ff-sort {
  appearance: none;
  -webkit-appearance: none;
  background: var(--wp--preset--color--surface) url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='1,1 5,5 9,1' fill='none' stroke='%236e6e73' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 8px 32px 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--wp--preset--color--primary);
  cursor: pointer;
}

.rrc-ff-product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  transition: opacity 0.2s;
}

@media (max-width: 1100px) {
  .rrc-ff-product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .rrc-ff-product-grid {
    grid-template-columns: 1fr;
  }
}

/* === Product Card === */
.rrc-ff-product-card {
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.rrc-ff-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.1);
}

.rrc-ff-product-link {
  display: block;
  padding: 16px;
  text-decoration: none;
  color: inherit;
}

.rrc-ff-product-image {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--wp--preset--color--surface);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rrc-ff-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rrc-ff-product-brand {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wp--preset--color--secondary);
  margin-bottom: 4px;
}

.rrc-ff-product-title {
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: -0.005em;
  margin: 0 0 6px !important;
  color: var(--wp--preset--color--primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rrc-ff-product-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--wp--preset--color--primary);
  margin-bottom: 4px;
}

.rrc-ff-stock {
  font-size: 12px;
  font-weight: 500;
}

.rrc-ff-in-stock {
  color: #34c759;
}

.rrc-ff-out-of-stock {
  color: var(--wp--preset--color--secondary);
}

/* Add to Bag button */
.rrc-ff-add-to-bag {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px 16px;
  padding: 10px 20px;
  background: var(--wp--preset--color--primary) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 980px !important;
  font-family: inherit;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.rrc-ff-add-to-bag:hover {
  opacity: 0.82 !important;
  background: var(--wp--preset--color--primary) !important;
}

.rrc-ff-add-to-bag.rrc-ff-adding {
  opacity: 0.5;
  pointer-events: none;
}

.rrc-ff-add-to-bag.rrc-ff-added {
  background: #34c759 !important;
  opacity: 1;
}

/* === No Results === */
.rrc-ff-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--wp--preset--color--secondary);
}

.rrc-ff-no-results p {
  font-size: 16px;
  font-weight: 400;
}

/* === Load More === */
.rrc-ff-pagination {
  text-align: center;
  margin-top: 32px;
}

.rrc-ff-load-more {
  background: var(--wp--preset--color--surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 980px;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--wp--preset--color--primary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.rrc-ff-load-more:hover {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.15);
}

/* === Loading Overlay === */
.rrc-ff-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.5);
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.15s;
}

/* Legacy loading element (kept for backward compat) */
.rrc-ff-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
  z-index: 5;
  pointer-events: none;
}

.rrc-ff-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--wp--preset--color--primary);
  border-radius: 50%;
  animation: rrc-spin 0.6s linear infinite;
}

@keyframes rrc-spin {
  to { transform: rotate(360deg); }
}

/* Applying-filters indicator (shown during in-flight REST requests) */
.rrc-ff-sidebar.rrc-ff-applying {
  position: relative;
}
.rrc-ff-sidebar.rrc-ff-applying::before {
  content: "Applying filters…";
  position: sticky;
  top: 0;
  z-index: 10;
  display: block;
  padding: 8px 12px;
  margin: 0 0 8px;
  background: #1d1d1f;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border-radius: 4px;
  animation: rrc-ff-pulse 1.2s ease-in-out infinite;
}
@keyframes rrc-ff-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}
