.htlf-form,
.htlf-widget {
	width: 100%;
}

.htlf-widget {
	padding-bottom: 12px;
}

.htlf-fields {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

/* V0.2.6: keep the filter controls as a compact group while allowing the
 * actions group to stay pinned to the opposite edge. */
.htlf-filter-controls {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start;
	gap: 12px;
	min-width: 0;
}

.htlf-label {
	flex: 0 0 auto;
	font-size: 13px;
	white-space: nowrap;
}

.htlf-field {
	flex: 0 1 280px;
	min-width: 180px;
}

.htlf-control {
	width: 100%;
	min-height: 46px;
	padding: 10px 14px;
	border: 1px solid #d6d9df;
	border-radius: 8px;
	background: #fff;
	font: inherit;
	line-height: 1.25;
}

/*
 * Prevent the native browser focus ring from remaining around taxonomy
 * selects after pointer interaction. Keyboard users still receive a clear
 * focus indicator via :focus-visible.
 */
.htlf-select:focus {
	outline: none !important;
	box-shadow: none !important;
}

.htlf-select:focus:not(:focus-visible) {
	outline: none !important;
	box-shadow: none !important;
}

.htlf-select:focus-visible {
	outline: 2px solid rgba(0, 0, 0, 0.25) !important;
	outline-offset: 2px;
	box-shadow: none !important;
}

.htlf-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 0 0 auto;
	margin-left: auto;
}

.htlf-submit {
	min-height: 46px;
	padding: 10px 20px;
	border: 1px solid currentColor;
	border-radius: 8px;
	cursor: pointer;
	font: inherit;
}

.htlf-clear {
	white-space: nowrap;
}

.htlf-status {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 8px;
	height: 32px;
	margin-bottom: 8px;
	overflow: hidden;
}

.htlf-result-count {
	flex: 0 0 auto;
	font-size: 0.95em;
}

.htlf-chips {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: nowrap;
	min-width: 0;
	gap: 6px;
	overflow-x: auto;
	overflow-y: hidden;
}

.htlf-chip {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 5px;
	padding: 3px 8px;
	border: 1px solid #d6d9df;
	border-radius: 8px;
	background: transparent;
	font: inherit;
	font-size: 0.8em;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
}

.htlf-chip__remove {
	font-size: 1.1em;
	line-height: 1;
}

.htlf-is-loading,
.htlf-results-is-loading {
	cursor: progress;
}

.htlf-results-is-loading {
	opacity: 0.55;
	transition: opacity 160ms ease;
	pointer-events: none;
}

.htlf-is-loading .htlf-submit {
	opacity: 0.65;
	pointer-events: none;
}

.htlf-editor-warning {
	padding: 12px 14px;
	border: 1px solid #d6d9df;
	border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
	.htlf-results-is-loading {
		transition: none;
	}
}

@media (max-width: 767px) {
	.htlf-filter-controls,
	.htlf-field,
	.htlf-actions {
		flex: 1 1 100%;
		width: 100%;
	}

	.htlf-filter-controls {
		justify-content: flex-start !important;
	}

	.htlf-label {
		flex-basis: 100%;
		width: 100%;
	}

	.htlf-actions {
		justify-content: space-between;
		margin-left: 0 !important;
	}

	.htlf-status {
		align-items: center;
	}
}

/* V0.2.5: fully styleable custom select UI. The native select remains the
 * source of truth and the no-JavaScript fallback. */
.htlf-dropdown {
	display: none;
	position: relative;
	width: 100%;
}

.htlf-enhanced .htlf-native-select {
	display: none;
}

.htlf-enhanced .htlf-dropdown {
	display: block;
}

.htlf-dropdown__button {
	width: 100%;
	min-height: 46px;
	padding: 10px 14px;
	border: 1px solid #d6d9df;
	border-radius: 8px;
	background: #fff;
	color: inherit;
	font: inherit;
	line-height: 1.25;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 12px;
	text-align: left;
	cursor: pointer;
}

.htlf-dropdown__button:focus {
	outline: none;
	box-shadow: none;
}

.htlf-dropdown__button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.htlf-dropdown__value {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
	white-space: normal;
	/* Explicit inheritance prevents theme/button span rules from overriding
	 * the Elementor Filter fields typography applied to the trigger. */
	font: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	text-decoration: inherit;
	color: inherit;
}

.htlf-dropdown__chevron {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transform-origin: 60% 60%;
	transition: transform 160ms ease;
}

.htlf-dropdown.is-open .htlf-dropdown__chevron {
	transform: rotate(225deg) translate(-1px, -1px);
}

.htlf-dropdown__menu {
	position: absolute;
	left: 0;
	top: calc(100% + 6px);
	width: 100%;
	min-width: 100%;
	z-index: 9999;
	padding: 0;
	border: 1px solid #d6d9df;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.htlf-dropdown__menu[hidden] {
	display: none !important;
}

.htlf-dropdown__options {
	max-height: 360px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.htlf-dropdown__option {
	appearance: none;
	-webkit-appearance: none;
	display: block;
	width: 100%;
	margin: 0;
	padding: 12px 14px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.35;
	text-align: left;
	overflow-wrap: anywhere;
	white-space: normal;
	cursor: pointer;
}

.htlf-dropdown__option:not(:last-child) {
	border-bottom: 1px solid #e7e7e7;
}

.htlf-dropdown__option:hover,
.htlf-dropdown__option:focus-visible {
	background: rgba(0, 0, 0, 0.04);
	outline: none;
}

.htlf-dropdown__option[aria-selected="true"] {
	font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
	.htlf-dropdown__chevron {
		transition: none;
	}
}
