/**
 * PI Sticky Cart & Fast Checkout — sticky add-to-cart bar.
 * All selectors namespaced with .piscfc-sticky-bar to avoid theme conflicts.
 */

.piscfc-sticky-bar {
	position: fixed;
	left: 0;
	right: 0;
	z-index: var(--piscfc-sb-z, 9998);
	background: var(--piscfc-sb-bg, #ffffff);
	color: var(--piscfc-sb-text, #1a1a1a);
	box-shadow: 0 -2px 16px rgba( 0, 0, 0, 0.12 );
	transform: translateY( 100% );
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
	will-change: transform;
}

.piscfc-sticky-bar--bottom {
	bottom: 0;
}
.piscfc-sticky-bar--top {
	top: 0;
	bottom: auto;
	transform: translateY( -100% );
	box-shadow: 0 2px 16px rgba( 0, 0, 0, 0.12 );
}

.piscfc-sticky-bar.is-visible {
	transform: translateY( 0 );
	opacity: 1;
}

.piscfc-sticky-bar__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	gap: 14px;
}

.piscfc-sticky-bar__media {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
}
.piscfc-sticky-bar__media img {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.piscfc-sticky-bar__info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.piscfc-sticky-bar__name {
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.piscfc-sticky-bar__price {
	font-size: 14px;
	opacity: 0.9;
}
.piscfc-sticky-bar__price del {
	opacity: 0.6;
	margin-right: 6px;
}

.piscfc-sticky-bar__actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
}

.piscfc-sticky-bar__qty {
	display: inline-flex;
	align-items: stretch;
	flex: 0 0 auto;
	width: auto !important;
	max-width: none;
	background: var(--piscfc-sb-qty-bg, #ffffff);
	border: 1px solid var(--piscfc-sb-qty-border, #d1d5db);
	border-radius: var(--piscfc-sb-qty-radius, 8px);
	overflow: hidden;
	box-sizing: border-box;
}
.piscfc-sticky-bar__qty-btn {
	width: 34px !important;
	min-width: 34px !important;
	max-width: 34px !important;
	flex: 0 0 34px;
	height: auto;
	min-height: 0;
	padding: 0 !important;
	border: 0;
	background: transparent;
	color: var(--piscfc-sb-qty-text, #1a1a1a);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-sizing: border-box;
}
.piscfc-sticky-bar__qty-btn:hover {
	background: color-mix( in srgb, var(--piscfc-sb-qty-text, #1a1a1a) 10%, transparent );
}
.piscfc-sticky-bar__qty-input {
	width: 46px !important;
	min-width: 46px !important;
	max-width: 46px !important;
	flex: 0 0 46px;
	min-height: 0;
	padding: 0 !important;
	border: 0;
	border-left: 1px solid var(--piscfc-sb-qty-border, #d1d5db);
	border-right: 1px solid var(--piscfc-sb-qty-border, #d1d5db);
	text-align: center;
	background: transparent;
	color: var(--piscfc-sb-qty-text, #1a1a1a);
	font-size: 15px;
	box-sizing: border-box;
	-moz-appearance: textfield;
}
.piscfc-sticky-bar__qty-input::-webkit-outer-spin-button,
.piscfc-sticky-bar__qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.piscfc-sticky-bar__add {
	border: 0;
	background: var(--piscfc-sb-btn-bg, #081541);
	color: var(--piscfc-sb-btn-text, #ffffff);
	font-size: 15px;
	font-weight: 600;
	padding: 12px 22px;
	border-radius: var(--piscfc-sb-btn-radius, 8px);
	cursor: pointer;
	white-space: nowrap;
	transition: filter 0.15s ease;
}
.piscfc-sticky-bar__add:hover {
	filter: brightness( 0.94 );
}
.piscfc-sticky-bar__add.is-loading {
	opacity: 0.7;
	cursor: progress;
}
.piscfc-sticky-bar__add:focus-visible {
	outline: 2px solid var(--piscfc-sb-btn-bg, #081541);
	outline-offset: 2px;
}

.piscfc-sticky-bar__feedback {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 600;
	color: #15803d;
	opacity: 0;
	transition: opacity 0.2s ease;
}
.piscfc-sticky-bar__feedback:not(:empty) {
	opacity: 1;
}
.piscfc-sticky-bar__feedback.is-error {
	color: #b91c1c;
}

/* Body offset so the fixed bar doesn't cover footer content on small screens. */
@media ( max-width: 600px ) {
	.piscfc-sticky-bar__inner {
		flex-wrap: wrap;
		gap: 8px 10px;
		padding: 8px 12px;
	}
	.piscfc-sticky-bar__media {
		display: none;
	}
	/* Row 1: product name + price take the full width. */
	.piscfc-sticky-bar__info {
		flex: 1 1 100%;
		flex-direction: row;
		align-items: baseline;
		gap: 8px;
	}
	.piscfc-sticky-bar__name {
		font-size: 14px;
		flex: 1 1 auto;
	}
	.piscfc-sticky-bar__price {
		flex: 0 0 auto;
		font-weight: 600;
	}
	/* Row 2: quantity + add button share the width, button grows. */
	.piscfc-sticky-bar__actions {
		flex: 1 1 100%;
		gap: 10px;
	}
	.piscfc-sticky-bar__add {
		flex: 1 1 auto;
		padding: 12px 16px;
		text-align: center;
	}
	.piscfc-sticky-bar__qty {
		flex: 0 0 auto;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.piscfc-sticky-bar {
		transition: none;
	}
}
