/*
 * Deliberately independent from search.css — its own "wpdl-" class prefix and its own
 * :root variables (duplicated values, not shared references) so this widget never depends
 * on the [wpd_search] widget being present on the same page, and editing one can't affect
 * the other.
 *
 * Colors are also exposed as Elementor Style controls (see elementor-listing-widget.php),
 * which inject per-instance overrides using the same selectors — the values below are only
 * the defaults for when nobody has touched those controls yet.
 */
:root {
	--wpdl-text: #16324f;
	--wpdl-tabs-band-bg: #ffffff;
	--wpdl-rows-band-bg: #f2f1ec;
	--wpdl-card-bg: #ffffff;
	--wpdl-card-border: #8fbc3f;
	--wpdl-accent-green: #8fbc3f;
	--wpdl-cta-bg: #ecc94f;
	--wpdl-cta-text: #16324f;
	--wpdl-radius: 8px;
}

.wpdl-listing {
	font-family: inherit;
	width: 100%;
}

.wpdl-tabs-band {
	width: 100%;
	box-sizing: border-box;
	background: var(--wpdl-tabs-band-bg);
	padding: 16px 24px;
}

.wpdl-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	max-width: 1100px;
	margin: 0 auto;
}

.wpdl-tabs-label {
	font-weight: 700;
	color: var(--wpdl-text);
	margin-right: 4px;
}

/*
 * No !important on background/color/border-color here: those are also exposed as Elementor
 * Style controls (elementor-listing-widget.php), and Elementor's generated CSS for them
 * already carries !important with equal-or-higher specificity. Two !important declarations
 * at the same specificity fall back to source order, which isn't reliably "Elementor wins" —
 * so the fix is to only ever have ONE !important source for a given color property.
 */
.wpdl-listing .wpdl-tab {
	background: #fff;
	color: var(--wpdl-text);
	border: 1px solid var(--wpdl-accent-green);
	box-shadow: none !important;
	border-radius: var(--wpdl-radius) !important;
	padding: 8px 16px !important;
	margin: 0 !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	text-transform: none !important;
	cursor: pointer;
	white-space: nowrap;
}

.wpdl-listing .wpdl-tab.is-active {
	background: var(--wpdl-accent-green);
	border-color: var(--wpdl-accent-green);
}

.wpdl-rows-band {
	width: 100%;
	box-sizing: border-box;
	background: var(--wpdl-rows-band-bg);
	padding: 24px;
}

.wpdl-rows {
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-width: 1100px;
	margin: 0 auto;
}

.wpdl-row {
	display: flex;
	align-items: center;
	gap: 24px;
	background: var(--wpdl-card-bg);
	border: 1px solid var(--wpdl-card-border);
	border-radius: var(--wpdl-radius);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	padding: 20px 24px;
	box-sizing: border-box;
}

.wpdl-row[hidden] {
	display: none;
}

.wpdl-thumb {
	flex: 0 0 130px;
	width: 130px;
	height: 130px;
	overflow: hidden;
	border-radius: var(--wpdl-radius);
	background: #f2f2f2;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpdl-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.wpdl-thumb-fallback {
	font-size: 36px;
}

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

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

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

.wpdl-icon {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--wpdl-accent-green);
	margin-top: 3px;
}

.wpdl-icon svg {
	display: block;
}

.wpdl-listing .wpdl-cta {
	flex: 0 0 auto;
	background: var(--wpdl-cta-bg);
	color: var(--wpdl-cta-text);
	border: none !important;
	box-shadow: none !important;
	text-transform: none !important;
	font-weight: 700 !important;
	font-size: 14px !important;
	padding: 12px 22px !important;
	margin: 0 !important;
	border-radius: var(--wpdl-radius) !important;
	white-space: nowrap;
	cursor: pointer;
}

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

.wpdl-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;
}

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

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

.wpdl-modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: #f2f1ec !important;
	color: var(--wpdl-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;
}

/*
 * The modal content comes from wpd_get_producer_detail_html() — shared, generic PHP that
 * also feeds the [wpd_search] widget's modal — so it outputs the same "wpd-profile" /
 * "wpd-badge" class names. These rules only apply inside .wpdl-modal, so this widget looks
 * right even on a page that never loads search.css.
 */
.wpdl-modal .wpd-profile {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

.wpdl-modal .wpd-card-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.wpdl-modal .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;
}

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

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

.wpdl-modal .wpd-profile-contact {
	margin-top: 16px;
	padding: 16px;
	background: #f7f7f7;
	border-radius: var(--wpdl-radius);
}

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