/* ── Filter wrapper ── */
.wpstackf-filter { margin-bottom: 0; border-bottom: 1px solid #f0f0f0; }
.wpstackf-filter:last-child { border-bottom: none; }

/* ── Filter header (collapsible) ── */
.wpstackf-filter__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; cursor: pointer; user-select: none; }
.wpstackf-filter__label { font-size: 15px; font-weight: 600; color: #111; }
.wpstackf-filter__arrow { width: 10px; height: 10px; border-right: 2px solid #9ca3af; border-bottom: 2px solid #9ca3af; transform: rotate(-135deg); transition: transform .2s; flex-shrink: 0; }
.wpstackf-filter__head.is-closed .wpstackf-filter__arrow { transform: rotate(45deg); }

/* ── Filter body ── */
.wpstackf-filter__body { padding-bottom: 16px; }
.wpstackf-filter__body--search { padding-top: 4px; }
.wpstackf-filter__body.is-hidden { display: none; }

/* ── Checkbox / Radio options ── */
.wpstackf-option { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; font-size: 14px; color: #374151; }
.wpstackf-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.wpstackf-option__check { flex-shrink: 0; width: 16px; height: 16px; border: 1.5px solid #d1d5db; border-radius: 3px; background: #fff; transition: background .15s, border-color .15s; display: flex; align-items: center; justify-content: center; }
.wpstackf-option__check--radio { border-radius: 50%; }
.wpstackf-option.is-checked .wpstackf-option__check { background: #4f46e5; border-color: #4f46e5; }
.wpstackf-option.is-checked .wpstackf-option__check::after { content: ''; display: block; width: 8px; height: 8px; background: #fff; border-radius: 2px; }
.wpstackf-option.is-checked .wpstackf-option__check--radio::after { border-radius: 50%; }
.wpstackf-option__label { flex: 1; color: #111; }
.wpstackf-option__count { font-size: 12px; color: #9ca3af; margin-left: auto; }
.wpstackf-option.wpstackf-hidden { display: none; }
.wpstackf-option:hover .wpstackf-option__check { border-color: #4f46e5; }

/* ── Ghost options (0 results) ── */
.wpstackf-option--ghost { opacity: .4; cursor: not-allowed; pointer-events: none; }
.wpstackf-option--ghost .wpstackf-option__check { background: #f3f4f6; border-color: #e5e7eb; }

/* ── Hierarchical tree ── */
.wpstackf-term-group { position: relative; }
.wpstackf-term-group__label { font-size: 13px; font-weight: 600; color: #6b7280; padding: 4px 0 2px; }

/* ── Show more button ── */
.wpstackf-show-more { background: none; border: none; color: #4f46e5; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0 0; display: block; }
.wpstackf-show-more:hover { text-decoration: underline; }

/* ── Dropdown select ── */
.wpstackf-select-wrap { position: relative; display: inline-block; }
.wpstackf-select-wrap::after { content: ''; position: absolute; right: 14px; top: 50%; transform: translateY(-60%) rotate(45deg); width: 5px; height: 5px; border-right: 1.5px solid #6b7280; border-bottom: 1.5px solid #6b7280; pointer-events: none; }
.wpstackf-dropdown-select { width: 100%; padding: 9px 36px 9px 12px; font-size: 14px; border: 1px solid #e5e7eb; border-radius: 8px; color: #111; background: #fff; appearance: none; cursor: pointer; }
.wpstackf-dropdown-select:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); outline: none; }

.wpstackf-sort-select { padding: 0 32px 0 16px; height: 36px; font-size: 13px; font-weight: 500; border: 1.5px solid #d1d5db; border-radius: 18px; color: #374151; background: #fff; appearance: none; cursor: pointer; line-height: 36px; }
.wpstackf-sort-select:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); outline: none; }

/* ── Range slider ── */
.wpstackf-range-slider { padding: 4px 0 0; }
.wpstackf-range-track { position: relative; height: 4px; background: #e5e7eb; border-radius: 4px; margin: 16px 10px 20px; }
.wpstackf-range-fill { position: absolute; top: 0; height: 100%; background: #4f46e5; border-radius: 4px; pointer-events: none; }
.wpstackf-range-handle { position: absolute; top: 50%; width: 20px; height: 20px; background: #fff; border: 2px solid #4f46e5; border-radius: 50%; transform: translate(-50%, -50%); cursor: grab; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: box-shadow .15s; z-index: 2; }
.wpstackf-range-handle:hover,
.wpstackf-range-handle:focus { box-shadow: 0 0 0 4px rgba(79,70,229,.15); outline: none; }
.wpstackf-range-handle.is-dragging { cursor: grabbing; box-shadow: 0 0 0 6px rgba(79,70,229,.18); }
.wpstackf-range-values { font-size: 13px; color: #374151; margin-top: 4px; }
.wpstackf-range-sep { color: #9ca3af; margin: 0 2px; }

/* ── Search ── */
.wpstackf-search-wrap { position: relative; }
.wpstackf-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 16px; width: 16px; height: 16px; }
.wpstackf-search-input { width: 100%; padding: 9px 36px 9px 34px; font-size: 14px; border: 1px solid #e5e7eb; border-radius: 8px; color: #111; box-sizing: border-box; }
.wpstackf-search-input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); outline: none; }
.wpstackf-search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #9ca3af; cursor: pointer; padding: 2px; display: flex; }
.wpstackf-search-clear:hover { color: #374151; }

/* ── Active selections / chips ── */
.wpstackf-selections { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wpstackf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 14px; background: #fff; border: 1.5px solid #d1d5db; border-radius: 20px; color: #6b7280; font-size: 13px; font-weight: 500; cursor: default; line-height: 1.4; width: fit-content; flex-shrink: 0; }
.wpstackf-chip__label { color: #6b7280; font-size: 13px; font-weight: 500; }
.wpstackf-chip__remove { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: none; border: none; border-radius: 50%; color: #6b7280; cursor: pointer; font-size: 13px; line-height: 1; flex-shrink: 0; padding: 0; }
.wpstackf-chip__remove:hover { color: #374151; }
.wpstackf-chip--clear { display: inline-flex; align-items: center; padding: 5px 14px; background: #fff; border: 1.5px solid #d1d5db; border-radius: 20px; color: #6b7280; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1.4; width: fit-content; flex-shrink: 0; }
.wpstackf-chip--clear:hover { border-color: #4f46e5; color: #4f46e5; }

/* ── Loading state on listing ── */
.wpstackf-listing { position: relative; transition: opacity .2s; }
.wpstackf-listing.is-loading { opacity: .45; pointer-events: none; }
.wpstackf-listing.is-loading::after { content: ''; position: absolute; inset: 0; }

/* ── No results ── */
.wpstackf-no-results { color: #6b7280; font-size: 14px; padding: 24px 0; }

/* ── Post grid (non-WooCommerce) ── */
.wpstackf-post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.wpstackf-post-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.wpstackf-post-thumb img { width: 100%; height: 180px; object-fit: cover; display: block; }
.wpstackf-post-info { padding: 14px; }
.wpstackf-post-title { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.wpstackf-post-title a { color: #111; text-decoration: none; }
.wpstackf-post-title a:hover { color: #4f46e5; }
.wpstackf-post-excerpt { font-size: 13px; color: #6b7280; margin: 0; }

/* Apply-button mode: floating "Apply filters" button, shown when there are pending changes */
.wpstackf-apply-btn { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); z-index: 9999; padding: 12px 24px; border: 0; border-radius: 999px; background: #4f46e5; color: #fff; font-weight: 600; font-size: 15px; line-height: 1; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.22); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.wpstackf-apply-btn.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.wpstackf-apply-btn:hover { background: #4338ca; }

