/* FMBD Balanced Glass Bar — native child theme integration.
 * Approved layout: Add to Cart + price | qty | Buy Now + price
 * Dark frosted glass, equal-width buttons, accent Buy Now.
 */

:root {
	--fmbd-glass-bg: rgba(10, 10, 13, .82);
	--fmbd-glass-edge: rgba(255, 255, 255, .22);
	--fmbd-glass-text: #fff;
	--fmbd-glass-accent: #fff;
	--fmbd-glass-accent-text: #171719;
}

/* Spacer so page content is not hidden under the fixed bar */
.fmbd-glass-spacer {
	height: 82px;
}

/* Dock: full-width fixed container, max-width centered, pointer-events off so
   the backdrop area does not block scroll */
.fmbd-glass-dock {
	position: fixed;
	z-index: 1080; /* above product content, below header (1100) and cart drawer */
	left: max(12px, env(safe-area-inset-left, 0px));
	right: max(12px, env(safe-area-inset-right, 0px));
	bottom: max(12px, env(safe-area-inset-bottom, 0px));
	max-width: 560px;
	margin-inline: auto;
	pointer-events: none;
}

/* Three-column bar: [ATC] [QTY] [BUY] */
.fmbd-glass-bar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 6px;
	padding: 6px;
	min-height: 58px;
	border: 1px solid var(--fmbd-glass-edge);
	border-radius: 20px;
	color: var(--fmbd-glass-text);
	background: linear-gradient(145deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .02) 32%),
	            var(--fmbd-glass-bg);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, .24),
		0 15px 38px rgba(0, 0, 0, .28);
	-webkit-backdrop-filter: blur(20px) saturate(150%);
	backdrop-filter: blur(20px) saturate(150%);
	pointer-events: auto;
}

/* Add to Cart and Buy Now buttons — equal width via 1fr columns */
.fmbd-glass-action {
	appearance: none;
	min-width: 0;
	height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 0 12px;
	border: 0;
	border-radius: 14px;
	cursor: pointer;
	white-space: nowrap;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	transition: transform .18s ease, opacity .18s ease;
}

.fmbd-glass-action:hover { transform: translateY(-1px); }
.fmbd-glass-action:active { transform: scale(.985); }
.fmbd-glass-action:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.fmbd-glass-action:focus-visible {
	outline: 2px solid rgba(255, 255, 255, .7);
	outline-offset: 2px;
}

.fmbd-add-cart {
	color: #fff;
	background: rgba(255, 255, 255, .10);
}

.fmbd-buy-now {
	color: var(--fmbd-glass-accent-text);
	background: var(--fmbd-glass-accent);
	box-shadow: 0 5px 16px rgba(0, 0, 0, .22);
}

/* Button icons */
.fmbd-glass-action svg {
	width: 17px;
	height: 17px;
	flex: 0 0 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Price shown inside button — smaller, slightly dimmed */
.fmbd-bar-price {
	margin-left: 3px;
	opacity: .68;
	font-size: 11px;
}

/* Strip strikethrough from sale price inside bar */
.fmbd-bar-price del { display: none; }
.fmbd-bar-price ins { text-decoration: none; }
.fmbd-bar-price .amount { font-size: inherit !important; color: inherit !important; }

/* Compact centre quantity control */
.fmbd-glass-qty {
	height: 40px;
	display: flex;
	align-items: center;
	border-radius: 13px;
	background: rgba(255, 255, 255, .10);
	overflow: hidden;
	flex: 0 0 auto;
}

.fmbd-glass-qty button {
	appearance: none;
	width: 31px;
	height: 40px;
	padding: 0;
	border: 0;
	color: #fff;
	background: transparent;
	cursor: pointer;
	font-size: 18px;
	font-family: inherit;
	line-height: 1;
	transition: background .15s;
}

.fmbd-glass-qty button:hover { background: rgba(255, 255, 255, .08); }
.fmbd-glass-qty button:disabled { opacity: .35; cursor: default; }
.fmbd-glass-qty button:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: -2px; }

.fmbd-qty-input {
	appearance: textfield;
	-moz-appearance: textfield;
	width: 38px;
	height: 40px;
	padding: 0;
	border: 0 !important;
	outline: 0;
	color: #fff;
	background: transparent;
	box-shadow: none !important;
	text-align: center;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
}

.fmbd-qty-input::-webkit-inner-spin-button,
.fmbd-qty-input::-webkit-outer-spin-button {
	appearance: none;
	margin: 0;
}

/* Status message under the bar */
.fmbd-glass-status {
	min-height: 18px;
	margin: 5px 12px 0;
	color: rgba(255, 255, 255, .84);
	text-align: center;
	font-size: 11px;
	pointer-events: none;
	text-shadow: 0 1px 5px rgba(0, 0, 0, .70);
}

/* Hide WooCommerce's native qty and button — body class set by bar render */
body.single-product form.cart .single_add_to_cart_button,
body.single-product form.cart > .quantity {
	display: none !important;
}

/* --- Mobile adjustments ≤ 520px ------------------------------------------ */
@media (max-width: 520px) {
	.fmbd-glass-dock {
		left: max(7px, env(safe-area-inset-left, 0px));
		right: max(7px, env(safe-area-inset-right, 0px));
		bottom: max(7px, env(safe-area-inset-bottom, 0px));
	}

	.fmbd-glass-bar {
		gap: 4px;
		padding: 5px;
		border-radius: 17px;
		min-height: 54px;
	}

	.fmbd-glass-action {
		height: 43px;
		padding-inline: 8px;
		border-radius: 12px;
		font-size: 12px;
	}

	.fmbd-glass-qty,
	.fmbd-glass-qty button,
	.fmbd-qty-input { height: 36px; }
	.fmbd-glass-qty button { width: 26px; }
	.fmbd-qty-input { width: 20px; }

	/* Price too wide at this breakpoint — hide it */
	.fmbd-bar-price { display: none; }
}

/* --- Chromium/Safari backdrop-filter fallback for unsupported browsers ----- */
@supports not (backdrop-filter: blur(1px)) {
	.fmbd-glass-bar { background: rgba(10, 10, 13, .96); }
}

/* --- Reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.fmbd-glass-action { transition: none; }
}
