/**
 * Voxel Plus — Plugin Styles
 *
 * Scope rule: everything that touches the More Filters popup is scoped to
 * `.ts-more-filters-portal` so it never leaks into Voxel's other popups
 * (account menu, cart, notifications, field popups).
 *
 * Division of labour:
 *   - This stylesheet owns STRUCTURE only — scoping, flash prevention, the
 *     sticky header / scrolling body / sticky footer layout, and feature CSS
 *     (collapse, animations, utilities).
 *   - GEOMETRY and COLOUR (popup width, height, position, overflow, overlay
 *     colour, paddings, button/badge colours, etc.) are owned by the widget's
 *     "More Filters" controls, which target `.ts-more-filters-portal-{ID}`.
 *     Nothing here uses !important on those properties, so the controls work.
 */

/* Safari/iOS UI bar colour — keep browser chrome matching the site bg. */
html, body {
	background-color: #ffffff;
}

/* Hide Vue templates until Vue is ready (prevents raw {{ }} flashes). */
[v-cloak] {
	display: none !important;
}

/* =====================================================================
 * 1. Flash prevention + responsive filter visibility
 * ===================================================================== */

/* Secondary filters live in the popup; never show them in the main form. */
.vx-secondary-filter:not(.ts-more-filters-portal .vx-secondary-filter) {
	display: none !important;
}

/* If the More Filters button is disabled for a breakpoint, fall back to
   showing the secondary filters inline at that breakpoint. */
@media (min-width: 1025px) {
	.vxp-more-filters-responsive[data-vxp-hide-desktop="yes"] .vx-secondary-filter:not(.ts-more-filters-portal .vx-secondary-filter) { display: flex !important; }
}
@media (min-width: 768px) and (max-width: 1024px) {
	.vxp-more-filters-responsive[data-vxp-hide-tablet="yes"] .vx-secondary-filter:not(.ts-more-filters-portal .vx-secondary-filter) { display: flex !important; }
}
@media (max-width: 767px) {
	.vxp-more-filters-responsive[data-vxp-hide-mobile="yes"] .vx-secondary-filter:not(.ts-more-filters-portal .vx-secondary-filter) { display: flex !important; }
}

/* Generic responsive hide helpers. */
@media (min-width: 1025px) { .vx-hidden-desktop { display: none !important; } }
@media (min-width: 768px) and (max-width: 1024px) { .vx-hidden-tablet { display: none !important; } }
@media (max-width: 767px) { .vx-hidden-mobile { display: none !important; } }

/* =====================================================================
 * 2. More Filters button responsive visibility
 * ===================================================================== */
@media (min-width: 1025px) {
	.ts-more-filters-btn-wrapper[data-vxp-hide-desktop="yes"] { display: none !important; }
}
@media (min-width: 768px) and (max-width: 1024px) {
	.ts-more-filters-btn-wrapper[data-vxp-hide-tablet="yes"] { display: none !important; }
}
@media (max-width: 767px) {
	.ts-more-filters-btn-wrapper[data-vxp-hide-mobile="yes"] { display: none !important; }
}

/* =====================================================================
 * 3. More Filters popup — STRUCTURE only (scoped).
 *    Sticky header + scrolling body + sticky footer. No geometry here;
 *    width/height/position/overflow/colours are widget controls.
 * ===================================================================== */

/* Remove the stray top offset Voxel/Elementor puts on the container. */
.ts-more-filters-portal .ts-field-popup-container {
	margin: 0 !important;
}

/* When the overlay is turned off in the widget, let the page show through. */
.ts-more-filters-portal .ts-field-popup-container.ts-no-overlay {
	background: transparent !important;
}

/* Full-height side drawer: the panel always fills the viewport height, so the
   scrolling body takes the slack and the Clear/Apply footer is pinned to the
   bottom while the filters stay at the top. Scoped to the portal, so (unlike
   the old global `.ts-field-popup{height:100vh}` hack) it never touches Voxel's
   other popups. */
.ts-more-filters-portal .ts-field-popup-container {
	align-items: stretch !important;
}
.ts-more-filters-portal .ts-field-popup {
	display: flex !important;
	flex-direction: column !important;
	height: 100dvh !important;
	max-height: 100dvh !important;
	min-height: 0 !important;
}

/* Header (title + close) — pinned. Padding/bg/border come from controls. */
.ts-more-filters-portal .ts-more-filters-close-wrapper {
	flex: 0 0 auto !important;
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.ts-more-filters-portal .ts-more-filters-title {
	font-weight: 600;
	flex: 1;
}

/* Body — the only scrolling region. */
.ts-more-filters-portal .ts-popup-content-wrapper {
	flex: 1 1 auto !important;
	min-height: 0 !important;
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch !important;
}

/* Footer (Clear / Apply) — pinned (never absolute/fixed). */
.ts-more-filters-portal .ts-popup-controller {
	flex: 0 0 auto !important;
	position: static !important;
}

/* Optional reversed order on tablet/mobile (widget toggle adds the class). */
@media (max-width: 1024px) {
	.ts-more-filters-portal.vxp-reverse-mobile .ts-field-popup {
		flex-direction: column-reverse !important;
	}
}

/* =====================================================================
 * 4. Entrance animations (tablet/mobile). The widget adds .vxp-anim-* and
 *    the JS restarts the animation each time the popup opens.
 * ===================================================================== */
@media (max-width: 1024px) {
	.ts-more-filters-portal .ts-field-popup {
		animation-fill-mode: forwards;
		animation-duration: 0.4s;
		animation-timing-function: cubic-bezier(0.22, 0.48, 0, 1);
	}
	.ts-more-filters-portal.vxp-anim-slide-up    .ts-field-popup { animation-name: vxp-slide-up; }
	.ts-more-filters-portal.vxp-anim-slide-left  .ts-field-popup { animation-name: vxp-slide-left; }
	.ts-more-filters-portal.vxp-anim-slide-right .ts-field-popup { animation-name: vxp-slide-right; }
	.ts-more-filters-portal.vxp-anim-fade        .ts-field-popup { animation-name: vxp-fade; }
}

@keyframes vxp-slide-up    { 0% { opacity: 0; transform: translateY(150px); } to { opacity: 1; transform: translateY(0); } }
@keyframes vxp-slide-left  { 0% { opacity: 0; transform: translateX(150px); } to { opacity: 1; transform: translateX(0); } }
@keyframes vxp-slide-right { 0% { opacity: 0; transform: translateX(-150px); } to { opacity: 1; transform: translateX(0); } }
@keyframes vxp-fade        { 0% { opacity: 0; } to { opacity: 1; } }

/* =====================================================================
 * 5. Collapsible filters — add the class "vx-collapse" in a filter's
 *    "Custom CSS class" field. Collapsed by default; click label to expand.
 *    (Padding / border / chevron colour are widget controls.)
 * ===================================================================== */
.vx-collapse > *:not(label) { display: none !important; }
.vx-collapse.vxp-expanded > *:not(label) { display: revert !important; }
.vx-collapse > label {
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	user-select: none;
	margin-bottom: 0 !important;
}
.vx-collapse > label::after {
	content: '';
	display: inline-block;
	flex-shrink: 0;
	margin-left: 8px;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	opacity: 0.6;
}
.vx-collapse.vxp-expanded > label::after { transform: rotate(-135deg); }

/* =====================================================================
 * 6. Opt-in filter utilities — add these in a filter's "Custom CSS class"
 *    field instead of writing per-id rules.
 * ===================================================================== */

/* Minimal stepper: hide +/- buttons, show a clean "Any" text input. */
.vxp-stepper-minimal .ts-stepper-input { padding: 0; }
.vxp-stepper-minimal .ts-stepper-input .ts-icon-btn { display: none !important; }
.vxp-stepper-minimal .ts-stepper-input input {
	width: 100%;
	max-width: 100%;
	border: none;
	outline: none;
	background: transparent;
	text-align: left !important;
}

/* Hide the on/off slider graphic on a switcher filter (keep it clickable). */
.vxp-hide-switch .switch-slider { display: none !important; }

/* =====================================================================
 * 7. Tier 1 enhancements — active filter chips, skeleton loader,
 *    mobile sheet drag handle. Each is gated by a widget toggle.
 * ===================================================================== */

/* --- Active filter chips --- */
.vxp-chips-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 0;
}
.vxp-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid var(--ts-shade-4, #e8e1d8);
	border-radius: 999px;
	background: var(--ts-popup-background, #fff);
	cursor: pointer;
	font-size: 0.85em;
	line-height: 1;
	color: inherit;
}
.vxp-chip:hover { border-color: currentColor; }
.vxp-chip-x { font-size: 1.25em; line-height: 1; opacity: 0.6; }
.vxp-chip-clear { border-style: dashed; opacity: 0.85; }

/* --- Skeleton loader --- */
.vxp-search-loader.vxp-skeleton-mode {
	align-items: flex-start;
	justify-content: center;
	background: #fff;
	overflow: auto;
}
.vxp-search-loader-skeleton {
	width: 100%;
	max-width: 1200px;
	padding: 24px 20px;
}
.vxp-skel-bar { display: flex; gap: 12px; margin-bottom: 24px; }
.vxp-skel-pill { flex: 1; height: 48px; border-radius: 8px; }
.vxp-skel-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 20px;
}
.vxp-skel-card { display: flex; flex-direction: column; gap: 10px; }
.vxp-skel-img { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; }
.vxp-skel-line { height: 14px; border-radius: 6px; width: 80%; }
.vxp-skel-line.short { width: 50%; }
.vxp-skel-pill,
.vxp-skel-img,
.vxp-skel-line {
	background: linear-gradient(90deg, #ececec 25%, #f5f5f5 37%, #ececec 63%);
	background-size: 400% 100%;
	animation: vxp-shimmer 1.4s ease infinite;
}
@keyframes vxp-shimmer {
	0% { background-position: 100% 0; }
	100% { background-position: 0 0; }
}

/* --- Mobile bottom-sheet drag handle --- */
.vxp-sheet-handle { display: none; }
@media (max-width: 1024px) {
	.ts-more-filters-portal .vxp-sheet-handle {
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 10px 0 6px;
		cursor: grab;
		touch-action: none;
		flex: 0 0 auto;
	}
	.ts-more-filters-portal .vxp-sheet-handle span {
		display: block;
		width: 40px;
		height: 5px;
		border-radius: 3px;
		background: var(--ts-shade-4, #d9d2c8);
	}
}

/* =====================================================================
 * 8. Tier 3 — instant (server-rendered) filter bar.
 *    A static copy of the bar shown before Vue mounts; hidden on mount.
 * ===================================================================== */
.vxp-ssr-bar { width: 100%; }
.vxp-ssr-bar.vxp-ssr-hidden { display: none !important; }
/* The static filters carry a literal v-if="false" attribute (harmless outside
   Vue) — make sure nothing collapses them inside the instant bar. */
.vxp-ssr-bar .ts-form-group[v-if] { display: ''; }
