/* =============================================================================
 * Storzen — Sticky Add to Cart
 * Frontend styles. Scoped under .sz-sac-* — no global bleed.
 * ========================================================================== */

.sz-sac {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 99996;
	background: #ffffff;
	color: #1f2937;
	font-family: inherit;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	transition:
		transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		opacity 0.25s,
		visibility 0.25s;
	pointer-events: none;
}

.sz-sac *,
.sz-sac *::before,
.sz-sac *::after { box-sizing: border-box; }

/* ── Position variants ──────────────────────────────────────────────────── */
.sz-sac--bottom {
	bottom: 0;
	transform: translateY(100%);
}

.sz-sac--top {
	top: 0;
	transform: translateY(-100%);
}

/* ── Visible state (toggled by JS on scroll) ────────────────────────────── */
.sz-sac.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

/* ── Animation: fade (skips the slide) ──────────────────────────────────── */
.sz-sac--anim-fade.sz-sac--bottom,
.sz-sac--anim-fade.sz-sac--top { transform: translateY(0); }
.sz-sac--anim-fade             { opacity: 0; }
.sz-sac--anim-fade.is-visible  { opacity: 1; }

/* ── Decoration ─────────────────────────────────────────────────────────── */
.sz-sac--border.sz-sac--bottom { border-top:    1px solid rgba(0, 0, 0, 0.08); }
.sz-sac--border.sz-sac--top    { border-bottom: 1px solid rgba(0, 0, 0, 0.08); }

.sz-sac--shadow.sz-sac--bottom { box-shadow:  0 -4px 18px rgba(0, 0, 0, 0.08); }
.sz-sac--shadow.sz-sac--top    { box-shadow:  0  4px 18px rgba(0, 0, 0, 0.08); }

/* ── Device visibility ──────────────────────────────────────────────────── */
@media (max-width: 768px)  { .sz-sac--hide-mobile  { display: none !important; } }
@media (min-width: 769px)  { .sz-sac--hide-desktop { display: none !important; } }

/* ── Inner layout ───────────────────────────────────────────────────────── */
.sz-sac__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	gap: 14px;
}

/* Thumbnail */
.sz-sac__thumb {
	width: 50px;
	height: 50px;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
	background: rgba(0, 0, 0, 0.04);
}

.sz-sac__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Info column */
.sz-sac__info {
	flex: 1;
	min-width: 0;
}

.sz-sac__title {
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	margin-bottom: 2px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sz-sac__price {
	font-size: 14px;
	font-weight: 700;
	color: #1f2937;
	line-height: 1.2;
}

.sz-sac__price del {
	color: rgba(0, 0, 0, 0.4);
	font-weight: 400;
	font-size: 12px;
	margin-right: 4px;
}

.sz-sac__price ins { text-decoration: none; background: transparent; }

/* Actions row */
.sz-sac__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* Quantity selector */
.sz-sac__qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	overflow: hidden;
	height: 38px;
}

.sz-sac__qty-btn {
	background: transparent;
	border: none;
	width: 28px;
	height: 38px;
	cursor: pointer;
	font-size: 16px;
	color: #1f2937;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
}

.sz-sac__qty-btn:hover { background: rgba(0, 0, 0, 0.05); }

.sz-sac__qty-input {
	width: 40px;
	height: 36px;
	border: none;
	background: transparent;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	-moz-appearance: textfield;
	padding: 0;
}

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

.sz-sac__qty-input:focus { outline: none; }

/* Buttons */
.sz-sac__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 38px;
	padding: 0 18px;
	border: none;
	border-radius: 6px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity 0.15s, transform 0.08s, background 0.15s;
	min-width: 100px;
}

.sz-sac__btn:hover  { opacity: 0.92; }
.sz-sac__btn:active { transform: scale(0.97); }

/* Primary ATC button — Storzen purple */
.sz-sac__btn--atc,
.sz-sac__btn--scroll {
	background: #FF3636;
	color: #ffffff;
}

.sz-sac__btn--atc:hover,
.sz-sac__btn--scroll:hover { background: #E62E2E; opacity: 1; }

/* Buy Now — dark contrast */
.sz-sac__btn--buy {
	background: #1f2937;
	color: #ffffff;
}

.sz-sac__btn--buy:hover { background: #111827; opacity: 1; }

/* Loading state */
.sz-sac__btn.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

.sz-sac__btn.is-loading .sz-sac__btn-label::after {
	content: '';
	display: inline-block;
	width: 11px;
	height: 11px;
	margin-left: 7px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: sz-sac-spin 0.7s linear infinite;
	vertical-align: -2px;
}

.sz-sac__btn.is-success {
	background: #16a34a;
	color: #ffffff;
}

@keyframes sz-sac-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.sz-sac {
		transition: opacity 0.2s, visibility 0.2s;
		transform: none !important;
	}
	.sz-sac__btn { transition: none; }
	.sz-sac__btn.is-loading .sz-sac__btn-label::after { animation: none; }
}

/* ── Inline error toast ─────────────────────────────────────────────────── */
.sz-sac-error {
	position: fixed;
	bottom: 80px;
	right: 20px;
	z-index: 99999;
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
	border-radius: 6px;
	padding: 8px 14px;
	font-size: 13px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* ── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.sz-sac__inner {
		padding: 8px 12px;
		gap: 10px;
	}
	.sz-sac__thumb     { width: 42px; height: 42px; }
	.sz-sac__title     { font-size: 12px; }
	.sz-sac__price     { font-size: 13px; }
	.sz-sac__btn {
		min-width: auto;
		padding: 0 12px;
		font-size: 12px;
		height: 36px;
	}
	.sz-sac__qty       { height: 36px; }
	.sz-sac__qty-btn   { height: 36px; width: 26px; }
	.sz-sac__qty-input { height: 34px; width: 34px; font-size: 12px; }
}

/* Extra-small screens — drop quantity + thumbnail to fit buttons */
@media (max-width: 400px) {
	.sz-sac__qty,
	.sz-sac__thumb { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════
 * Pro features
 * ════════════════════════════════════════════════════════════════════════ */

/* ── Savings badge inline with the price ────────────────────────────────── */
.sz-sac__savings {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #fef3c7;
	color: #92400e;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: 4px;
	margin-inline-start: 6px;
	white-space: nowrap;
	letter-spacing: .2px;
}
.sz-sac__savings .amount { color: #92400e; font-weight: 700; }
.sz-sac__savings-pct {
	background: #92400e;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	padding: 1px 5px;
	border-radius: 3px;
	letter-spacing: .3px;
}

/* ── Countdown chip ─────────────────────────────────────────────────────── */
.sz-sac__countdown {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 3px;
	font-size: 11px;
	font-weight: 500;
	color: #6b7280;
	font-variant-numeric: tabular-nums;
}
.sz-sac__countdown-label {
	text-transform: uppercase;
	letter-spacing: .5px;
	font-size: 10px;
	color: #9ca3af;
}
.sz-sac__countdown-time {
	font-weight: 700;
	color: #1f2937;
	background: #f3f4f6;
	padding: 2px 7px;
	border-radius: 4px;
}
.sz-sac__countdown.is-urgent .sz-sac__countdown-time {
	background: #fee2e2;
	color: #dc2626;
	animation: sz-sac-urgent-pulse 1s ease-in-out infinite;
}
.sz-sac__countdown.is-expired {
	opacity: .5;
}
@keyframes sz-sac-urgent-pulse {
	0%, 100% { transform: scale(1);   }
	50%      { transform: scale(1.04); }
}

/* ── Free-shipping progress bar ─────────────────────────────────────────── */
.sz-sac__ship-progress {
	padding: 8px 18px 10px;
	background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
	border-top: 1px solid rgba(0, 0, 0, .04);
}
.sz-sac__ship-message {
	font-size: 12px;
	color: #4b5563;
	margin-bottom: 6px;
	line-height: 1.3;
}
.sz-sac__ship-text { font-weight: 500; }
.sz-sac__ship-progress.is-reached .sz-sac__ship-text {
	color: #15803d;
	font-weight: 600;
}
.sz-sac__ship-track {
	height: 6px;
	background: #e5e7eb;
	border-radius: 3px;
	overflow: hidden;
}
.sz-sac__ship-fill {
	height: 100%;
	background: linear-gradient(90deg, #FF3636 0%, #FF6B6B 100%);
	transition: width .5s cubic-bezier(.16, 1, .3, 1);
}
.sz-sac__ship-progress.is-reached .sz-sac__ship-fill {
	background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
}

/* ── Recently viewed strip ──────────────────────────────────────────────── */
.sz-sac__recent {
	padding: 6px 18px;
	background: #fafafa;
	border-bottom: 1px solid rgba(0, 0, 0, .04);
}
.sz-sac__recent-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	border: 0;
	color: #6b7280;
	font-size: 11px;
	font-weight: 500;
	padding: 4px 0;
	cursor: pointer;
	letter-spacing: .2px;
}
.sz-sac__recent-toggle:hover { color: #1f2937; }
.sz-sac__recent-toggle:focus-visible {
	outline: 2px solid #FF3636;
	outline-offset: 2px;
	border-radius: 3px;
}
.sz-sac__recent-count { color: #9ca3af; }
.sz-sac__recent-caret { transition: transform .2s ease; font-size: 10px; }
.sz-sac__recent-toggle[aria-expanded="true"] .sz-sac__recent-caret {
	transform: rotate(180deg);
}
.sz-sac__recent-list {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 8px;
	margin: 6px 0 2px;
	padding: 0;
	list-style: none;
	scrollbar-width: thin;
}
.sz-sac__recent-list li { flex: 0 0 auto; }
.sz-sac__recent-list a {
	display: block;
	width: 44px;
	height: 44px;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #e5e7eb;
	transition: border-color .15s ease, transform .15s ease;
}
.sz-sac__recent-list a:hover {
	border-color: #FF3636;
	transform: translateY(-1px);
}
.sz-sac__recent-list img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ── When the bar has Pro pieces stacked on top, tighten the seam ──────── */
.sz-sac--has-recent .sz-sac__inner   { padding-top: 8px; }
.sz-sac--has-countdown .sz-sac__info { gap: 2px; }

/* ── Mobile tweaks for Pro elements ─────────────────────────────────────── */
@media (max-width: 600px) {
	.sz-sac__savings              { font-size: 10px; padding: 1px 5px; }
	.sz-sac__savings-pct          { font-size: 9px;  padding: 1px 4px; }
	.sz-sac__countdown            { font-size: 10px; }
	.sz-sac__countdown-time       { padding: 1px 5px; }
	.sz-sac__ship-progress        { padding: 6px 12px 8px; }
	.sz-sac__ship-message         { font-size: 11px; }
	.sz-sac__recent               { padding: 4px 12px; }
	.sz-sac__recent-list a        { width: 38px; height: 38px; }
}
