/* Header search fix (desktop only): logic only, no visual redesign */
@media (min-width: 1025px) {
	/* Prevent duplicate copy from Elementor sticky spacer */
	.elementor-location-header .elementor-sticky__spacer .dgwt-wcas-search-wrapp {
		display: none !important;
	}

	/* Closed: icon only */
	.elementor-location-header .dgwt-wcas-search-wrapp:not(.dgwt-wcas-layout-icon-open) {
		position: relative !important;
		width: 46px !important;
		max-width: 46px !important;
		min-width: 46px !important;
		overflow: hidden !important;
	}

	.elementor-location-header .dgwt-wcas-search-wrapp:not(.dgwt-wcas-layout-icon-open) .dgwt-wcas-search-form,
	.elementor-location-header .dgwt-wcas-search-wrapp:not(.dgwt-wcas-layout-icon-open) .dgwt-wcas-sf-wrapp {
		width: 46px !important;
		min-width: 46px !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.elementor-location-header .dgwt-wcas-search-wrapp:not(.dgwt-wcas-layout-icon-open) input.dgwt-wcas-search-input,
	.elementor-location-header .dgwt-wcas-search-wrapp:not(.dgwt-wcas-layout-icon-open) button.dgwt-wcas-search-submit {
		display: none !important;
	}

	.elementor-location-header .dgwt-wcas-search-wrapp:not(.dgwt-wcas-layout-icon-open) .dgwt-wcas-search-icon {
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		opacity: 1 !important;
		visibility: visible !important;
	}

	/* Open: keep plugin look, just open below icon */
	.elementor-location-header .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open {
		position: relative !important;
		width: 46px !important;
		max-width: 46px !important;
		min-width: 46px !important;
		overflow: visible !important;
	}

	.elementor-location-header .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon {
		display: none !important;
	}

	.elementor-location-header .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open .dgwt-wcas-search-form {
		position: absolute !important;
		top: calc(100% + 8px) !important;
		left: 0 !important;
		right: auto !important;
		transform: none !important;
		width: min(420px, calc(100vw - 24px)) !important;
		min-width: 280px !important;
		max-width: calc(100vw - 24px) !important;
		z-index: 1200 !important;
	}

	/* Readability on white input background */
	.elementor-location-header .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input.dgwt-wcas-search-input {
		color: #000 !important;
	}

	.elementor-location-header .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input.dgwt-wcas-search-input::placeholder {
		color: #000 !important;
		opacity: 1 !important;
	}
}

/* =========================================================
   Unified Header Color Logic (Elementor)
   Uses section classes:
   - main-header (top section)
   - cat-header  (categories section)
   ========================================================= */

:root {
	/* Match sticky offset of categories row to real top header height */
	--main-header-sticky-height: 113px;
}

.elementor-location-header .main-header,
.elementor-location-header .cat-header {
	transition: background-color 0.35s ease, color 0.35s ease;
}

/* Keep stacking order predictable when both are sticky */
.elementor-location-header .main-header.elementor-sticky--active {
	z-index: 999 !important;
}

.elementor-location-header .cat-header.elementor-sticky--active {
	top: var(--main-header-sticky-height, 113px) !important;
	z-index: 998 !important;
}

/* Home hero overlay: let unified header sit on top of hero image */
body.home .elementor-location-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 1000;
}

body.home.admin-bar .elementor-location-header {
	top: 32px;
}

/* Home: initial transparent for both sections */
body.home:not(.is-scrolled) .elementor-location-header .main-header,
body.home:not(.is-scrolled) .elementor-location-header .cat-header {
	background-color: transparent !important;
}

/* Home on scroll: top black, categories white */
body.home.is-scrolled .elementor-location-header .main-header {
	background-color: #000 !important;
}

body.home.is-scrolled .elementor-location-header .cat-header {
	background-color: #fff !important;
}

/* Inner pages: always top black, categories white */
body:not(.home) .elementor-location-header .main-header,
body:not(.home) .elementor-location-header .main-header.elementor-sticky--effects,
body:not(.home) .elementor-location-header .main-header.elementor-sticky--active {
	background-color: #000 !important;
}

body:not(.home) .elementor-location-header .cat-header,
body:not(.home) .elementor-location-header .cat-header.elementor-sticky--effects,
body:not(.home) .elementor-location-header .cat-header.elementor-sticky--active {
	background-color: #fff !important;
}

/* =========================================================
   Mobile header search cleanup
   - keep only mobile instance visible
   - hide sticky spacer duplicates
   - prevent multiple magnifier icons on open
   ========================================================= */
@media (max-width: 1024px) {
	/* Hard-hide desktop header search instances on mobile */
	.elementor-location-header .elementor-hidden-mobile .dgwt-wcas-search-wrapp,
	.elementor-location-header .elementor-hidden-tablet .dgwt-wcas-search-wrapp {
		display: none !important;
	}

	/* Hide Elementor sticky spacer clones (duplicate icons/forms) */
	.elementor-location-header .elementor-sticky__spacer .dgwt-wcas-search-wrapp {
		display: none !important;
	}

	/* Anchor open form to the mobile header search widget */
	.elementor-location-header .elementor-hidden-desktop .dgwt-wcas-search-wrapp {
		position: relative !important;
	}

	.elementor-location-header .elementor-hidden-desktop .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open {
		overflow: visible !important;
	}

	.elementor-location-header .elementor-hidden-desktop .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open .dgwt-wcas-search-form {
		position: absolute !important;
		top: calc(100% + 8px) !important;
		left: 0 !important;
		transform: none !important;
		width: min(82vw, 320px) !important;
		min-width: 0 !important;
		max-width: calc(100vw - 60px) !important;
		z-index: 1200 !important;
	}

	/* Override legacy mobile rule that forces almost full viewport width */
	html:not(.dgwt-wcas-overlay-mobile-on) .elementor-location-header .elementor-hidden-desktop .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon .dgwt-wcas-search-form {
		min-width: 0 !important;
		width: min(82vw, 320px) !important;
		max-width: calc(100vw - 60px) !important;
	}

	/* Keep only one magnifier when opened */
	.elementor-location-header .elementor-hidden-desktop .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open .dgwt-wcas-search-icon,
	.elementor-location-header .elementor-hidden-desktop .dgwt-wcas-search-wrapp.dgwt-wcas-layout-icon-open button.dgwt-wcas-search-submit {
		display: none !important;
	}
}