/*
 * Sticky add-to-quote bar (single product).
 *
 * The controls inside come from latelier_quote_controls(), the same builder as
 * the inline button, so most of their styling is inherited from style.css. What
 * is left here is the bar itself plus the handful of overrides needed to fit
 * those controls on one line, since the inline layout stacks them vertically.
 */

.sticky-quote-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 90;
	background: var(--wp--preset--color--blanc, #fff);
	border-top: 1px solid rgba(32, 33, 100, 0.12);
	box-shadow: 0 -4px 24px rgba(32, 33, 100, 0.1);
	padding: 12px 20px;
	padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));

	/* Hidden by default: visibility (rather than opacity) also takes the
	   controls out of the tab order while the bar is down. */
	visibility: hidden;
	transform: translateY(100%);
	transition: transform 0.28s ease, visibility 0s linear 0.28s;
}

.sticky-quote-bar.is-visible {
	visibility: visible;
	transform: translateY(0);
	transition: transform 0.28s ease, visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
	.sticky-quote-bar,
	.sticky-quote-bar.is-visible {
		transition: none;
	}
}

.sticky-quote-bar__inner {
	max-width: var(--wp--style--global--wide-size, 1100px);
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.sticky-quote-bar__product {
	display: flex;
	flex-direction: column;
	min-width: 0; /* lets the title ellipsis instead of pushing the button out */
}

.sticky-quote-bar__title {
	font-family: var(--wp--preset--font-family--lato);
	font-size: var(--M, 18px);
	font-weight: 700;
	color: var(--wp--preset--color--primary, #202164);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sticky-quote-bar__code {
	font-family: var(--wp--preset--font-family--lato);
	font-size: var(--S, 14px);
	font-weight: 300;
	color: var(--wp--preset--color--primary, #202164);
	opacity: 0.7;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* style.css lays the inline controls out as a column with a top margin, which
   suits a page section but not a bar: put them back on one line. */
.sticky-quote-bar .quote-system-ui {
	flex: 0 0 auto;
	flex-direction: row;
	align-items: center;
	gap: 12px;
	margin-top: 0;
}

.sticky-quote-bar .quote-feedback {
	margin-left: 0;
	white-space: nowrap;
}

@media (max-width: 768px) {
	.sticky-quote-bar {
		padding: 10px 16px;
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	}

	.sticky-quote-bar__inner {
		gap: 12px;
	}

	/* The product code is already in the page above; drop it before the title
	   starts competing with the button for room. */
	.sticky-quote-bar__code {
		display: none;
	}

	.sticky-quote-bar__title {
		font-size: var(--S, 14px);
	}

	/* style.css stacks these two under 768px, which would make the bar tall
	   enough to eat the screen. Keep the row and tighten it instead. */
	.sticky-quote-bar .content-btn-add-devis-flex {
		flex-direction: row !important;
		align-items: center !important;
		gap: 8px;
	}

	.sticky-quote-bar .quantity-selector {
		padding: 6px 12px;
	}

	.sticky-quote-bar .btn-add-quote {
		padding: 8px 18px !important;
		font-size: var(--S, 14px) !important;
		white-space: nowrap;
	}

	/* Feedback would push the row out of the bar on a narrow screen: float it
	   just above instead. */
	.sticky-quote-bar .quote-feedback:not(:empty) {
		position: absolute;
		top: -28px;
		right: 16px;
		background: var(--wp--preset--color--blanc, #fff);
		border-radius: 100px;
		padding: 4px 12px;
		box-shadow: 0 2px 10px rgba(32, 33, 100, 0.15);
	}
}

/* Very narrow screens: the title is the first thing that can go. */
@media (max-width: 480px) {
	.sticky-quote-bar__product {
		display: none;
	}

	.sticky-quote-bar__inner {
		justify-content: center;
	}
}
