/*
 * The two things this plugin adds to the shop pages the owner already built:
 * the location gate and the bottom strip. Nothing here restyles a product card,
 * a filter or anything else ShopEngine draws.
 */

/* Gate ------------------------------------------------------------------- */

.qb-gate {
	position: fixed;
	inset: 0;
	z-index: 99991;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 23, 42, .55);
	backdrop-filter: blur(2px);
}

.qb-gate[hidden] { display: none; }

.qb-gate-card {
	width: 100%;
	max-width: 420px;
	padding: 28px 22px 20px;
	border-radius: 18px;
	background: var(--qb-card);
	box-shadow: var(--qb-shadow-lg);
	text-align: center;
	font-family: var(--qb-font);
	color: var(--qb-ink);
}

.qb-gate-icon { font-size: 34px; }

.qb-gate-card h2 {
	margin: 10px 0 6px;
	font-size: 21px;
	line-height: 1.25;
}

.qb-gate-sub {
	margin: 0 0 18px;
	color: var(--qb-muted);
	font-size: 14px;
}

.qb-gate-card .qb-btn { width: 100%; margin-bottom: 10px; }

.qb-gate-error {
	margin: 4px 0 0;
	padding: 10px 12px;
	border-radius: var(--qb-r-sm);
	background: var(--qb-red-soft);
	color: var(--qb-red);
	font-size: 13px;
	text-align: left;
}

/* "We could not find you" is not a refusal, and showing it in the refusal red
   turns away a customer who lives next door. */
.qb-gate-error.is-note {
	background: var(--qb-amber-soft);
	color: var(--qb-ink);
}

.qb-gate-error[hidden] { display: none; }

.qb-gate-skip,
.qb-gate-skip:hover,
.qb-gate-skip:focus,
.qb-gate-skip:active {
	margin-top: 6px;
	border: 0;
	padding: 0;
	background: none;
	color: var(--qb-muted);
	font: 500 14px var(--qb-font);
	text-decoration: underline;
	cursor: pointer;
}

.qb-gate-skip:hover { color: var(--qb-ink); }

/* Map sheet -------------------------------------------------------------- */

.qb-map-wrap {
	position: relative;
	height: 260px;
	background: #eef2f0;
}

.qb-map { position: absolute; inset: 0; }

/* The pin sits in the middle of the frame and the map moves under it, which is
   far easier on a phone than trying to drag a marker with a thumb. */
.qb-map-pin {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -100%);
	pointer-events: none;
	filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3));
}

/* Drawn, not typed. A pin character has no glyph in some phone font stacks and
   comes out as an empty box right where the customer is told to look. */
.qb-map-pin svg {
	display: block;
	width: 34px;
	height: 34px;
	color: var(--qb-red);
	fill: #fff;
}

.qb-map-locate,
.qb-map-locate:hover,
.qb-map-locate:focus,
.qb-map-locate:active {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	/* Zeroed against the theme's 15px 30px on bare buttons, which turns this
	   round control into a wide oval that overhangs the map corner. */
	padding: 0;
	box-sizing: border-box;
	width: 40px;
	height: 40px;
	border: 1px solid var(--qb-line);
	border-radius: 50%;
	background: #fff;
	color: var(--qb-green-dark);
	cursor: pointer;
	box-shadow: var(--qb-shadow);
}

.qb-map-locate:hover { background: var(--qb-green-soft); }

/* Why the map opened. It sits above the map and stays put while the status
   line underneath keeps changing with the pin. */
.qb-sheet-note {
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.45;
	background: var(--qb-amber-soft);
	color: var(--qb-ink);
	border-bottom: 1px solid var(--qb-line);
}

.qb-map-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 20px;
	text-align: center;
	color: var(--qb-muted);
	font-size: 14px;
}

.qb-map-status {
	padding: 12px 16px;
	font-size: 14px;
	border-bottom: 1px solid var(--qb-line);
	background: var(--qb-green-soft);
	color: var(--qb-green-dark);
}

.qb-map-status.is-bad { background: var(--qb-red-soft); color: var(--qb-red); }
.qb-map-status.is-idle { background: #f9fafb; color: var(--qb-muted); }

/* Bottom strip ----------------------------------------------------------- */

.qb-strip {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99980;
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
	pointer-events: none;
}

.qb-strip[hidden] { display: none; }

.qb-strip-cart,
.qb-strip-live {
	pointer-events: auto;
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 620px;
	margin: 0 auto 8px;
	padding: 12px 14px;
	border-radius: 999px;
	background: var(--qb-green);
	color: #fff;
	text-decoration: none;
	box-shadow: var(--qb-shadow-lg);
	animation: qb-strip-in .18s ease-out;
}

.qb-strip-cart[hidden],
.qb-strip-live[hidden] { display: none; }

/* The list holding 1-3 cloned .qb-strip-live rows - each row keeps the exact
   pill look above, this only needs to disappear along with them. */
.qb-strip-live-list[hidden] { display: none; }

@keyframes qb-strip-in {
	from { transform: translateY(16px); opacity: 0; }
	to { transform: none; opacity: 1; }
}

.qb-strip-cart:hover,
.qb-strip-live:hover { color: #fff; }

.qb-strip-count {
	flex: none;
	min-width: 28px;
	height: 28px;
	padding: 0 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .22);
	font: 700 14px/28px var(--qb-font);
	text-align: center;
}

.qb-strip-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	min-width: 0;
}

.qb-strip-text strong { font-size: 15px; }

.qb-strip-text small {
	font-size: 11.5px;
	opacity: .85;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.qb-strip-cta {
	flex: none;
	font-weight: 700;
	font-size: 14px;
}

.qb-strip-live { background: #0f172a; }

.qb-strip-dot {
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 0 rgba(74, 222, 128, .7);
	animation: qb-pulse 1.8s infinite;
}

@keyframes qb-pulse {
	70% { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); }
	100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.qb-strip-live-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	min-width: 0;
}

.qb-strip-live-text small { font-size: 11.5px; opacity: .8; }

/* The strip covers the end of the page, so give the page room to finish. */
body.qb-has-strip { padding-bottom: 86px; }

/* Item availability, drawn over whatever the page builder rendered --------- */

.qb-sold-out-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #f3f4f6;
	color: var(--qb-muted);
	font-size: 11px;
	font-weight: 700;
	vertical-align: middle;
}

.qb-left-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--qb-amber-soft);
	color: #8a5a10;
	font-size: 11px;
	font-weight: 700;
}

/* "Do we deliver to you?" box -------------------------------------------- */

.qb-check-box {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border: 1px solid var(--qb-line);
	border-radius: var(--qb-r);
	background: var(--qb-card);
	font-family: var(--qb-font);
}

.qb-check-result { width: 100%; margin: 0; font-size: 14px; }
.qb-check-result.is-bad { color: var(--qb-red); }
.qb-check-result.is-good { color: var(--qb-green-dark); }

/* ---------------------------------------------------------------------------
 * The delivery-location chip the script drops into the theme header once a
 * point is set: on a wide screen in the empty right-hand section, on a phone
 * beside the logo. Every state is pinned, because the theme paints and pads
 * any bare button it finds.
 * ------------------------------------------------------------------------ */

.qb-loc-chip,
.qb-loc-chip:hover,
.qb-loc-chip:focus,
.qb-loc-chip:focus-visible,
.qb-loc-chip:active {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 1 auto;
	min-width: 0;
	max-width: 240px;
	/* Set outright: the theme's own rule pads every button 15px 30px, which
	   turns this into a block the width of the header. */
	padding: 5px 11px 5px 9px;
	box-sizing: border-box;
	margin: 0;
	border: 1px solid var(--qb-line);
	border-radius: 999px;
	background: var(--qb-card);
	color: var(--qb-ink);
	font-family: var(--qb-font);
	line-height: 1.15;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.qb-loc-chip:hover,
.qb-loc-chip:focus-visible {
	background: var(--qb-green-soft);
	border-color: #cfe4d6;
	color: var(--qb-green-dark);
}

.qb-loc-chip-ic {
	width: 16px;
	height: 16px;
	flex: none;
	display: block;
	color: var(--qb-green);
}

.qb-loc-chip-body {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.qb-loc-chip-label {
	font-size: 9px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: var(--qb-muted);
}

.qb-loc-chip-val {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.qb-loc-chip-caret {
	width: 14px;
	height: 14px;
	flex: none;
	display: block;
	color: var(--qb-muted);
}

/* Phone: the logo is a wordmark that fills the whole left section, so it is
   held back to leave the chip a readable share of the row. Scoped to the class
   the script adds, so a header without a chip is left exactly as it was. */
@media (max-width: 921px) {
	.qb-loc-chip.is-mob {
		flex: 0 1 auto;
		min-width: 0;
		max-width: 260px;
		gap: 6px;
		padding: 4px 8px 4px 7px;
		margin-left: 10px;
	}

	.qb-loc-chip.is-mob .qb-loc-chip-caret { display: none; }

	/* A flex slot sized by its content cannot also hand its children a
	   percentage width, so the logo's share of the row is stated outright. */
	#masthead .qb-has-loc-chip > .ast-header-html-2,
	#masthead .qb-has-loc-chip > .site-branding,
	#masthead .qb-has-loc-chip > .ast-site-identity {
		flex: 0 0 150px;
		width: 150px;
		max-width: 150px;
	}

	/* Capping the outer slot is not enough: the logo link carries its own
	   width and a negative margin, so it kept its old size and sat on top of
	   the chip. Every box between the slot and the image is pulled back in. */
	#masthead .qb-has-loc-chip > .ast-header-html-2 .ast-header-html,
	#masthead .qb-has-loc-chip > .ast-header-html-2 .ast-builder-html-element,
	#masthead .qb-has-loc-chip > .ast-header-html-2 p,
	#masthead .qb-has-loc-chip > .ast-header-html-2 a,
	#masthead .qb-has-loc-chip > .site-branding a {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	#masthead .qb-has-loc-chip > .ast-header-html-2 img,
	#masthead .qb-has-loc-chip > .site-branding img {
		width: 100%;
		max-width: 100%;
		height: auto;
		display: block;
	}
}

@media (max-width: 400px) {
	#masthead .qb-has-loc-chip > .ast-header-html-2,
	#masthead .qb-has-loc-chip > .site-branding,
	#masthead .qb-has-loc-chip > .ast-site-identity {
		flex: 0 0 130px;
		width: 130px;
		max-width: 130px;
	}
}

/* Satellite toggle --------------------------------------------------------
 *
 * Repeated for every state and with padding pinned, like the locate button
 * beside it: the theme styles bare buttons and would otherwise hand this one
 * 15px 30px of its own padding and its own colour. */

.qb-map-type,
.qb-map-type:hover,
.qb-map-type:focus,
.qb-map-type:active {
	position: absolute;
	left: 12px;
	/* Top, not bottom: Google's own logo sits in the bottom-left of every map
	   and must stay readable, and this button landed straight on it. */
	top: 12px;
	padding: 0 14px;
	box-sizing: border-box;
	height: 34px;
	border: 1px solid var(--qb-line);
	border-radius: 999px;
	background: #fff;
	color: var(--qb-green-dark);
	font-size: 13px;
	font-weight: 700;
	line-height: 32px;
	cursor: pointer;
	box-shadow: var(--qb-shadow);
}

.qb-map-type:hover { background: var(--qb-green-soft); }

.qb-map-hint {
	margin: 0;
	padding: 9px 16px 0;
	font-size: 12.5px;
	color: var(--qb-muted);
}
