/* Clear Tribe Advanced Taxonomy Filter */
.ctaf-filter {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ctaf-filter-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.ctaf-filter-by-label {
	font-weight: 500;
	margin-right: 0.25rem;
	flex-shrink: 0;
}
.ctaf-filter-by-label:hover {
	color: inherit !important;
}

/* Ensure Filter by label is visible on desktop (mobile rules hide it when collapsible) */
@media (min-width: 768px) {
	.ctaf-filter-row .ctaf-filter-by-label {
		display: inline !important;
	}
}

.ctaf-dropdowns-wrap {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
}

.ctaf-dropdown-wrap {
	flex: 1;
	min-width: 0;
}

.ctaf-dropdown-inner {
	position: relative;
	min-width: 0;
}

.ctaf-dropdown-inner::after {
	content: '';
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid currentColor;
	pointer-events: none;
}

/* Custom caret (uploaded image) overrides default triangle */
.ctaf-filter.ctaf-custom-caret .ctaf-dropdown-inner::after {
	border: none;
	width: 16px;
	height: 16px;
	background: var(--ctaf-caret-url) no-repeat center;
	background-size: contain;
}

.ctaf-dropdown {
	width: 100%;
	min-width: 0;
	padding: 0.4em 2.5em 0.4em 0.75em;
	border: 1px solid #ddd;
	border-radius: 4px;
	background-color: #fff;
	cursor: pointer;
	font-size: inherit;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

.ctaf-meta-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.ctaf-results-count {
	font-weight: 500;
}

.ctaf-empty-results {
	margin-top: 0.75rem;
	padding: 1rem;
	color: #666;
	font-style: italic;
	text-align: center;
}

.ctaf-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-left: auto;
}

.ctaf-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.25em 0.5em;
	background: #f0f0f0;
	border-radius: 4px;
	font-size: 0.9em;
}

.ctaf-pill-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	color: #666;
	font-size: 1.2em;
	line-height: 1;
	padding: 0 0.1em;
	border: none;
	background: none;
	cursor: pointer;
}

.ctaf-pill-remove svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.ctaf-pill-remove:hover {
	color: #333;
}

.ctaf-empty {
	padding: 1em;
	background: #f9f9f9;
	border: 1px dashed #ddd;
	border-radius: 4px;
	color: #666;
}

/* Dropdown label - visible on mobile */
.ctaf-dropdown-label {
	display: none;
}

/* Mobile toggle - hidden on desktop */
.ctaf-mobile-toggle {
	display: none;
}

/* Prevent hover color change on mobile Filter By (avoids theme/Elementor white hover) */
.ctaf-mobile-toggle:hover,
.ctaf-mobile-toggle:hover .ctaf-filter-by-label,
.ctaf-mobile-toggle:hover .ctaf-toggle-icon {
	color: inherit !important;
}

/* Custom expand/collapse icons for mobile toggle */
.ctaf-filter.ctaf-custom-toggle-icons .ctaf-toggle-icon {
	border: none;
	width: 20px;
	height: 20px;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}
.ctaf-filter.ctaf-custom-toggle-icons:not(.ctaf-collapsed) .ctaf-toggle-icon {
	background-image: var(--ctaf-toggle-expand-url, var(--ctaf-toggle-collapse-url, none));
	transform: none;
}
.ctaf-filter.ctaf-custom-toggle-icons.ctaf-collapsed .ctaf-toggle-icon {
	background-image: var(--ctaf-toggle-collapse-url);
	transform: none;
}

/* Mobile layout (≤767px) */
@media (max-width: 767px) {
	.ctaf-filter {
		background: none;
		border-radius: 16px;
		gap: 1rem;
	}

	.ctaf-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 0.5rem 0;
		background: none;
		border: none;
		cursor: pointer;
		font-family: inherit;
		font-size: 1rem;
		font-weight: 600;
		color: #333;
		text-align: left;
		touch-action: manipulation; /* prevents mobile tap delay / double-tap zoom interference */
	}

	.ctaf-mobile-toggle .ctaf-filter-by-label {
		margin-right: 0.5rem;
	}

	.ctaf-toggle-icon {
		display: inline-block;
		width: 0;
		height: 0;
		border-left: 6px solid transparent;
		border-right: 6px solid transparent;
		border-top: 8px solid #6b4d9e;
		transition: transform 0.2s ease;
	}

	.ctaf-filter.ctaf-collapsed .ctaf-toggle-icon {
		transform: rotate(-90deg);
	}

	/* Custom expand/collapse images override default triangle */
	.ctaf-filter.ctaf-custom-toggle-icons .ctaf-toggle-icon {
		width: 20px;
		height: 20px;
		border: none;
		transform: none;
		background: var(--ctaf-toggle-expand-url, var(--ctaf-toggle-collapse-url, none)) no-repeat center;
		background-size: contain;
	}
	.ctaf-filter.ctaf-custom-toggle-icons.ctaf-collapsed .ctaf-toggle-icon {
		background-image: var(--ctaf-toggle-collapse-url, var(--ctaf-toggle-expand-url));
	}

	.ctaf-filter.ctaf-collapsed .ctaf-collapsible-content {
		display: none !important;
	}
	/* Explicit expanded state – ensures content reappears after collapse */
	.ctaf-filter[data-collapsible-mobile="yes"]:not(.ctaf-collapsed) .ctaf-collapsible-content {
		display: block !important;
		max-height: none;
		opacity: 1;
		visibility: visible;
	}

	.ctaf-dropdown-label {
		display: block;
		font-size: 0.9em;
		font-weight: 500;
		color: #333;
		margin-bottom: 0.35rem;
	}

	.ctaf-filter-row {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}

	.ctaf-dropdowns-wrap {
		flex-direction: column;
		flex: none;
		width: 100%;
		gap: 1rem;
	}

	.ctaf-dropdown-wrap {
		flex: none;
		width: 100%;
	}

	.ctaf-dropdown {
		width: 100%;
		border-radius: 12px;
		border-color: #e0e0e0;
		padding: 0.6em 2.5em 0.6em 1em;
	}

	.ctaf-meta-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}

	.ctaf-pills {
		margin-left: 0;
	}

	.ctaf-pill {
		background: #e8e0f0;
		color: #4a3d6b;
		border-radius: 20px;
		padding: 0.35em 0.65em;
	}

	.ctaf-pill-remove {
		color: #4a3d6b;
	}

	.ctaf-pill-remove:hover {
		color: #2d2445;
	}

	.ctaf-results-count {
		font-weight: 600;
		color: #333;
	}
}

/* AJAX loader overlay and spinner */
.ctaf-loading {
	position: relative;
	min-height: 120px;
}

.ctaf-ajax-overlay {
	position: absolute;
	inset: 0;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.ctaf-ajax-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #e0e0e0;
	border-top-color: #555;
	border-radius: 50%;
	animation: ctaf-spin 0.8s linear infinite;
}

@keyframes ctaf-spin {
	to { transform: rotate(360deg); }
}

/* Mobile layout - stacked dropdowns, collapsible, card style */
.ctaf-dropdown-label {
	display: none;
}

@media (max-width: 767px) {
	.ctaf-filter {
		background: none;
		border-radius: 16px;
	}
	.ctaf-filter-row {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}
	.ctaf-filter-row .ctaf-filter-by-label {
		display: none;
	}
	.ctaf-dropdowns-wrap {
		flex-direction: column;
		flex: none;
		gap: 0.75rem;
	}
	.ctaf-dropdown-wrap {
		flex: none;
		width: 100%;
	}
	.ctaf-dropdown {
		border-radius: 12px;
	}
	.ctaf-dropdown-label {
		display: block;
		font-size: 0.875rem;
		font-weight: 500;
		color: #333;
		margin-bottom: 0.35rem;
	}
	.ctaf-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 0 0 0.75rem;
		margin-bottom: 0.5rem;
		border: none;
		background: none;
		cursor: pointer;
		font-size: 1rem;
		font-weight: 600;
		color: #333;
		text-align: left;
	}
	.ctaf-mobile-toggle .ctaf-filter-by-label {
		margin-right: 0;
	}
	.ctaf-mobile-toggle .ctaf-toggle-icon {
		display: inline-block;
		width: 0;
		height: 0;
		border-left: 6px solid transparent;
		border-right: 6px solid transparent;
		border-top: 8px solid #6b4d9a;
		transition: transform 0.2s;
	}
	.ctaf-filter.ctaf-collapsed .ctaf-mobile-toggle .ctaf-toggle-icon {
		transform: rotate(-90deg);
	}
	.ctaf-collapsible-content {
		overflow: hidden;
		transition: max-height 0.3s ease, opacity 0.2s;
	}
	.ctaf-filter.ctaf-collapsed .ctaf-collapsible-content {
		max-height: 0;
		opacity: 0;
		overflow: hidden;
		margin: 0;
		padding: 0;
	}
	/* Explicit expanded state – content must reappear after collapse */
	.ctaf-filter[data-collapsible-mobile="yes"]:not(.ctaf-collapsed) .ctaf-collapsible-content {
		display: block !important;
		max-height: none;
		opacity: 1;
	}
	.ctaf-meta-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}
	.ctaf-pills {
		margin-left: 0;
	}
}

/* Mobile layout – vertical stack, card styling, collapsible */
.ctaf-dropdown-label {
	display: none;
}

@media (max-width: 767px) {
	.ctaf-filter {
		background: none;
		border-radius: 16px;
	}
	.ctaf-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 0.5rem 0;
		background: none;
		border: none;
		font: inherit;
		color: inherit;
		cursor: pointer;
		text-align: left;
	}
	.ctaf-mobile-toggle .ctaf-filter-by-label {
		font-weight: 600;
		font-size: 1.05em;
		margin-right: 0.5rem;
	}
	.ctaf-toggle-icon {
		display: inline-block;
		width: 0;
		height: 0;
		border-left: 6px solid transparent;
		border-right: 6px solid transparent;
		border-top: 8px solid currentColor;
		transition: transform 0.2s ease;
	}
	.ctaf-filter[data-collapsible-mobile="yes"].ctaf-collapsed .ctaf-toggle-icon {
		transform: rotate(-180deg);
	}
	.ctaf-filter:not([data-collapsible-mobile="yes"]) .ctaf-mobile-toggle {
		display: none;
	}
	.ctaf-dropdown-label {
		display: block;
		font-size: 0.9em;
		font-weight: 500;
		margin-bottom: 0.35rem;
		color: #333;
	}
	.ctaf-filter-row {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}
	.ctaf-filter-row .ctaf-filter-by-label {
		display: none;
	}
	.ctaf-dropdowns-wrap {
		flex-direction: column;
		flex: none;
		width: 100%;
		gap: 0.75rem;
	}
	.ctaf-dropdown-wrap {
		flex: none;
		width: 100%;
	}
	.ctaf-dropdown {
		width: 100%;
		border-radius: 12px;
		border-color: #e0e0e0;
		padding: 0.6em 2.5em 0.6em 1rem;
	}
	.ctaf-meta-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.75rem;
	}
	.ctaf-pills {
		margin-left: 0;
	}
	.ctaf-results-count {
		font-weight: 600;
	}
	.ctaf-pill {
		border-radius: 999px;
	}
}

/* Dropdown label - visible on mobile only */
.ctaf-dropdown-label {
	display: none;
}

/* Mobile layout and styling (767px = Elementor mobile breakpoint) */
@media (max-width: 767px) {
	.ctaf-filter {
		background: none;
		border-radius: 12px;
	}

	.ctaf-filter[data-collapsible-mobile="yes"] .ctaf-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 0.5rem 0;
		border: none;
		background: none;
		cursor: pointer;
		font: inherit;
		text-align: left;
	}

	.ctaf-filter[data-collapsible-mobile="no"] .ctaf-mobile-toggle {
		display: none;
	}

	.ctaf-toggle-icon {
		display: inline-block;
		width: 0;
		height: 0;
		border-left: 5px solid transparent;
		border-right: 5px solid transparent;
		border-top: 6px solid currentColor;
		transition: transform 0.2s;
	}

	.ctaf-filter.ctaf-collapsed .ctaf-toggle-icon {
		transform: rotate(-180deg);
	}

	.ctaf-filter[data-collapsible-mobile="yes"] .ctaf-collapsible-content {
		overflow: hidden;
		transition: max-height 0.3s ease, opacity 0.2s ease;
	}

	/* Expanded: explicitly show content */
	.ctaf-filter[data-collapsible-mobile="yes"]:not(.ctaf-collapsed) .ctaf-collapsible-content {
		display: block;
		max-height: 2000px;
		opacity: 1;
		pointer-events: auto;
	}

	/* Collapsed: hide content */
	.ctaf-filter[data-collapsible-mobile="yes"].ctaf-collapsed .ctaf-collapsible-content {
		display: none;
	}

	.ctaf-filter-row {
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
	}

	/* Only hide filter row label on mobile when collapsible (toggle has it); keep visible on desktop */
	.ctaf-filter[data-collapsible-mobile="yes"] .ctaf-filter-row .ctaf-filter-by-label {
		display: none;
	}

	.ctaf-dropdowns-wrap {
		flex-direction: column;
		flex: none;
		width: 100%;
		gap: 0.75rem;
	}

	.ctaf-dropdown-wrap {
		flex: none;
		width: 100%;
		display: flex;
		flex-direction: column;
		gap: 0.25rem;
	}

	.ctaf-dropdown-label {
		display: block;
		font-size: 0.9em;
		color: inherit;
		font-weight: 500;
	}

	.ctaf-dropdown {
		border-radius: 10px;
		padding: 0.6em 2.5em 0.6em 0.75em;
		width: 100%;
	}

	.ctaf-meta-row {
		flex-direction: column;
		align-items: stretch;
		gap: 0.75rem;
	}
	.ctaf-pills {
		margin-left: 0;
		order: 1;
	}

	.ctaf-results-count {
		order: 2;
	}
}

/* Dropdown labels - visible on mobile only */
.ctaf-dropdown-label {
	display: none;
}

/* Mobile layout */
@media (max-width: 767px) {
	.ctaf-filter {
		background: none;
		border-radius: 12px;
	}

	.ctaf-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 0.5rem 0;
		background: none;
		border: none;
		cursor: pointer;
		font-family: inherit;
		font-size: inherit;
		font-weight: 500;
		color: #333;
		text-align: left;
	}

	.ctaf-mobile-toggle .ctaf-filter-by-label {
		margin-right: 0.5rem;
	}

	.ctaf-toggle-icon {
		display: inline-block;
		width: 0;
		height: 0;
		border-left: 6px solid transparent;
		border-right: 6px solid transparent;
		border-top: 8px solid #6b4d9e;
		transition: transform 0.2s ease;
	}

	.ctaf-filter[data-collapsible-mobile="yes"].ctaf-collapsed .ctaf-toggle-icon {
		transform: rotate(-180deg);
	}

	.ctaf-filter:not([data-collapsible-mobile="yes"]) .ctaf-mobile-toggle {
		display: none;
	}

	.ctaf-filter[data-collapsible-mobile="yes"] .ctaf-collapsible-content {
		overflow: hidden;
		transition: max-height 0.3s ease, opacity 0.2s ease;
	}

	/* Expanded: must explicitly restore visibility so it reappears after collapse */
	.ctaf-filter[data-collapsible-mobile="yes"]:not(.ctaf-collapsed) .ctaf-collapsible-content {
		display: block !important;
		max-height: 2000px;
		opacity: 1;
		pointer-events: auto;
	}

	.ctaf-filter[data-collapsible-mobile="yes"].ctaf-collapsed .ctaf-collapsible-content {
		display: none !important;
	}

	.ctaf-filter-row {
		flex-direction: column;
		align-items: stretch;
	}

	.ctaf-filter[data-collapsible-mobile="yes"] .ctaf-filter-row {
		margin-top: 0.5rem;
	}

	.ctaf-dropdowns-wrap {
		flex-direction: column;
		flex: none;
		gap: 0.75rem;
	}

	.ctaf-dropdown-wrap {
		flex: none;
		width: 100%;
		display: flex;
		flex-direction: column;
		gap: 0.35rem;
	}

	.ctaf-dropdown-label {
		display: block;
		font-size: 0.9em;
		font-weight: 500;
		color: #333;
	}

	.ctaf-dropdown {
		border-radius: 10px;
		border-color: #e0e0e0;
	}

	.ctaf-meta-row {
		flex-direction: column;
		align-items: flex-start;
		margin-top: 0.75rem;
		padding-top: 0.75rem;
		border-top: 1px solid #e8e8e8;
	}
	.ctaf-pills {
		margin-left: 0;
	}

	.ctaf-pill {
		background: #e8e0f0;
		color: #4a3d6b;
		border-radius: 20px;
		padding: 0.35em 0.6em;
	}

	.ctaf-pill-remove {
		color: #4a3d6b;
	}

	.ctaf-pill-remove:hover {
		color: #2d2340;
	}

	.ctaf-results-count {
		font-weight: 600;
	}
}
