:root {
	--wpd-text: #16324f;
	--wpd-bar-bg: #f2f1ec;
	--wpd-panel-bg: #ffffff;
	--wpd-input-bg: #ffffff;
	--wpd-accent-green: #009041;
	--wpd-cta-bg: #fbcd00;
	--wpd-cta-text: #002f38;
	--wpd-divider: #b7d34a;
	--wpd-border-radius: 10px;
	--wpd-tab-inactive-bg: transparent;
	--wpd-tab-hover-bg: #fbcd00;
	--wpd-tab-hover-text: #002f38;
	--wpd-tab-active-bg: transparent;
	--wpd-tab-active-text: #ffffff;

	/* New tokens for the green-card search widget design. */
	--wpd-card-bg: #009041;
	--wpd-card-radius: 20px;
	--wpd-tab-text: #ffffff;
	--wpd-tab-active-border: #fbcd00;
	--wpd-tab-divider: rgba(255, 255, 255, 0.35);
	--wpd-caption-color: rgba(255, 255, 255, 0.85);
	--wpd-placeholder: #5b6670;
}

.wpd-directory-search {
	font-family: inherit;
	max-width: 900px;
	margin: 0 auto;
	background: var(--wpd-card-bg);
	border-radius: var(--wpd-card-radius);
	padding: 28px 28px 26px;
	box-sizing: border-box;
}

.wpd-results-wrap {
	max-width: 900px;
	margin: 0 auto;
}

.wpd-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px;
	padding: 0 0 18px;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--wpd-tab-divider);
}

.wpd-tab-divider {
	flex: 0 0 auto;
	width: 1px;
	height: 22px;
	background: var(--wpd-tab-divider);
	margin: 0 6px;
}

@media (max-width: 640px) {
	.wpd-tab-divider {
		display: none;
	}
}

/*
 * box-shadow/outline/padding/margin/border-radius/border-width below still carry !important
 * as defense against host-theme global button styles bleeding through on bare <button>
 * elements. background/color do NOT — those are also exposed as Elementor Style controls
 * (see elementor-widget.php), and Elementor's generated CSS for them already carries
 * !important. Two !important declarations for the same property fall back to source order,
 * which isn't reliably "Elementor wins" — so each contested property should only ever have
 * ONE !important source, and that source is the Elementor control.
 */
.wpd-directory-search .wpd-tab {
	flex: 0 0 auto;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 8px;
	background: var(--wpd-tab-inactive-bg);
	border: 2px solid transparent !important;
	box-shadow: none !important;
	outline: none !important;
	color: var(--wpd-tab-text);
	padding: 10px 16px !important;
	margin: 0 !important;
	text-decoration: none !important;
	border-radius: 10px !important;
	cursor: pointer;
	white-space: nowrap;
}

.wpd-directory-search .wpd-tab h5 {
	margin: 0 !important;
	color: inherit !important;
	display: inline-block;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
}

/* The reference design has no icon next to the tab label — hidden rather than removed
   from the markup, so nothing else that reads .wpd-tab-icon (JS, Elementor) has to change. */
.wpd-tab-icon {
	display: none;
}

/*
 * Elementor's style controls generate `.wpd-tab { background-color/color: X !important }`
 * and `.wpd-tab.is-active { ... !important }` (see elementor-widget.php), compiled behind
 * Elementor's {{WRAPPER}} which currently resolves to a specificity of 0,4,0. A plain class
 * selector here — even with !important and a pseudo-class added — isn't guaranteed to clear
 * that as Elementor's wrapper selector grows. The reliable way to beat any number of classes
 * is an ID (specificity 1,0,0 always outranks 0,N,0), so the tab list carries id="wpd-tabs"
 * and hover/focus rules are anchored to it.
 */
#wpd-tabs .wpd-tab:hover {
	background: var(--wpd-tab-hover-bg) !important;
	color: var(--wpd-tab-hover-text) !important;
}

/* Focus keeps the normal tab colors (not yellow) but still needs a visible
   indicator for keyboard users, so it gets an outline instead of a bg change. */
#wpd-tabs .wpd-tab:focus-visible {
	outline: 2px solid #ffffff !important;
	outline-offset: 2px;
}

/*
 * Active state is a gold outline around white bold text rather than a filled background —
 * the whole card is already the brand green, so a green fill on the active tab would be
 * invisible against it.
 */
.wpd-directory-search .wpd-tab.is-active,
#wpd-tabs .wpd-tab.is-active {
	background: var(--wpd-tab-active-bg) !important;
	color: var(--wpd-tab-active-text) !important;
	border-color: var(--wpd-tab-active-border) !important;
}

#wpd-tabs .wpd-tab.is-active:hover {
	background: var(--wpd-tab-hover-bg) !important;
	color: var(--wpd-tab-hover-text) !important;
	border-color: var(--wpd-tab-hover-bg) !important;
}

.wpd-directory-search .wpd-tab.is-active h5 {
	font-weight: 700 !important;
}

.wpd-search-form {
	background: transparent;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 16px;
}

.wpd-field {
	flex: 1 1 170px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

/*
 * The approved design shows no visible field labels above the inputs — only the tab row,
 * the inputs themselves, and a short caption underneath. The labels stay in the markup
 * (screen readers and the "for"/id pairing still need them) but are visually hidden rather
 * than removed, so removing this rule is all it'd take to bring labels back on screen.
 */
.wpd-field label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.wpd-field-primary {
	flex: 1 1 220px;
}

.wpd-field-radius {
	flex: 1 1 160px;
}

.wpd-panel {
	display: none;
}

.wpd-panel.is-active {
	display: block;
}

.wpd-field input,
.wpd-field select {
	width: 100%;
	padding: 14px 16px;
	border: none;
	border-radius: var(--wpd-border-radius);
	font-size: 15px;
	color: var(--wpd-text);
	background: var(--wpd-input-bg);
	box-sizing: border-box;
}

.wpd-field input::placeholder {
	color: var(--wpd-placeholder);
}

.wpd-select {
	position: relative;
	width: 100%;
}

.wpd-select select {
	display: none;
}

.wpd-directory-search .wpd-select-trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px !important;
	margin: 0 !important;
	border: none !important;
	box-shadow: none !important;
	border-radius: var(--wpd-border-radius) !important;
	background: var(--wpd-input-bg) !important;
	color: var(--wpd-text) !important;
	font-size: 15px !important;
	font-weight: 400 !important;
	text-align: left;
	cursor: pointer;
}

.wpd-select.is-open .wpd-select-trigger {
	border-radius: var(--wpd-border-radius) var(--wpd-border-radius) 0 0 !important;
}

.wpd-select-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpd-select-arrow {
	flex: 0 0 auto;
	font-size: 12px;
	color: var(--wpd-text);
	transition: transform 0.15s ease;
}

.wpd-select.is-open .wpd-select-arrow {
	transform: rotate(180deg);
}

.wpd-select.is-disabled .wpd-select-trigger {
	opacity: 0.6;
	cursor: default;
}

.wpd-select-list {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 1000;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--wpd-panel-bg);
	border-radius: 0 0 var(--wpd-border-radius) var(--wpd-border-radius);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
	max-height: 260px;
	overflow-y: auto;
}

.wpd-select-option {
	padding: 10px 12px;
	border-radius: 4px;
	font-size: 15px;
	color: var(--wpd-text);
	cursor: pointer;
}

.wpd-select-option:hover {
	background: #f2f1ec;
}

.wpd-select-option.is-selected {
	background: #cdeedb;
	font-weight: 700;
}

.wpd-desc {
	font-size: 12.5px;
	color: var(--wpd-caption-color);
	margin-top: 2px;
}

.wpd-directory-search .wpd-submit {
	flex: 0 0 auto;
	background: var(--wpd-cta-bg);
	color: var(--wpd-cta-text);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: none !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	border-radius: var(--wpd-border-radius) !important;
	padding: 14px 26px !important;
	margin: 0 !important;
	/* Pushes the button to the right edge of its row — whether that's the same row as
	   the fields, or its own wrapped row when there isn't room to stay inline. Fields no
	   longer carry a visible label above them, so the button's own top edge already lines
	   up with the input fields without any extra top offset. */
	margin-left: auto !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	cursor: pointer;
	white-space: nowrap;
}

.wpd-submit-icon {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	line-height: 0;
	color: inherit;
}

.wpd-submit-icon svg {
	display: block;
}

.wpd-directory-search .wpd-submit:hover,
.wpd-directory-search .wpd-submit:focus {
	background: var(--wpd-cta-bg);
	color: var(--wpd-cta-text);
	filter: brightness(1.05);
}

.wpd-directory-search .wpd-submit[disabled] {
	opacity: 0.6;
	cursor: default;
}

.wpd-results-wrap {
	margin-top: 0;
}

.wpd-results-count {
	font-size: 16px;
	color: var(--wpd-text);
	padding: 18px 24px;
	margin: 0;
}

.wpd-results-count strong {
	font-weight: 700;
}

.wpd-results {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.wpd-row {
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 20px 24px;
	background: var(--wpd-panel-bg);
	border: 1px solid var(--e-global-color-lime_green, #9fc93b);
	border-radius: 6px;
	box-sizing: border-box;
}

.wpd-row-body {
	flex: 1 1 auto;
	min-width: 0;
}

.wpd-row-title {
	margin: 0 0 8px;
	color: var(--wpd-text);
}

.wpd-row-line {
	margin: 4px 0;
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--wpd-text);
}

.wpd-row-icon {
	display: inline-flex;
	align-items: center;
	color: var(--wpd-accent-green);
	flex: 0 0 auto;
}

.wpd-row-icon svg {
	display: block;
}

.wpd-row-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.wpd-badge {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	background: #eee;
	color: #444;
	padding: 4px 8px;
	border-radius: 999px;
}

.wpd-badge-organic {
	background: #dff3df;
	color: #256029;
}

.wpd-badge-audit {
	background: #e0edfb;
	color: #1a4c7c;
}

.wpd-row-cta {
	flex: 0 0 auto;
	background: var(--e-global-color-secondary, var(--wpd-cta-bg));
	color: var(--wpd-cta-text);
	border: none !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	text-decoration: none !important;
	font-weight: 700 !important;
	font-size: 14px !important;
	padding: 12px 22px !important;
	margin: 0 !important;
	border-radius: var(--wpd-border-radius) !important;
	white-space: nowrap;
	cursor: pointer;
}

.wpd-row-cta:hover,
.wpd-row-cta:focus {
	background: var(--e-global-color-secondary, var(--wpd-cta-bg));
	color: var(--wpd-cta-text);
	filter: brightness(1.05);
}

.wpd-no-results {
	padding: 24px;
	text-align: center;
	color: #666;
}

@media (max-width: 560px) {
	.wpd-row {
		flex-wrap: wrap;
		padding-left: 24px;
	}
}

.wpd-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	padding: 20px 24px;
}

.wpd-page-btn {
	background: var(--wpd-bar-bg) !important;
	color: var(--wpd-text) !important;
	border: none !important;
	box-shadow: none !important;
	border-radius: var(--wpd-border-radius) !important;
	padding: 8px 14px !important;
	margin: 0 !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	cursor: pointer;
}

.wpd-page-btn.is-active {
	background: var(--wpd-accent-green) !important;
	color: #ffffff !important;
}

.wpd-page-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.wpd-profile {
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid #e2e2e2;
}

.wpd-profile-contact {
	margin-top: 16px;
	padding: 16px;
	background: #f7f7f7;
	border-radius: 8px;
}

@media (max-width: 640px) {
	.wpd-directory-search {
		padding: 22px 18px 20px;
	}

	.wpd-tabs {
		flex-direction: column;
		align-items: stretch;
	}

	.wpd-directory-search .wpd-tab {
		justify-content: flex-start;
	}

	.wpd-search-form {
		flex-direction: column;
		align-items: stretch;
	}

	/*
	 * flex-basis of 220px/260px/160px on these is a WIDTH hint for the desktop row layout.
	 * Once the form stacks into a column above, that same basis is read as a minimum
	 * HEIGHT instead, forcing every field to stretch — hence the huge gaps. Reset to the
	 * field's natural content height in the stacked layout.
	 */
	.wpd-field,
	.wpd-field-primary,
	.wpd-field-radius {
		flex: 0 0 auto;
	}

	.wpd-directory-search .wpd-submit {
		width: 100%;
		margin-top: 4px !important;
	}
}

.wpd-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(22, 50, 79, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 100000;
}

.wpd-modal-overlay[hidden] {
	display: none;
}

.wpd-modal {
	background: #fff;
	border-radius: var(--wpd-border-radius);
	max-width: 640px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 32px;
	position: relative;
}

.wpd-modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: var(--wpd-bar-bg) !important;
	color: var(--wpd-text) !important;
	border: none !important;
	box-shadow: none !important;
	width: 32px;
	height: 32px;
	padding: 0 !important;
	margin: 0 !important;
	border-radius: 50% !important;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.wpd-modal-title {
	margin: 0 0 16px;
	font-size: 22px;
	color: var(--wpd-text);
	padding-right: 30px;
}
