/* Meshek 89 - Delivery Zones (storefront). RTL; colours follow the Agrofood child theme. */

.m89-dz-modal,
.m89-dz-checker,
.m89-dz-combo,
.m89-dz-notice {
	--m89-dz-accent: var(--m89-button-color, #00b412);
	--m89-dz-dark: #133c2c;
	--m89-dz-soft: #e8f5e9;
	--m89-dz-error: #b3261e;
	--m89-dz-error-soft: #fdecea;
	--m89-dz-border: #d3d7c8;
}

.m89-dz-modal[hidden],
.m89-dz-checker [hidden],
.m89-dz-combo [hidden],
.m89-dz-notice[hidden] {
	display: none !important;
}

html.m89-dz-lock,
html.m89-dz-lock body {
	overflow: hidden;
}

/* ---------- Popup ---------- */

/* On short screens the overlay scrolls, not the dialog, so no scrollbar cuts into its rounded corners. */
.m89-dz-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.m89-dz-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(19, 60, 44, 0.55);
}

.m89-dz-dialog {
	position: relative;
	width: 100%;
	max-width: 440px;
	margin: auto; /* centred, and still scrollable from the top when taller than the screen */
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	padding: 32px 24px 20px;
}

.m89-dz-x {
	position: absolute;
	top: 10px;
	left: 10px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #555;
	font-size: 26px;
	line-height: 36px;
	cursor: pointer;
}

.m89-dz-x:hover,
.m89-dz-x:focus-visible {
	background: #f2f2f2;
	color: #000;
}

/* ---------- Checker (popup and [m89_delivery_check]) ---------- */

.m89-dz-checker {
	direction: rtl;
	text-align: right;
	color: #222;
}

.m89-dz-inline {
	max-width: 480px;
	margin: 24px auto;
	padding: 24px;
	border: 1px solid var(--m89-dz-border);
	border-radius: 16px;
	background: #fff;
}

.m89-dz-title {
	margin: 0 0 8px;
	font-size: 22px;
	line-height: 1.3;
	color: var(--m89-dz-dark);
}

.m89-dz-lead {
	margin: 0 0 16px;
	font-size: 16px;
}

.m89-dz-choices {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.m89-dz-choice {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 18px 8px;
	border: 2px solid var(--m89-dz-border);
	border-radius: 12px;
	background: #fff;
	color: var(--m89-dz-dark);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s;
}

.m89-dz-choice:hover,
.m89-dz-choice:focus-visible {
	border-color: var(--m89-dz-accent);
	background: var(--m89-dz-soft);
}

.m89-dz-field {
	margin: 0 0 14px;
}

.m89-dz-field label {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
}

/* Search box: icon at the start, clear button at the end. */
.m89-dz-search {
	position: relative;
}

.m89-dz-checker .m89-dz-combo-input {
	width: 100%;
	min-height: 46px;
	margin: 0;
	padding-block: 10px;
	padding-inline: 42px 40px;
	border: 1px solid var(--m89-dz-border);
	border-radius: 10px;
	background: #fff;
	box-shadow: none;
	box-sizing: border-box;
	font: inherit;
	color: #222;
}

.m89-dz-checker .m89-dz-combo-input:focus {
	border-color: var(--m89-dz-accent);
	outline: 2px solid var(--m89-dz-soft);
	outline-offset: 0;
}

.m89-dz-checker .m89-dz-combo-input[aria-expanded="true"] {
	border-end-start-radius: 0;
	border-end-end-radius: 0;
}

.m89-dz-search-icon {
	position: absolute;
	top: 50%;
	inset-inline-start: 14px;
	transform: translateY(-50%);
	color: #777;
	pointer-events: none;
}

.m89-dz-clear {
	position: absolute;
	top: 50%;
	inset-inline-end: 6px;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #777;
	font-size: 20px;
	line-height: 32px;
	cursor: pointer;
}

.m89-dz-clear:hover,
.m89-dz-clear:focus-visible {
	background: #f2f2f2;
	color: #000;
}

/* Matches, in the page flow right under the box (no floating dropdown). */
.m89-dz-options {
	max-height: 220px;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
	border: 1px solid var(--m89-dz-accent);
	border-top: 0;
	border-end-start-radius: 10px;
	border-end-end-radius: 10px;
	background: #fff;
	scrollbar-width: thin;
}

.m89-dz-option,
.m89-dz-option-empty {
	margin: 0;
	padding: 9px 12px;
	border-radius: 8px;
	list-style: none;
}

.m89-dz-option {
	cursor: pointer;
}

.m89-dz-option:hover,
.m89-dz-option.is-active {
	background: var(--m89-dz-soft);
	color: var(--m89-dz-dark);
}

.m89-dz-option[aria-selected="true"] {
	font-weight: 700;
}

.m89-dz-option-empty {
	color: #777;
}

/* "מגיעים אליכם!" as soon as the address is in the zone. */
.m89-dz-status {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 14px;
	padding: 10px 14px;
	border-radius: 10px;
	background: var(--m89-dz-soft);
	color: var(--m89-dz-dark);
	font-weight: 700;
}

.m89-dz-status::before {
	content: "\2713";
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--m89-dz-accent);
	color: #fff;
	font-size: 14px;
}

.m89-dz-notlisted {
	display: inline-block;
	margin-top: 6px;
	font-size: 13px;
	color: #555;
	text-decoration: underline;
}

.m89-dz-notlisted:hover {
	color: var(--m89-dz-dark);
}

.m89-dz-btn {
	display: block;
	width: 100%;
	min-height: 46px;
	padding: 10px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--m89-dz-accent);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.m89-dz-btn:hover,
.m89-dz-btn:focus-visible {
	filter: brightness(0.92);
}

.m89-dz-btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

.m89-dz-link-btn {
	display: block;
	margin: 12px auto 0;
	padding: 4px 8px;
	border: 0;
	background: none;
	color: #555;
	font: inherit;
	font-size: 14px;
	text-decoration: underline;
	cursor: pointer;
}

.m89-dz-error {
	margin: 0 0 12px;
	color: var(--m89-dz-error);
	font-size: 14px;
}

.m89-dz-result {
	text-align: center;
}

.m89-dz-result-text {
	margin: 12px 0 18px;
	font-size: 17px;
}

.m89-dz-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	font-size: 30px;
	font-weight: 700;
	line-height: 1;
}

.m89-dz-icon-ok {
	background: var(--m89-dz-soft);
	color: var(--m89-dz-accent);
}

.m89-dz-icon-ok::before {
	content: "\2713";
}

.m89-dz-icon-out {
	background: var(--m89-dz-error-soft);
	color: var(--m89-dz-error);
}

.m89-dz-icon-out::before {
	content: "\2715";
}

.m89-dz-footer {
	margin: 16px 0 0;
	text-align: center;
}

.m89-dz-footer .m89-dz-link-btn {
	margin-top: 0;
}

.m89-dz-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* ---------- Checkout / My Account ---------- */

.woocommerce form .form-row .m89-dz-notlisted {
	display: inline-block;
}

/* City / street: the search box stands in for the WooCommerce field, which stays in the form hidden. */
.m89-dz-native {
	display: none !important;
}

/* City and street side by side (form-row-first / -last); whatever follows starts a new line. */
.woocommerce form .m89-dz-street-row + .form-row {
	clear: both;
}

/*
 * The theme lays out billing rows as flex columns pushed to the bottom
 * (justify-content: flex-end). When one of the pair grows (open list or notice),
 * the other would sink; keep both at the top.
 */
.woocommerce form p.form-row.m89-dz-city-row,
.woocommerce form p.form-row.m89-dz-street-row {
	justify-content: flex-start;
}

/*
 * The box looks like the theme's other checkout fields: m89-dz.js copies their
 * border, radius, background, height and padding into these variables.
 */
.woocommerce form .form-row .m89-dz-combo-input {
	width: 100%;
	max-width: 100%;
	height: var(--m89-dz-field-height, auto);
	min-height: 46px;
	margin: 0;
	padding-block: var(--m89-dz-field-pad, 10px);
	padding-inline: 42px 40px;
	border: var(--m89-dz-field-border, 1px solid #d3d7c8);
	border-radius: var(--m89-dz-field-radius, 10px);
	background: var(--m89-dz-field-bg, #fff);
	color: var(--m89-dz-field-color, inherit);
	box-shadow: none;
	box-sizing: border-box;
	font: inherit;
}

.woocommerce form .form-row .m89-dz-combo-input:focus,
.woocommerce form .form-row .m89-dz-combo-input[aria-expanded="true"] {
	border-color: var(--m89-dz-accent);
}

.woocommerce form .form-row .m89-dz-combo-input[aria-expanded="true"] {
	border-end-start-radius: 0;
	border-end-end-radius: 0;
}

.woocommerce form .form-row .m89-dz-options {
	border-end-start-radius: var(--m89-dz-field-radius, 10px);
	border-end-end-radius: var(--m89-dz-field-radius, 10px);
}

.woocommerce form .form-row .m89-dz-combo-input:disabled {
	background: #f6f6f6;
	cursor: not-allowed;
}

.woocommerce form .form-row.woocommerce-invalid .m89-dz-combo-input {
	border-color: var(--wc-red, #a00);
}

.m89-dz-notice {
	margin-top: 10px;
	padding: 12px 14px;
	border: 1px solid #f3c7c3;
	border-radius: 8px;
	background: var(--m89-dz-error-soft);
	color: #5f2120;
}

.m89-dz-notice-text {
	margin: 0 0 8px;
}

.m89-dz-notice .m89-dz-to-pickup {
	margin: 0;
}

/* The checker's notice: its pickup button, smaller than the main buttons. */
.m89-dz-notice .m89-dz-btn-small {
	display: inline-block;
	width: auto;
	min-height: 38px;
	padding: 6px 20px;
	font-size: 14px;
}

.m89-dz-notlisted[aria-expanded="true"] {
	color: var(--m89-dz-dark, #133c2c);
}

@media (max-width: 480px) {
	.m89-dz-dialog {
		padding: 28px 16px 16px;
	}

	.m89-dz-title {
		font-size: 20px;
	}

	.m89-dz-choice {
		padding: 14px 6px;
	}
}
