/* Netstry Filter - Flexible, variable-driven styles (no hardcoded theme overrides) */

.nf-facet {
	--nf-accent: #0f172a;
	--nf-accent-hover: #1e293b;
	--nf-accent-text: #ffffff;
	--nf-bg: transparent;
	--nf-input-bg: #ffffff;
	--nf-text: inherit;
	--nf-muted: #64748b;
	--nf-border-color: #cbd5e1;
	--nf-border-focus: #0f172a;
	--nf-radius: 4px;
	--nf-gap: 0.5rem;
	--nf-font-size: 0.9375rem;
	--nf-hover-bg: rgba(15, 23, 42, 0.05);

	box-sizing: border-box;
	width: 100%;
	font-family: inherit;
	font-size: var(--nf-font-size);
	color: var(--nf-text);
	background: var(--nf-bg);
}

.nf-facet *,
.nf-facet *::before,
.nf-facet *::after {
	box-sizing: border-box;
}

/* Search + Autocomplete */
.nf-search-form {
	display: flex;
	align-items: stretch;
	gap: var(--nf-gap);
	width: 100%;
}

.nf-search-input-wrap {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

.nf-search-input {
	width: 100%;
	padding: 0.5rem 0.75rem;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.4;
	color: var(--nf-text);
	background-color: var(--nf-input-bg);
	border: 1px solid var(--nf-border-color);
	border-radius: var(--nf-radius);
	transition: border-color 0.15s ease;
}

.nf-search-input:focus {
	outline: none;
	border-color: var(--nf-border-focus);
}

.nf-search-button {
	flex: 0 0 auto;
	padding: 0.5rem 0.9rem;
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.4;
	color: var(--nf-accent-text);
	background-color: var(--nf-accent);
	border: 1px solid var(--nf-accent);
	border-radius: var(--nf-radius);
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.nf-search-button:hover,
.nf-search-button:focus-visible {
	background-color: var(--nf-accent-hover);
}

.nf-autocomplete-list {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 999;
	margin: 0;
	padding: 0.25rem 0;
	list-style: none;
	background-color: var(--nf-input-bg);
	border: 1px solid var(--nf-border-color);
	border-radius: var(--nf-radius);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
	max-height: 260px;
	overflow-y: auto;
}

.nf-autocomplete-item {
	padding: 0.45rem 0.75rem;
	cursor: pointer;
	line-height: 1.35;
	transition: background-color 0.1s ease;
}

.nf-autocomplete-item:hover,
.nf-autocomplete-item.is-active {
	background-color: var(--nf-hover-bg);
}

.nf-autocomplete-empty {
	padding: 0.5rem 0.75rem;
	color: var(--nf-muted);
	font-size: 0.875em;
}

/* Select Dropdown */
.nf-select {
	width: 100%;
	padding: 0.5rem 0.75rem;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.4;
	color: var(--nf-text);
	background-color: var(--nf-input-bg);
	border: 1px solid var(--nf-border-color);
	border-radius: var(--nf-radius);
	cursor: pointer;
}

.nf-select:focus {
	outline: none;
	border-color: var(--nf-border-focus);
}

/* Checkboxes & Radio Lists */
.nf-choice-list {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.nf-choice-item {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0;
	padding: 0.15rem 0;
	cursor: pointer;
	line-height: 1.4;
	user-select: none;
}

.nf-choice-item[hidden] {
	display: none;
}

.nf-checkbox,
.nf-radio {
	flex: 0 0 auto;
	width: 1rem;
	height: 1rem;
	margin: 0.2rem 0 0;
	accent-color: var(--nf-accent);
	cursor: pointer;
}

.nf-choice-label {
	flex: 1 1 auto;
	min-width: 0;
	word-break: break-word;
}

.nf-choice-count {
	flex: 0 0 auto;
	color: var(--nf-muted);
	font-size: 0.9em;
}

.nf-choice-item.is-selected .nf-choice-label {
	font-weight: 600;
}

/* Show More / Less & Reset */
.nf-toggle-more,
.nf-reset-button {
	margin-top: 0.5rem;
	padding: 0.35rem 0.75rem;
	font-family: inherit;
	font-size: 0.875em;
	font-weight: 600;
	color: var(--nf-accent);
	background: transparent;
	border: 1px solid var(--nf-border-color);
	border-radius: var(--nf-radius);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.nf-toggle-more:hover,
.nf-reset-button:hover {
	background-color: var(--nf-hover-bg);
}

/* Loading State on Target Grid & Facets */
.nf-is-loading {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.nf-search-input,
	.nf-select {
		font-size: 1rem; /* Prevents iOS auto-zoom on focus */
		min-height: 42px;
	}

	.nf-search-button {
		min-height: 42px;
	}

	.nf-choice-item {
		padding: 0.25rem 0;
	}
}
