/* Only the filter UI is styled. No selectors target the product catalog or theme grid. */
.swpf-filter-shell {
  --swpf-accent: #2563eb;
  --swpf-bg: #fff;
  --swpf-text: #172033;
  --swpf-muted: #64748b;
  --swpf-border: #e2e8f0;
  --swpf-radius: 14px;
  --swpf-gap: 14px;
  --swpf-font: 14px;
  --swpf-padding: 14px;
  --swpf-swatch-radius: 50%;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.swpf-filter-shell, .swpf-filter-shell *, .swpf-filter-shell *::before, .swpf-filter-shell *::after { box-sizing: border-box; }
.swpf-filter-panel { width: 100%; min-width: 0; max-width: var(--swpf-sidebar, 100%); container: swpf-panel / inline-size; }
.swpf-sticky-filter .swpf-filter-panel { position: sticky; top: 32px; }
.swpf-filters { display: flex; flex-direction: column; gap: var(--swpf-gap); min-width: 0; margin: 0; color: var(--swpf-text); font-size: var(--swpf-font); line-height: 1.5; text-align: start; }
.swpf-filters[aria-busy=true] { opacity: .65; pointer-events: none; }
.swpf-filters [hidden] { display: none !important; }

/* Scoped control defaults prevent common theme typography and sizing from leaking in. */
.swpf-filters :is(button, .swpf-reset, .swpf-apply) { margin: 0; max-width: 100%; font: inherit; line-height: 1.5; letter-spacing: normal; text-transform: none; text-shadow: none; box-shadow: none; background-image: none; white-space: normal; overflow-wrap: anywhere; }
.swpf-filters :is(input, select, button, a):focus-visible { outline: 2px solid var(--swpf-accent); outline-offset: 3px; }
.swpf-filters .swpf-choice-button:focus-within, .swpf-filters .swpf-swatch:focus-within { outline: 2px solid var(--swpf-accent); outline-offset: 2px; }
.swpf-filters select, .swpf-filters input[type=text], .swpf-filters input[type=search], .swpf-filters input[type=number] { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 10px 11px; border: 1px solid var(--swpf-border); border-radius: 8px; background: var(--swpf-bg); color: var(--swpf-text); font: inherit; line-height: 1.4; box-shadow: none; letter-spacing: normal; }
.swpf-filters select { appearance: auto; background-image: none; }
.swpf-filters select[multiple] { min-height: 140px; padding: 6px; white-space: normal; }
.swpf-filters select[multiple] option { padding: 5px; }
.swpf-filters input::placeholder { color: var(--swpf-muted); opacity: 1; }

/* Group layout and collapse control. */
.swpf-group { min-width: 0; margin: 0; border: 1px solid var(--swpf-border); border-radius: var(--swpf-radius); background: var(--swpf-bg); overflow: hidden; }
.swpf-style-soft .swpf-group { background: var(--swpf-bg); background: color-mix(in srgb, var(--swpf-bg) 95%, var(--swpf-accent)); border-color: transparent; }
.swpf-style-minimal .swpf-group { border: 0; border-bottom: 1px solid var(--swpf-border); border-radius: 0; background: transparent; }
.swpf-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: var(--swpf-padding); }
.swpf-group-head h3 { min-width: 0; margin: 0; padding: 0; color: var(--swpf-text); font: inherit; font-weight: 650; line-height: 1.4; text-transform: none; letter-spacing: normal; overflow-wrap: anywhere; }
.swpf-filters .swpf-group-toggle { position: relative; flex: 0 0 36px; width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; border: 1px solid var(--swpf-border); border-radius: 8px; background: var(--swpf-bg); color: var(--swpf-muted); cursor: pointer; }
.swpf-group-toggle span::before, .swpf-group-toggle span::after { content: ''; position: absolute; left: 11px; top: 16px; width: 12px; height: 2px; background: currentColor; }
.swpf-group-toggle span::after { transform: rotate(90deg); }
.swpf-group-toggle[aria-expanded=true] span::after { transform: rotate(0); }
.swpf-group-body { min-width: 0; padding: 0 var(--swpf-padding) var(--swpf-padding); }
.swpf-search-field { position: relative; display: block; margin: 0; }
.swpf-search-field input { padding-inline-end: 36px !important; }
.swpf-search-icon { position: absolute; inset-inline-end: 15px; top: 14px; width: 13px; height: 13px; border: 2px solid var(--swpf-muted); border-radius: 50%; pointer-events: none; }
.swpf-search-icon::after { content: ''; position: absolute; top: 9px; left: 8px; width: 6px; height: 2px; background: var(--swpf-muted); transform: rotate(45deg); }
.swpf-option-search { display: block; margin: 0 0 12px; }

/* Term lists, selection buttons and accessible swatches. */
.swpf-options { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.swpf-option { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 36px; margin: 0; color: var(--swpf-text); font: inherit; line-height: 1.5; cursor: pointer; }
.swpf-option input[type=checkbox], .swpf-option input[type=radio] { flex: 0 0 18px; width: 18px; min-width: 18px; height: 18px; margin: 0; padding: 0; border: initial; border-radius: initial; background: initial; box-shadow: none; appearance: auto; -webkit-appearance: auto; accent-color: var(--swpf-accent); }
.swpf-option input[type=checkbox]::before, .swpf-option input[type=radio]::before { content: none; }
.swpf-option-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.swpf-count { flex: 0 0 auto; margin-inline-start: auto; color: var(--swpf-muted); font-size: .85em; font-variant-numeric: tabular-nums; }
.swpf-option:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.swpf-control-buttons { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.swpf-choice-button { position: relative; display: inline-flex; max-width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--swpf-border); border-radius: 8px; background: var(--swpf-bg); overflow-wrap: anywhere; }
.swpf-choice-button input, .swpf-swatch input { position: absolute; width: 1px !important; min-width: 1px !important; height: 1px !important; margin: 0; opacity: 0; }
.swpf-choice-button:has(input:checked), .swpf-swatch:has(input:checked) { border-color: var(--swpf-accent); box-shadow: inset 0 0 0 1px var(--swpf-accent); background: var(--swpf-bg); background: color-mix(in srgb, var(--swpf-accent) 7%, var(--swpf-bg)); }
.swpf-control-swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.swpf-swatch { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; min-height: 42px; padding: 7px; border: 1px solid var(--swpf-border); border-radius: 8px; background: var(--swpf-bg); }
.swpf-swatch-dot { width: 25px; height: 25px; border: 1px solid #94a3b8; border-radius: var(--swpf-swatch-radius); background: var(--swpf-swatch-color, #d1d5db); }
/* Keep extra-item hiding after all display rules so buttons and swatches obey Ver más. */
.swpf-options:not(.is-expanded):not(.is-searching) .swpf-option-extra { display: none; }
.swpf-options .swpf-option.is-search-hidden { display: none !important; }
.swpf-filters .swpf-show-more { display: inline-flex; align-items: center; min-height: 40px; margin-top: 6px; padding: 7px 0; border: 0; border-radius: 0; background: transparent; color: var(--swpf-text); text-decoration: underline; text-underline-offset: 4px; font-weight: 600; cursor: pointer; }

/* Price and rating. */
.swpf-range { --swpf-range-min: 0%; --swpf-range-max: 100%; position: relative; height: 36px; margin: 2px 5px 10px; direction: ltr; }
.swpf-range-track { position: absolute; top: 16px; left: 0; right: 0; height: 4px; border-radius: 9px; background: linear-gradient(to right, var(--swpf-border) 0 var(--swpf-range-min), var(--swpf-accent) var(--swpf-range-min) var(--swpf-range-max), var(--swpf-border) var(--swpf-range-max) 100%); }
.swpf-range input[type=range] { position: absolute; inset: 0; width: 100%; height: 36px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; appearance: none; -webkit-appearance: none; pointer-events: none; }
.swpf-range input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; border: 3px solid var(--swpf-bg); border-radius: 50%; background: var(--swpf-accent); box-shadow: 0 1px 4px #0003; pointer-events: auto; appearance: none; -webkit-appearance: none; cursor: grab; }
.swpf-range input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--swpf-bg); border-radius: 50%; background: var(--swpf-accent); pointer-events: auto; cursor: grab; }
.swpf-range input[type=range]:disabled { opacity: .45; }
.swpf-range input[type=range]:disabled::-webkit-slider-thumb { cursor: default; }
.swpf-range input[type=range]:disabled::-moz-range-thumb { cursor: default; }
.swpf-price-values { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.swpf-price-values > span { min-width: 0; max-width: 100%; }
.swpf-price-values .amount { color: inherit; font: inherit; white-space: normal; }
.swpf-price-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.swpf-price-row label { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; color: var(--swpf-muted); font-size: .9em; line-height: 1.5; overflow-wrap: anywhere; }
.swpf-stars { min-width: 0; color: #8a5705; letter-spacing: 1px; overflow-wrap: anywhere; }
.swpf-rating-minimum { color: var(--swpf-muted); font-size: .85em; }

/* The only standard action is clear; apply is the no-JavaScript fallback. */
.swpf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.swpf-filters .swpf-reset, .swpf-filters .swpf-apply { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 15px; border: 1px solid var(--swpf-border); border-radius: 9px; background: var(--swpf-bg); color: var(--swpf-text); font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
.swpf-filters .swpf-reset:hover, .swpf-filters .swpf-apply:hover { border-color: var(--swpf-accent); background: var(--swpf-bg); color: var(--swpf-text); text-decoration: none; }
.swpf-filters .swpf-reset[aria-disabled=true] { opacity: .5; cursor: default; }
.swpf-empty-note { margin: 0; color: var(--swpf-muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.swpf-filter-shell .screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Respond to the real sidebar width as well as to the device width. */
@container swpf-panel (max-width: 280px) {
  .swpf-control-swatches { grid-template-columns: 1fr; }
}
@container swpf-panel (max-width: 230px) {
  .swpf-price-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .swpf-sticky-filter .swpf-filter-panel { position: static; }
  .swpf-filter-panel { max-width: 100%; }
}
@media (max-width: 520px) {
  .swpf-control-swatches { grid-template-columns: 1fr; }
  .swpf-group-head { gap: 6px; }
  /* Keep focus text readable and avoid automatic input zoom on small touch screens. */
  .swpf-filters select, .swpf-filters input[type=text], .swpf-filters input[type=search], .swpf-filters input[type=number] { font-size: max(16px, var(--swpf-font)); }
}
@media (max-height: 520px) {
  .swpf-sticky-filter .swpf-filter-panel { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .swpf-filter-shell * { transition: none !important; }
}
