/* =========================================================================
 * Mobile buy bar — the shared component.
 *
 * One page loads it now: the cart, where it is the checkout shortcut at the end
 * of a long list of items. It used to ride the product page as well, repeating
 * the price and the size picker in a fixed strip over the gallery; that gate is
 * gone (inc/assets.php), and with it the "choose a size" state — the component
 * has one job and one look again.
 *
 * Phones only: every rule is inside one max-width:767px block, and the script
 * that builds the bar bails out above that width as a second guard.
 *
 * The bar is a shortcut to the page's real control, never a second checkout
 * path: its button clicks the WooCommerce control that is already there.
 * ========================================================================= */

@media (max-width: 767px) {

	.mg-buybar {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 95;
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
		background: rgba(255, 255, 255, 0.97);
		backdrop-filter: blur(10px);
		border-top: 1px solid #e9e9e9;
	}

	.mg-buybar[hidden] {
		display: none;
	}

	.mg-buybar__info {
		display: flex;
		flex-direction: column;
		gap: 2px;
		flex: 1 1 auto;
		min-width: 0;
	}

	.mg-buybar__price {
		font-size: 15px;
		font-weight: 600;
		line-height: 1.5;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.mg-buybar__state {
		font-size: 12px;
		line-height: 1.5;
		color: #5f5f5f;
	}

	.mg-buybar__btn {
		flex: 0 0 auto;
		min-height: 48px;
		padding: 0 20px;
		background: #0a0a0a;
		color: #fff;
		border: 1px solid #0a0a0a;
		border-radius: 2px;
		font: inherit;
		font-size: 15px;
		font-weight: 500;
		cursor: pointer;
		white-space: nowrap;
	}

	.mg-buybar__btn:focus-visible {
		outline: 2px solid #0a0a0a;
		outline-offset: 3px;
	}

	/* ---------------------------------------------------------------------
	 * Room for the bar
	 *
	 * Two things move while the bar is on screen: the support toggle (fixed at
	 * bottom-right, it would sit on top of the bar) and the page's bottom
	 * gutter, so nothing at the end of the document is trapped behind either.
	 *
	 * The `html.mg-buybar-on` prefix carries enough specificity to beat the
	 * plugin's own `body` rule regardless of load order.
	 * ------------------------------------------------------------------ */
	html.mg-buybar-on .mgt-support {
		bottom: calc(84px + env(safe-area-inset-bottom, 0px));
	}

	html.mg-buybar-on body {
		padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
	}
}
