/* ==========================================================================
   Filter Companies Plugin
   ========================================================================== */

:root {
	--fc-primary: var(--wp--preset--color--primary, #1D3D80);
}

.filter-companies-filter {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 0.5rem;
	position: relative;
	align-items: center;
}

/* ==========================================================================
   Filter group
   ========================================================================== */
.filter-group {
	position: static;
}

/* Toggle button */
.filter-group__toggle {
	display: flex;
	width: 100%;
	justify-content: space-between;
	align-items: center;
	gap: 0.375rem;
	background: transparent;
	border: 2px solid var(--fc-primary);
	border-radius: 9999px;
	padding: 0.5rem 0.875rem;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	color: var(--fc-primary);
	transition: background 0.15s ease, color 0.15s ease;
	user-select: none;
	box-sizing: border-box;
	outline: none;
}

.filter-group__toggle:focus,
.filter-group__toggle:active {
	outline: none;
	border:2px solid var(--fc-primary) !important;
}

.filter-group__toggle:hover {
	background: var(--fc-primary);
	color: #fff;
}

.filter-group--active .filter-group__toggle,
.filter-group__toggle[aria-expanded="true"] {
	background: var(--fc-primary);
	color: #fff;
}

/* Right side of toggle: count + arrow grouped */
.filter-group__toggle-end {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	flex-shrink: 0;
}

/* Arrow */
.filter-group__arrow {
	display: inline-block;
	width: 0.4rem;
	height: 0.4rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	margin-top: -2px;
	flex-shrink: 0;
}

.filter-group__toggle[aria-expanded="true"] .filter-group__arrow {
	transform: rotate(-135deg);
	margin-top: 2px;
}

/* Count badge */
.filter-group__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.25);
	color: currentColor;
	font-size: 0.65rem;
	font-weight: 700;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	flex-shrink: 0;
}

/* ==========================================================================
   Dropdown body
   ========================================================================== */
.filter-group__body {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 100;
	background: rgba(255, 255, 255, 0.95); /* slightly transparent */
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px); /* Safari support */
	padding: 1.25rem;
	min-width: 180px;
	box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.1);

	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	border-radius: 10px;
}

/* Pills row inside the body */
.filter-group__pills {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 0.375rem;
}

/* Header row: "N selected" + Clear link */
.filter-group__body-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid #e5e7eb;
	width: 100%;
}

.filter-group__selected {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--fc-primary);
}

.filter-group__clear {
	font-size: 0.75rem;
	color: #6b7280;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.filter-group__clear:hover {
	color: var(--fc-primary);
}

/* Section label inside combined dropdown (e.g. "Location" / "Country" headings) */
.filter-group__section-label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #9ca3af;
}

/* ==========================================================================
   Desktop
   ========================================================================== */
@media (min-width: 1024px) {
	.filter-companies-filter--equal {
		grid-template-columns: 1fr 1fr 1fr !important;
		gap: 1.25rem 2rem !important;
	}

	.filter-companies-filter {
		display: grid;
		grid-template-columns: 1fr 1fr 1fr;
		gap: 1.25rem 2rem;
		align-items: start;
	}

	/* First filter group starts at column 2, leaving column 1 empty */
	.filter-companies-filter .filter-group:first-child {
		grid-column-start: 1;
	}

	.filter-footer {
		grid-column: 3 / -1;
		display: flex;
		align-items: center;
		gap: 0.6rem;
		padding-top: 0.375rem;
	}

	.filter-group {
		width: 100%;
		position: relative;
	}

	.filter-group__count {
		background: var(--fc-primary);
		color: #fff;
	}
}

/* ==========================================================================
   Filter pills (the <a> term links)
   ========================================================================== */
.filter-pill {
	display: inline-block;
	padding: 0.375rem 0.875rem;
	font-size: 0.8125rem;
	font-weight: 500;
	border: 2px solid var(--fc-primary);
	border-radius: 9999px;
	color: var(--fc-primary);
	background: transparent;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease;
	line-height: 1.4;
	box-sizing: border-box;
	outline: none;
}

.filter-pill:focus {
	border-style: solid !important;
}
.filter-pill:hover {
	background: var(--fc-primary);
	color: #fff;
}

.filter-pill--active {
	background: var(--fc-primary);
	color: #fff;
	padding-right: 0.625rem;
}

.filter-pill--active::after {
	content: '×';
	margin-left: 0.35rem;
	font-size: 1.1em;
	line-height: 1;
	opacity: 0.75;
}

.filter-pill:focus,
.filter-pill:active {
	outline: none;
}

.filter-pill--active:hover {
	opacity: 0.85;
}

.filter-pill--all-members {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.filter-pill__ext-icon {
	flex-shrink: 0;
	vertical-align: middle;
}

.filter-pill--disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

/* ==========================================================================
   Filter footer (count + reset)
   ========================================================================== */

/* Count + separator: hidden on mobile, shown on desktop */
.filter-footer__count,
.filter-footer__sep {
	display: none;
}

@media (min-width: 1024px) {
	.filter-footer__count {
		display: inline;
		font-size: 0.875rem;
		font-weight: 600;
		color: var(--fc-primary);
	}

	.filter-footer__sep {
		display: inline;
		color: #d1d5db;
		font-size: 0.875rem;
	}
}

/* ==========================================================================
   Reset link
   ========================================================================== */
.filter-reset {
	display: inline-block;
	font-size: 0.875rem;
	color: var(--fc-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.filter-reset:hover {
	color: var(--fc-primary);
}

@media (min-width: 1024px) {
	.filter-reset {
		padding: 0;
	}
}

/* ==========================================================================
   Certificate filter
   ========================================================================== */

/* Desktop pill: hidden on mobile */
.filter-certificate {
	display: none;
}

/* Mobile pill inside category dropdown: shown on mobile, hidden on desktop */
.filter-certificate--in-dropdown {
	display: flex;
}

@media (min-width: 1024px) {
	.filter-certificate {
		display: flex;
		align-items: center;
		width: 100%;
	}

	.filter-certificate .filter-pill {
		width: 100%;
		display: flex;
		justify-content: center;
		box-sizing: border-box;
		padding: 0.55rem 0.875rem;
		font-size: 0.875rem;

	}

	.filter-certificate--in-dropdown {
		display: none !important;
	}

	/* On the --equal layout (visit-sauna), cert fills col 3 so footer wraps to its own row */
	.filter-companies-filter--equal .filter-footer {
		grid-column: 1 / -1;
	}
}

/* Checkmark before text when certificate pill is active (replaces the default × after) */
.filter-pill--certificate.filter-pill--active::before {
	content: '✓';
	margin-right: 0.35rem;
	font-size: 0.9em;
	opacity: 0.85;
}

.filter-pill--certificate.filter-pill--active::after {
	display: none;
}

/* ==========================================================================
   No results
   ========================================================================== */
.filter-companies--cards .no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 3rem 1rem;
	color: #6b7280;
	font-size: 1rem;
}
