/**
 * Quick Buy — one stylesheet for all four surfaces (device 028-13).
 *
 * Everything colourable is a custom property printed inline by
 * Woosuite_Quick_Buy::css_declarations(), so the admin live preview and the
 * storefront render from the same values. Selectors stay inside
 * .woosuite-qb* to keep a theme's own cart markup untouched.
 */

.woosuite-qb,
.woosuite-qb-float,
.woosuite-qb-sticky,
.woosuite-qb-qv-btn {
	--woosuite-qb-accent: #1e1e1e;
	--woosuite-qb-accent-text: #ffffff;
	--woosuite-qb-bg: #ffffff;
	--woosuite-qb-text: #1e1e1e;
	--woosuite-qb-muted: #6b7280;
	--woosuite-qb-border: #e5e7eb;
	--woosuite-qb-overlay: rgba( 0, 0, 0, 0.55 );
	--woosuite-qb-radius: 8px;
	--woosuite-qb-modal-w: 460px;
	--woosuite-qb-drawer-w: 380px;
	--woosuite-qb-font: 14px;
}

/* ── shell ─────────────────────────────────────────────────────── */

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

.woosuite-qb {
	position: fixed;
	inset: 0;
	z-index: 999990;
	font-size: var( --woosuite-qb-font );
	line-height: 1.45;
	color: var( --woosuite-qb-text );
}

.woosuite-qb-overlay {
	position: absolute;
	inset: 0;
	background: var( --woosuite-qb-overlay );
	opacity: 0;
	transition: opacity 0.22s ease;
}

.woosuite-qb.is-open .woosuite-qb-overlay { opacity: 1; }

body.woosuite-qb-locked { overflow: hidden; }

.woosuite-qb-panel {
	position: absolute;
	display: flex;
	flex-direction: column;
	max-height: calc( 100% - 32px );
	background: var( --woosuite-qb-bg );
	border-radius: var( --woosuite-qb-radius );
	box-shadow: 0 18px 60px rgba( 0, 0, 0, 0.22 );
	overflow: hidden;
	opacity: 0;
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.woosuite-qb.is-open .woosuite-qb-panel { opacity: 1; transform: none; }

/* popup — centred */
.woosuite-qb-panel[data-mode="popup"][data-popup-position="center"] {
	width: min( var( --woosuite-qb-modal-w ), calc( 100% - 32px ) );
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
}
.woosuite-qb.is-open .woosuite-qb-panel[data-mode="popup"][data-popup-position="center"] {
	transform: translate( -50%, -50% );
}
.woosuite-qb-panel[data-mode="popup"][data-popup-position="center"][data-animation="zoom"] {
	transform: translate( -50%, -50% ) scale( 0.94 );
}
.woosuite-qb-panel[data-mode="popup"][data-popup-position="center"][data-animation="slide"] {
	transform: translate( -50%, calc( -50% + 24px ) );
}

/* popup — toasts */
.woosuite-qb-panel[data-mode="popup"][data-popup-position="top-right"],
.woosuite-qb-panel[data-mode="popup"][data-popup-position="bottom-right"] {
	width: min( var( --woosuite-qb-modal-w ), calc( 100% - 32px ) );
	right: 16px;
	transform: translateX( 16px );
}
.woosuite-qb-panel[data-mode="popup"][data-popup-position="top-right"] { top: 16px; }
.woosuite-qb-panel[data-mode="popup"][data-popup-position="bottom-right"] { bottom: 16px; }

/* drawer */
.woosuite-qb-panel[data-mode="drawer"] {
	top: 0;
	bottom: 0;
	width: min( var( --woosuite-qb-drawer-w ), calc( 100% - 24px ) );
	max-height: 100%;
	border-radius: 0;
}
.woosuite-qb-panel[data-mode="drawer"][data-drawer-position="right"] { right: 0; transform: translateX( 100% ); }
.woosuite-qb-panel[data-mode="drawer"][data-drawer-position="left"] { left: 0; transform: translateX( -100% ); }

/* Open state for every positioned variant.
   The position rules above carry the same specificity as
   `.woosuite-qb.is-open .woosuite-qb-panel` and come later in the file, so
   they would keep their closed transform even while open — the drawer slid
   off-screen and the toasts sat 16px out. These selectors are one class
   heavier, which settles it. */
.woosuite-qb.is-open .woosuite-qb-panel[data-mode="drawer"][data-drawer-position="right"],
.woosuite-qb.is-open .woosuite-qb-panel[data-mode="drawer"][data-drawer-position="left"],
.woosuite-qb.is-open .woosuite-qb-panel[data-mode="popup"][data-popup-position="top-right"],
.woosuite-qb.is-open .woosuite-qb-panel[data-mode="popup"][data-popup-position="bottom-right"] {
	transform: none;
}

/* quick view */
.woosuite-qb-panel[data-mode="quickview"] {
	width: min( 880px, calc( 100% - 32px ) );
	top: 50%;
	left: 50%;
	transform: translate( -50%, -48% );
}
.woosuite-qb.is-open .woosuite-qb-panel[data-mode="quickview"] { transform: translate( -50%, -50% ); }

/* ── chrome ────────────────────────────────────────────────────── */

.woosuite-qb-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var( --woosuite-qb-border );
}

.woosuite-qb-title {
	font-weight: 600;
	font-size: calc( var( --woosuite-qb-font ) + 1px );
}

.woosuite-qb-close {
	all: unset;
	cursor: pointer;
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	font-size: 22px;
	line-height: 1;
	color: var( --woosuite-qb-muted );
	border-radius: var( --woosuite-qb-radius );
}
.woosuite-qb-close:hover { color: var( --woosuite-qb-text ); background: var( --woosuite-qb-border ); }

.woosuite-qb-body {
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	flex: 1 1 auto;
}

.woosuite-qb-panel[data-mode="quickview"] .woosuite-qb-body { padding: 0; }

.woosuite-qb-foot {
	border-top: 1px solid var( --woosuite-qb-border );
	padding: 14px 16px;
	display: grid;
	gap: 8px;
}
.woosuite-qb-foot:empty { display: none; }

/* ── buttons ───────────────────────────────────────────────────── */

.woosuite-qb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 11px 16px;
	border-radius: var( --woosuite-qb-radius );
	font-size: var( --woosuite-qb-font );
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid var( --woosuite-qb-accent );
	background: var( --woosuite-qb-accent );
	color: var( --woosuite-qb-accent-text );
	transition: filter 0.15s ease;
}
.woosuite-qb-btn:hover { filter: brightness( 1.12 ); color: var( --woosuite-qb-accent-text ); }

.woosuite-qb-btn-ghost {
	background: transparent;
	color: var( --woosuite-qb-text );
	border-color: var( --woosuite-qb-border );
}
.woosuite-qb-btn-ghost:hover { color: var( --woosuite-qb-text ); background: var( --woosuite-qb-border ); }

.woosuite-qb-btn[disabled] { opacity: 0.6; cursor: default; }

/* ── added card ────────────────────────────────────────────────── */

.woosuite-qb-added { display: flex; gap: 12px; align-items: flex-start; }
.woosuite-qb-added-thumb { flex: 0 0 72px; }
.woosuite-qb-added-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: var( --woosuite-qb-radius ); display: block; }
.woosuite-qb-added-body { display: grid; gap: 2px; }
.woosuite-qb-added-name { font-weight: 600; }
.woosuite-qb-added-meta,
.woosuite-qb-line-meta { color: var( --woosuite-qb-muted ); font-size: calc( var( --woosuite-qb-font ) - 1px ); }
.woosuite-qb-added-price { display: flex; gap: 8px; align-items: baseline; }
.woosuite-qb-added-qty { color: var( --woosuite-qb-muted ); }

/* ── cart lines ────────────────────────────────────────────────── */

.woosuite-qb-lines { display: grid; gap: 14px; }
.woosuite-qb-lines:not( :first-child ) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var( --woosuite-qb-border ); }

.woosuite-qb-line { display: flex; gap: 12px; align-items: flex-start; position: relative; }
.woosuite-qb-line.is-busy { opacity: 0.5; pointer-events: none; }
.woosuite-qb-line-thumb { flex: 0 0 56px; }
.woosuite-qb-line-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: var( --woosuite-qb-radius ); display: block; }
.woosuite-qb-line-body { flex: 1 1 auto; display: grid; gap: 4px; }
.woosuite-qb-line-name { font-weight: 600; }
.woosuite-qb-line-price { color: var( --woosuite-qb-text ); }
.woosuite-qb-line-qty { color: var( --woosuite-qb-muted ); }

.woosuite-qb-remove {
	all: unset;
	cursor: pointer;
	color: var( --woosuite-qb-muted );
	font-size: 18px;
	line-height: 1;
	padding: 2px 4px;
}
.woosuite-qb-remove:hover { color: var( --woosuite-qb-text ); }

.woosuite-qb-stepper {
	display: inline-flex;
	align-items: center;
	border: 1px solid var( --woosuite-qb-border );
	border-radius: var( --woosuite-qb-radius );
	overflow: hidden;
	width: max-content;
}
.woosuite-qb-step {
	all: unset;
	cursor: pointer;
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	color: var( --woosuite-qb-text );
	font-size: 15px;
}
.woosuite-qb-step:hover { background: var( --woosuite-qb-border ); }
.woosuite-qb-qty {
	width: 42px;
	height: 28px;
	border: 0;
	border-left: 1px solid var( --woosuite-qb-border );
	border-right: 1px solid var( --woosuite-qb-border );
	text-align: center;
	background: transparent;
	color: var( --woosuite-qb-text );
	font-size: calc( var( --woosuite-qb-font ) - 1px );
	border-radius: 0;
	padding: 0;
	-moz-appearance: textfield;
}
.woosuite-qb-qty::-webkit-outer-spin-button,
.woosuite-qb-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── subtotal, shipping bar, empty ─────────────────────────────── */

.woosuite-qb-subtotal {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-weight: 600;
	font-size: calc( var( --woosuite-qb-font ) + 1px );
}

.woosuite-qb-ship { display: grid; gap: 6px; }
.woosuite-qb-ship-text { font-size: calc( var( --woosuite-qb-font ) - 1px ); color: var( --woosuite-qb-muted ); }
.woosuite-qb-ship.is-achieved .woosuite-qb-ship-text { color: var( --woosuite-qb-accent ); font-weight: 600; }
.woosuite-qb-ship-track { height: 6px; border-radius: 999px; background: var( --woosuite-qb-border ); overflow: hidden; }
.woosuite-qb-ship-fill { height: 100%; width: 0; background: var( --woosuite-qb-accent ); transition: width 0.3s ease; }

.woosuite-qb-empty { text-align: center; color: var( --woosuite-qb-muted ); padding: 28px 8px; }

.woosuite-qb-error {
	background: #fdecea;
	color: #8a1c13;
	border-radius: var( --woosuite-qb-radius );
	padding: 10px 12px;
	margin-bottom: 12px;
}

/* ── upsell ────────────────────────────────────────────────────── */

.woosuite-qb-upsell { margin-top: 16px; padding-top: 16px; border-top: 1px solid var( --woosuite-qb-border ); }
.woosuite-qb-upsell-title { display: block; font-weight: 600; margin-bottom: 10px; }
.woosuite-qb-upsell-list { display: grid; grid-template-columns: repeat( 3, minmax( 0, 1fr ) ); gap: 10px; }
.woosuite-qb-upsell-item { display: grid; gap: 4px; text-decoration: none; color: inherit; }
.woosuite-qb-upsell-item img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var( --woosuite-qb-radius ); display: block; }
.woosuite-qb-upsell-name { font-size: calc( var( --woosuite-qb-font ) - 2px ); line-height: 1.3; }
.woosuite-qb-upsell-price { font-size: calc( var( --woosuite-qb-font ) - 2px ); color: var( --woosuite-qb-muted ); }
.woosuite-qb-upsell-price del { opacity: 0.6; }

/* ── quick view ────────────────────────────────────────────────── */

.woosuite-qb-qv { display: grid; grid-template-columns: minmax( 0, 5fr ) minmax( 0, 6fr ); }
.woosuite-qb-qv-media { padding: 16px; background: var( --woosuite-qb-bg ); }
.woosuite-qb-qv-image img { width: 100%; height: auto; border-radius: var( --woosuite-qb-radius ); display: block; }
.woosuite-qb-qv-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.woosuite-qb-qv-thumb { all: unset; cursor: pointer; width: 56px; border-radius: var( --woosuite-qb-radius ); overflow: hidden; border: 1px solid var( --woosuite-qb-border ); }
.woosuite-qb-qv-thumb img { width: 100%; height: auto; display: block; }
.woosuite-qb-qv-body { padding: 16px 18px 20px; border-left: 1px solid var( --woosuite-qb-border ); display: grid; gap: 10px; align-content: start; }
.woosuite-qb-qv-title { margin: 0; font-size: calc( var( --woosuite-qb-font ) + 6px ); line-height: 1.25; }
.woosuite-qb-qv-price { font-size: calc( var( --woosuite-qb-font ) + 3px ); font-weight: 600; }
.woosuite-qb-qv-excerpt { color: var( --woosuite-qb-muted ); }
.woosuite-qb-qv-excerpt p:last-child { margin-bottom: 0; }
.woosuite-qb-qv-meta { display: grid; gap: 2px; font-size: calc( var( --woosuite-qb-font ) - 1px ); color: var( --woosuite-qb-muted ); }
.woosuite-qb-qv-link { font-size: calc( var( --woosuite-qb-font ) - 1px ); }
.woosuite-qb-qv-form .quantity { margin-right: 8px; }

/* Quick View trigger on catalogue cards */
.woocommerce ul.products li.product,
.wc-block-product,
.wp-block-woocommerce-product-image { position: relative; }

.woosuite-qb-qv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	cursor: pointer;
	border: 1px solid var( --woosuite-qb-border );
	background: var( --woosuite-qb-bg );
	color: var( --woosuite-qb-text );
	border-radius: var( --woosuite-qb-radius );
	padding: 7px 12px;
	font-size: calc( var( --woosuite-qb-font ) - 1px );
	font-weight: 600;
	line-height: 1.2;
}
.woosuite-qb-qv-btn:hover { background: var( --woosuite-qb-accent ); color: var( --woosuite-qb-accent-text ); border-color: var( --woosuite-qb-accent ); }
.woosuite-qb-qv-btn--icon { padding: 7px; border-radius: 999px; }

.woosuite-qb-qv-btn--at-image {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	opacity: 0;
	transform: translateY( -4px );
	transition: opacity 0.18s ease, transform 0.18s ease;
}
li.product:hover .woosuite-qb-qv-btn--at-image,
.wc-block-product:hover .woosuite-qb-qv-btn--at-image,
.wp-block-woocommerce-product-image:hover .woosuite-qb-qv-btn--at-image,
.woosuite-qb-qv-btn--at-image:focus-visible { opacity: 1; transform: none; }

/* Touch devices never hover: show it outright rather than hide it forever. */
@media ( hover: none ) {
	.woosuite-qb-qv-btn--at-image { opacity: 1; transform: none; }
}

/* ── floating cart button ──────────────────────────────────────── */

.woosuite-qb-float {
	position: fixed;
	z-index: 999980;
	display: none;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 999px;
	border: 0;
	cursor: pointer;
	background: var( --woosuite-qb-accent );
	color: var( --woosuite-qb-accent-text );
	box-shadow: 0 10px 28px rgba( 0, 0, 0, 0.22 );
}
.woosuite-qb-float.is-visible { display: inline-flex; }
.woosuite-qb-float--bottom-right { right: 20px; bottom: 20px; }
.woosuite-qb-float--bottom-left { left: 20px; bottom: 20px; }
.woosuite-qb-float--middle-right { right: 20px; top: 50%; transform: translateY( -50% ); }
.woosuite-qb-float--middle-left { left: 20px; top: 50%; transform: translateY( -50% ); }

/* The sticky bar and a bottom-anchored floating button both live in the
   bottom-right corner; the button is lifted clear while the bar is up
   (toggled from JS — the bar is rendered after the button, so no sibling
   selector can reach backwards to it). */
.woosuite-qb-float.is-lifted.woosuite-qb-float--bottom-right,
.woosuite-qb-float.is-lifted.woosuite-qb-float--bottom-left { bottom: 92px; }

.woosuite-qb-float-count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: var( --woosuite-qb-bg );
	color: var( --woosuite-qb-text );
	border: 1px solid var( --woosuite-qb-border );
	font-size: 11px;
	font-weight: 700;
	display: grid;
	place-items: center;
}

/* ── sticky bar ────────────────────────────────────────────────── */

.woosuite-qb-sticky {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 999970;
	background: var( --woosuite-qb-bg );
	color: var( --woosuite-qb-text );
	border-top: 1px solid var( --woosuite-qb-border );
	box-shadow: 0 -6px 24px rgba( 0, 0, 0, 0.1 );
	font-size: var( --woosuite-qb-font );
	transform: translateY( 100% );
	transition: transform 0.24s ease;
}
.woosuite-qb-sticky[hidden] { display: none; }
.woosuite-qb-sticky--bottom { bottom: 0; }
.woosuite-qb-sticky--top {
	top: 0;
	bottom: auto;
	border-top: 0;
	border-bottom: 1px solid var( --woosuite-qb-border );
	box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.1 );
	transform: translateY( -100% );
}
.woosuite-qb-sticky.is-visible { transform: none; }

.woosuite-qb-sticky-inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	gap: 14px;
}
.woosuite-qb-sticky-thumb img { width: 46px; height: 46px; object-fit: cover; border-radius: var( --woosuite-qb-radius ); display: block; }
.woosuite-qb-sticky-info { flex: 1 1 auto; display: grid; gap: 2px; min-width: 0; }
.woosuite-qb-sticky-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.woosuite-qb-sticky-price { color: var( --woosuite-qb-muted ); }
.woosuite-qb-sticky-price del { opacity: 0.6; }
.woosuite-qb-sticky-actions { display: flex; align-items: center; gap: 8px; }

/* ── responsive ────────────────────────────────────────────────── */

@media ( max-width: 782px ) {
	/* Every modal becomes a bottom sheet — the one shape that works with
	   a thumb and an on-screen keyboard. */
	.woosuite-qb-panel[data-mode="popup"],
	.woosuite-qb-panel[data-mode="quickview"] {
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		max-height: 86%;
		border-radius: var( --woosuite-qb-radius ) var( --woosuite-qb-radius ) 0 0;
		transform: translateY( 100% );
	}
	.woosuite-qb.is-open .woosuite-qb-panel[data-mode="popup"],
	.woosuite-qb.is-open .woosuite-qb-panel[data-mode="quickview"] { transform: none; }

	.woosuite-qb-qv { grid-template-columns: minmax( 0, 1fr ); }
	.woosuite-qb-qv-body { border-left: 0; border-top: 1px solid var( --woosuite-qb-border ); }
	.woosuite-qb-upsell-list { grid-template-columns: repeat( 3, minmax( 0, 1fr ) ); }
	.woosuite-qb-sticky--desktop { display: none !important; }
	.woosuite-qb-sticky-thumb { display: none; }
	.woosuite-qb-sticky-inner { padding: 8px 12px; gap: 10px; }
}

@media ( prefers-reduced-motion: reduce ) {
	.woosuite-qb-overlay,
	.woosuite-qb-panel,
	.woosuite-qb-sticky,
	.woosuite-qb-ship-fill { transition: none; }
}
