/* Geographic Availability - storefront ZIP entry (header icon + popup). */

/*
 * Header location icon. The circle reuses the theme's .header-icon sizing
 * (38px, 56px from 1400px) and copies .header-search's look, so it sits
 * beside the search icon as one of the set.
 */
.vgeo-header-zip {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #1C1C1C;
	text-decoration: none;
	flex-shrink: 0;
}

.vgeo-header-zip-icon {
	border: 1px solid #E6E6E6;
	background-color: white;
}

.vgeo-header-zip-icon svg path {
	transition: all 0.5s ease 0s;
}

/*
 * The label holds a place name now ("Phoenix, AZ"), not five digits, and those
 * vary a lot in length - "Rancho Santa Margarita, CA" is more than twice the
 * width of "Mesa, AZ". Capping it keeps the search and cart icons where they
 * are whatever the customer enters; the full text is in the link's tooltip.
 */
.vgeo-header-zip-value {
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 12ch;
}

@media (min-width: 1200px) {
	.vgeo-header-zip-value {
		max-width: 18ch;
	}
}

.vgeo-header-zip-value.vgeo-empty {
	font-weight: 500;
	color: #6b6b6b;
}

@media (min-width: 1024px) {
	.vgeo-header-zip:hover .vgeo-header-zip-icon svg path {
		stroke: #06B4FF;
	}

	.vgeo-header-zip:hover .vgeo-header-zip-value {
		color: #06B4FF;
	}
}

/* Mobile header (burger menu, below 1024px): icon only, the place name would
   push the row out of the viewport. It stays in the link's tooltip. */
@media (max-width: 1023px) {
	.vgeo-header-zip {
		gap: 0;
	}

	.vgeo-header-zip-value {
		display: none;
	}
}

/* Phones: tighter icons to make room for the extra location icon. */
@media (max-width: 767px) {
	.header-actions {
		gap: 6px;
	}

	.header-actions .header-icon {
		width: 36px;
		height: 36px;
	}
}

/* Popup. Hidden until opened - by front.js (.vgeo-open), or by the link's fragment without it. */
.vgeo-zip-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000000; /* above the theme's search overlay (99999999) */
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.vgeo-zip-modal.vgeo-open,
.vgeo-zip-modal:target {
	display: flex;
}

html.vgeo-zip-modal-active {
	overflow: hidden;
}

.vgeo-zip-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.4 );
	cursor: default;
}

/* Styled to match the Age Checker popup, which opens this one on "Yes". */
.vgeo-zip-dialog {
	position: relative;
	width: 90%;
	max-width: 600px;
	background: #fff;
	border-radius: 12px;
	padding: 40px 50px;
	box-shadow: 0 8px 32px rgba( 0, 0, 0, 0.25 );
	color: #1a1a1a;
	text-align: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* !important: theme and snippet image rules must not resize the logo. */
.vgeo-zip-modal .vgeo-zip-dialog img.vgeo-zip-modal-logo {
	display: block;
	max-width: 300px !important;
	width: 100% !important;
	height: auto !important;
	margin: 0 auto 20px;
}

/* Required after the age check: nothing to close it but a valid ZIP. */
.vgeo-zip-modal.vgeo-required .vgeo-zip-modal-close {
	display: none;
}

.vgeo-zip-modal.vgeo-required .vgeo-zip-modal-overlay {
	pointer-events: none;
}

.vgeo-zip-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	color: #1C1C1C;
}

.vgeo-zip-modal-close:hover {
	background: #F2F2F2;
}

.vgeo-zip-modal-close svg {
	width: 20px;
	height: 20px;
}

.vgeo-zip-modal-title {
	margin: 0 0 12px;
	font-family: inherit;
	font-size: 40px;
	font-weight: 700;
	line-height: 1.2;
	color: #1a1a1a;
}

/* ZIP form - in the popup, and wherever the [vgeo_zip_selector] shortcode puts it. */
.vgeo-zip-form {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.vgeo-zip-label {
	flex: 1 1 100%;
	font-size: 14px;
	color: #555;
	margin-bottom: 8px;
}

.vgeo-zip-input {
	flex: 1 1 140px;
	min-width: 0;
	height: 46px;
	padding: 0 14px;
	border: 1px solid #D0D0D0;
	border-radius: 8px;
	font-size: 16px; /* 16px keeps iOS from zooming in on focus */
}

.vgeo-zip-input:focus {
	outline: none;
	border-color: #06B4FF;
	box-shadow: 0 0 0 3px rgba( 6, 180, 255, 0.2 );
}

.vgeo-zip-submit {
	height: 46px;
	padding: 0 22px;
	border: 2px solid #06B4FF;
	border-radius: 8px;
	background: #06B4FF;
	color: #fff;
	font-weight: 600;
	text-transform: uppercase;
	cursor: pointer;
	transition: all 0.3s ease 0s;
}

.vgeo-zip-submit:hover {
	background: #fff;
	color: #06B4FF;
}

.vgeo-zip-submit:disabled {
	opacity: 0.6;
	cursor: wait;
}

.vgeo-zip-msg {
	flex: 1 1 100%;
	font-size: 14px;
}

.vgeo-zip-msg:empty {
	display: none;
}

.vgeo-zip-msg.vgeo-error {
	color: #d63638;
}

.vgeo-zip-msg.vgeo-ok {
	color: #008a20;
}

/* The form inside the popup, in the Age Checker's style. Scoped so the
   [vgeo_zip_selector] shortcode keeps its own look. */
.vgeo-zip-modal .vgeo-zip-form {
	flex-direction: column;
	align-items: stretch;
	gap: 12px;
	max-width: 400px;
	margin: 0 auto;
}

.vgeo-zip-modal .vgeo-zip-label {
	font-size: 14px;
	color: #6b6b6b;
	margin-bottom: 12px;
}

.vgeo-zip-modal .vgeo-zip-input {
	flex: 0 0 auto;
	width: 100%;
	height: 46px;
	padding: 0 14px;
	border: 1px solid #E2E2E2;
	border-radius: 4px;
	background: #fff;
	color: #1a1a1a;
	font-family: inherit;
	font-size: 16px;
	text-align: left;
	box-shadow: none;
}

.vgeo-zip-modal .vgeo-zip-input::placeholder {
	color: #BDBDBD;
}

.vgeo-zip-modal .vgeo-zip-input:focus {
	border-color: #06B4FF;
	box-shadow: 0 0 0 3px rgba( 6, 180, 255, 0.15 );
}

.vgeo-zip-modal .vgeo-zip-submit {
	width: 100%;
	height: 46px;
	padding: 0 20px;
	border: 2px solid #06B4FF;
	border-radius: 4px;
	background: #06B4FF;
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	transition: all 0.2s ease;
}

.vgeo-zip-modal .vgeo-zip-submit:hover {
	background: #fff;
	color: #06B4FF;
}

.vgeo-zip-modal .vgeo-zip-msg {
	text-align: center;
}

@media ( max-width: 480px ) {
	.vgeo-zip-dialog {
		width: 100%;
		padding: 32px 20px;
	}

	.vgeo-zip-modal .vgeo-zip-dialog img.vgeo-zip-modal-logo {
		max-width: 220px !important;
	}

	.vgeo-zip-modal-title {
		font-size: 30px;
	}
}

.vgeo-blocked-notice {
	border-left: 4px solid #d63638;
}

/*
 * Blocked cart on the block checkout.
 *
 * With no rates, WooCommerce shows "No shipping options are available for this
 * address. Please verify the address is correct or try a different address."
 * That text is hard-coded in the block bundle and cannot be filtered from PHP.
 * It is also wrong here: the address is fine, the product simply cannot be sold
 * there, and telling the customer to re-type a correct address sends them round
 * in circles. Our own message is rendered just above it, so hide the generic
 * one. The class is toggled by checkout-block.js, because the block checkout
 * enters and leaves this state without a page load.
 */
body.vgeo-blocked .wc-block-components-shipping-rates-control__no-results-notice {
	display: none;
}

/*
 * Full width, to match the step.
 *
 * WooCommerce ships the equivalent rule for its own empty-rates notice:
 *
 *   .wc-block-checkout__shipping-option
 *   .wc-block-components-shipping-rates-control__no-results-notice
 *       { box-sizing: border-box; margin: 0; width: 100% }
 *
 * A notice banner is a flex container with no width of its own, so without
 * that it shrinks to its content and sits at about half the column. Ours is
 * rendered through the notices container rather than as the rates control's
 * placeholder, so it never picked the rule up. align-self covers the case
 * where the notices wrapper is itself a flex parent.
 */
body.vgeo-blocked .wc-block-checkout__shipping-option .wc-block-components-notice-banner {
	box-sizing: border-box;
	width: 100%;
	align-self: stretch;
}

/*
 * [vgeo_available_products] - reuses the theme's category page classes, without
 * the filter sidebar, so the grid takes the full width.
 */
.vgeo-available-products .category-section-body {
	grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
	.vgeo-available-products .category-section-body {
		margin-top: 40px;
	}

	.vgeo-available-products .category-section-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 1200px) {
	.vgeo-available-products .category-section-grid {
		grid-template-columns: repeat(4, 1fr);
		column-gap: 32px;
	}
}

.vgeo-available-empty {
	padding: 40px 16px;
	text-align: center;
	font-size: 18px;
}

.vgeo-available-empty .vgeo-open-zip {
	display: inline-flex;
	margin-top: 12px;
}

/* "Available for pickup at ..." under the Add to cart button. */
.vgeo-pickup-note {
	flex: 1 1 100%;
	width: 100%;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 4px;
	font-size: 15px;
	line-height: 1.3;
	color: #1C1C1C;
}

.vgeo-pickup-note[hidden] {
	display: none;
}

.vgeo-pickup-note-icon {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	color: #06B4FF;
}

/* ---------------------------------------------------------------------------
 * The ZIP gate
 *
 * The server renders every add-to-cart control in its normal, enabled state so
 * that the page is identical for all visitors and safe to cache; front.js then
 * disables the ones this visitor's ZIP forbids. These rules are what that
 * disabled state looks like.
 *
 * Deliberately plain, and scoped to our own classes, so a theme's button
 * styling still shows through and can override any of it.
 * ------------------------------------------------------------------------ */

/* Product page blocked for this ZIP: the form gives way to a one-line reason. */
form.cart.vgeo-gate-blocked {
	display: none !important;
}

.vgeo-gate-msg {
	margin: 24px 0;
	color: #8a8a8a;
	font-size: 16px;
}

.vgeo-gate-disabled,
.vgeo-gate-blocked .single_add_to_cart_button {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}

/* Between asking the server which products are blocked and hearing back.
 * Only ever visible on the first page view for a new ZIP - after that the
 * answer is read from localStorage and applied before the first paint. */
html.vgeo-gate-pending .add_to_cart_button,
html.vgeo-gate-pending .single_add_to_cart_button {
	opacity: 0.6;
	pointer-events: none;
}

/* Product page: keep the flavour selector out of sight until the answer is
   in, so a blocked product never shows it first. Space is kept to avoid a
   jump; front.js clears the pending class after 8s whatever happens. */
html.vgeo-gate-pending .product-section form.cart {
	visibility: hidden;
}
