/*
 * Bulk Pricing Tiers — front-end styles.
 *
 * Self-contained and theme-agnostic. Every property uses CSS variables with
 * sane defaults so the picker looks reasonable on any theme. Site owners can
 * override the variables in their own stylesheet without touching the plugin.
 */

.bpt-tiers {
	--bpt-accent:        #1a1a1a;
	--bpt-accent-text:   #ffffff;
	--bpt-border:        #e0e0e0;
	--bpt-border-strong: #1a1a1a;
	--bpt-text:          #1a1a1a;
	--bpt-text-muted:    #6b6b6b;
	--bpt-bg:            #ffffff;
	--bpt-bg-hover:      #fafafa;
	--bpt-save-bg:       #e8f5e9;
	--bpt-save-fg:       #2e7d32;
	--bpt-stack-bg:      #f7f6f3;
	--bpt-radius:        6px;
	--bpt-radius-pill:   999px;

	margin: 14px 0;
	font-family: inherit;
	color: var(--bpt-text);
}

/* Standard WC quantity input is hidden on products that use tiers — the
   tier IS the quantity. We sync the underlying `name="quantity"` input via JS. */
body.bpt-active form.cart .quantity { display: none !important; }

.bpt-tiers .bpt-label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bpt-text-muted);
	margin-bottom: 8px;
}

.bpt-tiers .bpt-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
	gap: 8px;
}

.bpt-tiers .bpt-tier {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 8px;
	min-height: 68px;
	background: var(--bpt-bg);
	border: 1px solid var(--bpt-border);
	border-radius: var(--bpt-radius);
	color: var(--bpt-text);
	font: inherit;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
	text-align: center;
}
.bpt-tiers .bpt-tier:hover {
	background: var(--bpt-bg-hover);
	border-color: var(--bpt-border-strong);
}
.bpt-tiers .bpt-tier.is-active {
	background: var(--bpt-accent);
	border-color: var(--bpt-accent);
	color: var(--bpt-accent-text);
}
.bpt-tiers .bpt-tier:focus-visible {
	outline: 2px solid var(--bpt-border-strong);
	outline-offset: 2px;
}

.bpt-tiers .bpt-tier-name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
}

.bpt-tiers .bpt-tier-save {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--bpt-save-fg);
	background: var(--bpt-save-bg);
	padding: 2px 8px;
	border-radius: var(--bpt-radius-pill);
	line-height: 1.5;
	white-space: nowrap;
}
.bpt-tiers .bpt-tier.is-active .bpt-tier-save {
	background: rgba(255, 255, 255, 0.18);
	color: var(--bpt-accent-text);
}

/* Live unit / total / save % line. */
.bpt-tiers .bpt-livesum {
	margin: 14px 0 0;
	font-size: 12px;
	letter-spacing: 0.04em;
	color: var(--bpt-text-muted);
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.bpt-livesum-unit  { color: var(--bpt-text); font-weight: 600; }
.bpt-livesum-total { color: var(--bpt-text-muted); }
.bpt-livesum-sep   { opacity: 0.4; }
.bpt-livesum-save {
	margin-left: auto;
	padding: 2px 8px;
	border-radius: var(--bpt-radius-pill);
	background: var(--bpt-save-bg);
	color: var(--bpt-save-fg);
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.5;
	white-space: nowrap;
}

/* Stack-note explains the catalog discount when one is active. */
.bpt-tiers .bpt-stack-note {
	margin-top: 8px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--bpt-text-muted);
	font-style: italic;
	padding: 8px 12px;
	background: var(--bpt-stack-bg);
	border-left: 2px solid var(--bpt-accent);
	border-radius: 2px;
}

/* ── BOGO promo banner (PDP) ──────────────────────────────────────
   Sits above the add-to-cart form. Self-contained styling with a
   light/dark green palette so it pops on any theme. Override the
   --bpt-bogo-* variables in your theme stylesheet for brand colors. */
.bpt-bogo-banner {
	--bpt-bogo-bg-from: #e8f5e9;
	--bpt-bogo-bg-to:   #c8e6c9;
	--bpt-bogo-accent:  #2e7d32;
	--bpt-bogo-text:    #1b5e20;
	--bpt-bogo-pill-bg: #2e7d32;
	--bpt-bogo-pill-fg: #ffffff;

	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 18px;
	margin: 16px 0;
	background: linear-gradient(135deg, var(--bpt-bogo-bg-from) 0%, var(--bpt-bogo-bg-to) 100%);
	border-left: 4px solid var(--bpt-bogo-accent);
	border-radius: 6px;
	color: var(--bpt-bogo-text);
	font-family: inherit;
	box-shadow: 0 1px 2px rgba(46, 125, 50, 0.08);
	position: relative;
	overflow: hidden;
}

.bpt-bogo-banner::after {
	/* Subtle shimmer so the banner feels alive without being noisy. */
	content: '';
	position: absolute;
	top: -50%;
	right: -20%;
	width: 30%;
	height: 200%;
	background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
	transform: rotate(8deg);
	pointer-events: none;
	animation: bpt-bogo-shine 6s ease-in-out infinite;
}

@keyframes bpt-bogo-shine {
	0%, 100% { transform: translateX(0) rotate(8deg); opacity: 0; }
	40%      { opacity: 0.9; }
	50%      { transform: translateX(-220%) rotate(8deg); opacity: 0.9; }
	60%      { opacity: 0; }
}

.bpt-bogo-banner-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--bpt-bogo-accent);
}

.bpt-bogo-banner-text {
	flex: 1 1 auto;
	min-width: 0;
	position: relative;
	z-index: 1;
}

.bpt-bogo-banner-headline {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.2;
	margin: 0 0 3px;
}

.bpt-bogo-banner-sub {
	font-size: 12.5px;
	line-height: 1.5;
	opacity: 0.85;
}

.bpt-bogo-banner-pill {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--bpt-bogo-pill-bg);
	color: var(--bpt-bogo-pill-fg);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
	position: relative;
	z-index: 1;
}

.bpt-bogo-banner-pill::before {
	/* Pulsing dot to scream "live". */
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 999px;
	background: #b9f6ca;
	box-shadow: 0 0 0 0 rgba(185, 246, 202, 0.7);
	animation: bpt-bogo-pulse 2s ease-out infinite;
}

@keyframes bpt-bogo-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(185, 246, 202, 0.7); }
	70%  { box-shadow: 0 0 0 8px rgba(185, 246, 202, 0); }
	100% { box-shadow: 0 0 0 0 rgba(185, 246, 202, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.bpt-bogo-banner::after,
	.bpt-bogo-banner-pill::before { animation: none; }
	.bpt-bogo-banner::after { opacity: 0; }
}

@media (max-width: 540px) {
	.bpt-bogo-banner { padding: 12px 14px; gap: 10px; }
	.bpt-bogo-banner-pill { display: none; }
	.bpt-bogo-banner-headline { font-size: 14px; letter-spacing: 0.02em; }
	.bpt-bogo-banner-sub { font-size: 12px; }
}

/* ── Tiers-ladder banner ─────────────────────────────────────────
   Slim promo strip used on shop archives, homepages, and PDPs to
   advertise the live volume-discount ladder. Same design DNA as
   the BOGO banner so both can sit next to each other inside the
   .bpt-offer-stack wrapper. */
.bpt-offer-stack {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 16px 0;
}
.bpt-offer-stack:empty { display: none; }
.bpt-offer-stack > * { margin: 0; }

.bpt-tiers-banner {
	--bpt-tiers-bg:     #0a0a0a;
	--bpt-tiers-fg:     #ffffff;
	--bpt-tiers-accent: #ffef5c;

	display: flex;
	align-items: center;
	gap: 20px;
	padding: 14px 18px;
	background: var(--bpt-tiers-bg);
	color: var(--bpt-tiers-fg);
	border-radius: 6px;
	font-family: inherit;
	overflow: hidden;
}

.bpt-tiers-banner-lead {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.bpt-tiers-banner-eyebrow {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--bpt-tiers-accent);
}

.bpt-tiers-banner-headline {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	line-height: 1.15;
}

.bpt-tiers-banner-ladder {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin: 0 0 0 auto;
	padding: 0;
	list-style: none;
}

.bpt-tiers-banner-rung {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	padding: 4px 10px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 999px;
}

.bpt-tiers-banner-qty {
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: var(--bpt-tiers-fg);
}

.bpt-tiers-banner-save {
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bpt-tiers-accent);
	font-weight: 700;
}

@media (max-width: 720px) {
	.bpt-tiers-banner {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		padding: 12px 14px;
	}
	.bpt-tiers-banner-ladder { margin-left: 0; }
	.bpt-tiers-banner-headline { font-size: 14px; }
}
