/* Unified delivery-address editor.
   The native WooCommerce address controls stay present as the data/validation
   layer. They are hidden only after Maps + Places + Geocoding have all loaded. */

.vso-ds-picker {
	--vso-ds-text: #4a4a4a;
	--vso-ds-muted: #565656;
	--vso-ds-border: #d8d8d8;
	--vso-ds-border-strong: #b9b9b9;
	--vso-ds-focus: #6a4935;
	--vso-ds-soft: #f7f5f3;
	--vso-ds-error: #8a2d20;
	--vso-ds-ok: #1f6337;
	display: none;
	width: 100%;
	box-sizing: border-box;
	margin: 0 0 18px;
	padding: 3px; /* matches WooCommerce's .form-row padding, so the picker
	                 inputs are exactly as wide as the CNP field above */
	border: 0;
	background: transparent;
	color: var(--vso-ds-text);
	font: inherit;
}

html.vso-ds-address-enhanced .vso-ds-picker {
	display: block;
}

/* If Maps/Places/Geocoding fails to load (blocked script, network hiccup,
   a refused key), the enhance() catch path never adds the class above.
   Without this, the picker's own failure message is hidden right along
   with the picker it belongs to -- a customer sees nothing, ever, and we
   never hear about it. Show the status line only; the search box and map
   div are not functional without the libraries that failed to load. */
.vso-ds-picker.vso-ds-picker--failed {
	display: block;
}

.vso-ds-picker--failed .vso-ds-picker__search,
.vso-ds-picker--failed .vso-ds-picker__map {
	display: none;
}

html.vso-ds-address-enhanced .vso-ds-native-address--hidden {
	display: none !important;
}

.vso-ds-picker__search {
	margin: 0;
}

.vso-ds-picker__label {
	display: block;
	margin: 0 0 7px;
	color: var(--vso-ds-text);
	font: inherit;
	font-weight: 600;
	line-height: 1.4;
}

.vso-ds-combobox,
.vso-ds-part {
	position: relative;
	min-width: 0;
}

.vso-ds-combobox input,
.vso-ds-part input {
	display: block;
	width: 100%;
	min-width: 0;
	height: 48px;
	box-sizing: border-box;
	margin: 0 !important;
	padding: 11px 13px !important;
	border: 1px solid var(--vso-ds-border) !important;
	border-radius: 4px !important;
	background: #fff !important;
	box-shadow: none !important;
	color: var(--vso-ds-text) !important;
	font: inherit !important;
	line-height: 1.4 !important;
	outline: none;
}

.vso-ds-combobox--search input {
	padding-left: 44px !important;
}

.vso-ds-combobox__search-icon {
	position: absolute;
	z-index: 4;
	left: 14px;
	top: 50%;
	width: 14px;
	height: 14px;
	box-sizing: border-box;
	border: 2px solid var(--vso-ds-muted);
	border-radius: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}

.vso-ds-combobox__search-icon::after {
	content: "";
	position: absolute;
	left: 10px;
	top: 10px;
	width: 7px;
	height: 2px;
	border-radius: 1px;
	background: var(--vso-ds-muted);
	transform: rotate(45deg);
	transform-origin: left center;
}

.vso-ds-combobox input:hover,
.vso-ds-part input:hover {
	border-color: var(--vso-ds-border-strong) !important;
}

.vso-ds-combobox input:focus,
.vso-ds-part input:focus {
	position: relative;
	z-index: 3;
	border-color: var(--vso-ds-focus) !important;
	box-shadow: 0 0 0 1px var(--vso-ds-focus) !important;
}

/* One address written the way people read it: county, locality, street, no. */
.vso-ds-parts {
	display: grid;
	grid-template-columns: minmax(105px, 1.05fr) minmax(120px, 1.15fr) minmax(170px, 1.7fr) minmax(72px, 0.55fr);
	gap: 0;
	width: 100%;
	margin: 10px 0 0;
}

.vso-ds-part input {
	border-radius: 0 !important;
}

.vso-ds-part:first-child input {
	border-radius: 4px 0 0 4px !important;
}

.vso-ds-part:last-child input {
	border-radius: 0 4px 4px 0 !important;
}

.vso-ds-part + .vso-ds-part input {
	margin-left: -1px !important;
	width: calc(100% + 1px);
}

.vso-ds-part:focus-within {
	z-index: 20; /* above .vso-ds-map-pick's z:5, or the open dropdown
	                paints UNDER the map's floating pick button */
}

.vso-ds-part--county::after,
.vso-ds-part--city::after,
.vso-ds-part--street::after {
	content: "";
	position: absolute;
	z-index: 2;
	right: 12px;
	top: 20px;
	width: 7px;
	height: 7px;
	border-right: 1.5px solid #777;
	border-bottom: 1.5px solid #777;
	transform: rotate(45deg);
	pointer-events: none;
}

.vso-ds-part--county input,
.vso-ds-part--city input,
.vso-ds-part--street input {
	padding-right: 31px !important;
}

.vso-ds-combobox__menu {
	position: absolute;
	z-index: 10050;
	left: 0;
	right: 0;
	top: calc(100% + 5px);
	max-height: 270px;
	min-width: min(280px, 86vw);
	max-width: 86vw;
	overflow: auto;
	box-sizing: border-box;
	padding: 5px;
	border: 1px solid var(--vso-ds-border);
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.vso-ds-combobox__menu--right {
	left: auto;
	right: 0;
	width: min(340px, 80vw);
}

.vso-ds-picker [hidden] {
	display: none !important;
}

.vso-ds-combobox__option {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box;
	margin: 0 !important;
	padding: 12px 10px !important;
	border: 0 !important;
	border-radius: 3px !important;
	background: #fff !important;
	background-image: none !important;
	box-shadow: none !important;
	color: var(--vso-ds-text) !important;
	font: inherit !important;
	line-height: 1.3 !important;
	text-align: left !important;
	text-transform: none !important;
	text-shadow: none !important;
	cursor: pointer;
}

.vso-ds-combobox__option:hover,
.vso-ds-combobox__option:focus,
.vso-ds-combobox__option.is-active {
	background: var(--vso-ds-soft) !important;
	outline: none;
}

.vso-ds-combobox__primary,
.vso-ds-combobox__secondary {
	display: block;
}

.vso-ds-combobox__primary {
	font-weight: 600;
}

.vso-ds-combobox__secondary {
	margin-top: 2px;
	color: var(--vso-ds-muted);
	font-size: 0.86em;
	font-weight: 400;
}

.vso-ds-picker__map {
	width: 100%;
	height: 315px;
	box-sizing: border-box;
	margin: 0;
	border: 1px solid var(--vso-ds-border);
	border-radius: 4px;
	overflow: hidden;
	background: #f2f2f2;
}

.vso-ds-mapwrap {
	position: relative;
	margin: 10px 0 0;
}

.vso-ds-map-pick {
	position: absolute;
	z-index: 5;
	top: 10px;
	left: 10px;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	box-sizing: border-box;
	height: 38px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid var(--vso-ds-border-strong);
	border-radius: 4px;
	background: #fff;
	color: var(--vso-ds-text);
	font: inherit;
	font-size: 0.92em;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.vso-ds-map-pick:hover {
	background: #fff !important;
	border-color: var(--vso-ds-focus);
	color: var(--vso-ds-text) !important;
	opacity: 1 !important;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.26);
}

/* The popup locks the page behind it — wheel/touch on the map must not
   scroll the checkout underneath. */
html.vso-ds-modal-open,
html.vso-ds-modal-open body {
	overflow: hidden !important;
}

.vso-ds-map-pick svg {
	flex: none;
}

.vso-ds-combobox__hint {
	padding: 8px 10px;
	color: var(--vso-ds-muted);
	font-size: 0.86em;
}

.vso-ds-mapmodal {
	position: fixed;
	inset: 0;
	z-index: 100100;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 20px;
}

.vso-ds-mapmodal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(30, 26, 22, 0.55);
}

.vso-ds-mapmodal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(1200px, 96vw);
	height: min(90vh, 860px);
	max-height: 92vh;
	box-sizing: border-box;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
}

.vso-ds-mapmodal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 13px 16px;
	border-bottom: 1px solid var(--vso-ds-border);
	font-weight: 600;
}

.vso-ds-mapmodal__close {
	border: 0;
	margin: 0;
	padding: 0 4px;
	background: none;
	color: var(--vso-ds-muted);
	font: inherit;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.vso-ds-mapmodal__map {
	flex: 1 1 auto;
	min-height: 320px;
}

.vso-ds-mapmodal__status {
	margin: 0;
	padding: 13px 16px;
	border-top: 1px solid var(--vso-ds-border);
	background: var(--vso-ds-soft);
	color: var(--vso-ds-text);
	font-size: 1em;
	font-weight: 600;
	line-height: 1.4;
}

.vso-ds-mapmodal__status:empty {
	display: none;
}

.vso-ds-mapmodal__foot {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	padding: 12px 16px;
	border-top: 1px solid var(--vso-ds-border);
}

.vso-ds-mapmodal__btn {
	height: 42px;
	margin: 0;
	padding: 0 18px;
	border: 1px solid var(--vso-ds-border-strong);
	border-radius: 4px;
	background: #fff;
	color: var(--vso-ds-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.vso-ds-picker__status {
	margin: 8px 0 0;
	padding: 0;
	color: var(--vso-ds-muted);
	font-size: 0.88em;
	line-height: 1.45;
}

.vso-ds-picker__status:empty {
	display: none;
}

.vso-ds-picker__status.is-ok {
	color: var(--vso-ds-ok);
}

.vso-ds-picker__status.is-error {
	color: var(--vso-ds-error);
}

.vso-ds-mapmodal__btn:hover {
	background: var(--vso-ds-soft);
}

.vso-ds-mapmodal__btn--primary {
	border-color: var(--vso-ds-focus);
	background: var(--vso-ds-focus);
	color: #fff;
}

.vso-ds-mapmodal__btn--primary:hover {
	background: #5c3e2d;
}

@media (max-width: 680px) {
	.vso-ds-parts {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	.vso-ds-part + .vso-ds-part input {
		margin-left: 0 !important;
		width: 100%;
	}

	.vso-ds-part input,
	.vso-ds-part:first-child input,
	.vso-ds-part:last-child input {
		border-radius: 4px !important;
	}

	.vso-ds-picker__map {
		height: 290px;
	}
}

@media (max-width: 390px) {
	.vso-ds-parts {
		grid-template-columns: 1fr;
	}
}
