/* ===== Hide every native variations row we've taken over. =====
 * Selector is intentionally broad — variations can render inside <table>,
 * <ul>, plain <div>s, or CFVSW's wrapper depending on theme/plugin combo.
 * Hiding by class regardless of parent ensures no native swatches leak
 * through alongside our selektor. */
body.has-by-print-selector .bps-handled-row,
body.has-by-print-selector tr.bps-handled-row,
body.has-by-print-selector .variations_form .bps-handled-row {
	display: none !important;
}

/* ===== Override theme-level button hover that fights our active state =====
 * The site theme has a global `button, .button { &:hover { filter:
 * brightness(.95); transform: scale(1) !important; } }` which dims the
 * active tab/tile on hover so the customer can't tell what's selected.
 * We turn those effects off inside our selector.
 */
.bps-print-selector button.bps-tab,
.bps-print-selector button.bps-tab:hover,
.bps-print-selector button.bps-tab:focus,
.bps-print-selector button.bps-tile,
.bps-print-selector button.bps-tile:hover,
.bps-print-selector button.bps-tile:focus,
.bps-print-selector button.bps-handmade-card,
.bps-print-selector button.bps-handmade-card:hover,
.bps-print-selector button.bps-handmade-card:focus,
.bps-print-selector button.bps-size-guide,
.bps-print-selector button.bps-size-guide:hover,
.bps-print-selector button.bps-size-guide:focus {
	filter: none !important;
	transform: none !important;
}

/* ===== Container ===== */
.bps-print-selector {
	--bps-primary: #000;
	--bps-gray-light: #f4f4f4;
	--bps-gray-border: #ddd;
	--bps-text: #333;
	--bps-radius: 6px;
	--bps-gap: 12px;

	color: var(--bps-text);
	margin: 0 0 24px;
}

.bps-section {
	margin: 0 0 20px;
}

.bps-section[hidden] {
	display: none !important;
}

.bps-section__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 10px;
}

.bps-section__title {
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 1px;
	margin: 0 0 10px;
	color: #555;
}

.bps-section__header .bps-section__title {
	margin: 0;
}

/* ===== Size guide button ===== */
.bps-print-selector .bps-size-guide,
.bps-print-selector button.bps-size-guide {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: #555;
	background: none;
	border: 1px solid var(--bps-gray-border);
	border-radius: 20px;
	padding: 4px 10px;
	cursor: pointer;
	transition: 0.2s;
	white-space: nowrap;
	text-transform: none;
	letter-spacing: 0;
	line-height: 1.2;
	font-weight: 500;
	min-height: 0;
}

.bps-print-selector .bps-size-guide:hover {
	border-color: #999;
	color: #222;
	background: none;
}

.bps-print-selector .bps-size-guide svg { flex-shrink: 0; }

/* ===== Type tabs ===== */
.bps-print-selector .bps-tabs {
	display: flex;
	background: var(--bps-gray-light);
	padding: 4px;
	border-radius: var(--bps-radius);
	gap: 4px;
}

.bps-print-selector .bps-tab,
.bps-print-selector button.bps-tab {
	flex: 1;
	text-align: center;
	padding: 12px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	border: 1px solid transparent;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	transition: 0.2s;
	min-height: 0;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
}

.bps-print-selector .bps-tab.is-active,
.bps-print-selector button.bps-tab.is-active {
	background: #fff;
	color: var(--bps-primary);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
	border-color: var(--bps-gray-border);
}

.bps-print-selector .bps-tab.is-unavailable {
	opacity: 0.4;
	pointer-events: none;
}

/* ===== Type description block ===== */
.bps-type-desc {
	margin-top: 12px;
	padding: 14px 16px;
	background: #fafafa;
	border-left: 3px solid #000;
	border-radius: 0 var(--bps-radius) var(--bps-radius) 0;
	font-size: 13px;
	line-height: 1.6;
	color: #444;
	animation: bpsFadeIn 0.2s ease;
}

@keyframes bpsFadeIn {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ===== Generic grid ===== */
.bps-grid {
	display: grid;
	gap: var(--bps-gap);
}

.bps-grid--sizes {
	grid-template-columns: repeat(3, 1fr);
	padding-top: 8px; /* breathing room for the absolutely-positioned "Popularne" pill */
}

.bps-grid--frames {
	grid-template-columns: repeat(4, 1fr);
}

.bps-grid--extra {
	grid-template-columns: repeat(3, 1fr);
}

/* ===== Tiles ===== */
.bps-print-selector .bps-tile,
.bps-print-selector button.bps-tile {
	border: 1px solid var(--bps-gray-border);
	border-radius: var(--bps-radius);
	cursor: pointer;
	transition: 0.2s;
	background: #fff;
	color: inherit;
	font-family: inherit;
	position: relative;
	overflow: hidden;
	min-height: 0;
	letter-spacing: 0;
	text-transform: none;
}

.bps-print-selector .bps-tile:hover,
.bps-print-selector button.bps-tile:hover {
	border-color: #999;
	background: #fff;
	color: inherit;
}

.bps-print-selector .bps-tile.is-active,
.bps-print-selector button.bps-tile.is-active {
	border-color: var(--bps-primary);
	box-shadow: inset 0 0 0 1px var(--bps-primary);
	background: #fff;
	color: inherit;
}

.bps-print-selector .bps-tile.is-active::after {
	content: '✓';
	position: absolute;
	top: 2px;
	right: 2px;
	background: var(--bps-primary);
	color: #fff;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	font-size: 11px;
	line-height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

/* Per the v2 mockup: HIDE unavailable tiles entirely (frames AND sizes).
 * Greyed-out options just clutter the UI. */
.bps-print-selector .bps-tile--frame.is-unavailable,
.bps-print-selector .bps-tile--size.is-unavailable {
	display: none !important;
}

/* Size tile body */
.bps-tile--size {
	padding: 15px 0;
	text-align: center;
	font-weight: 500;
}

/* Match the specificity of `.bps-print-selector .bps-tile { overflow: hidden }`
 * so this rule actually wins. Without this the "Popularne" pill (top: -7px)
 * gets clipped by the parent button. We also lift overflow:visible up the
 * grid + section ancestors so nothing further out clips it. */
.bps-print-selector .bps-tile--size,
.bps-print-selector button.bps-tile--size {
	overflow: visible;
}
.bps-print-selector .bps-grid--sizes,
.bps-print-selector .bps-section[data-bps-role="size"],
.bps-print-selector form.variations_form,
form.variations_form .bps-print-selector {
	overflow: visible;
}

/* Extra tile body — same look as size tiles. */
.bps-tile--extra {
	padding: 14px 4px;
	text-align: center;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
}

.bps-print-selector .bps-tile--extra.is-unavailable {
	display: none !important;
}

/* Frame tile body */
.bps-tile--frame {
	padding: 0;
	text-align: center;
}

.bps-tile__visual {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 70px;
	background: #f9f9f9;
	overflow: hidden;
}

.bps-tile__visual img {
	max-width: 100%;
	max-height: 100%;
	object-fit: cover;
}

.bps-tile__visual-placeholder {
	display: block;
	width: 50%;
	height: 60%;
	background: #fff;
	border: 1px solid var(--bps-gray-border);
}

.bps-tile__name {
	display: block;
	font-size: 11px;
	padding: 8px 4px 4px;
	line-height: 1.2;
	border-top: 1px solid #f0f0f0;
}

/* ===== Per-frame upcharge label (Sekcja 3) ===== */
.bps-tile__upcharge {
	display: block;
	font-size: 10px;
	text-align: center;
	padding: 0 3px 6px;
	color: #888;
	font-weight: 600;
	letter-spacing: 0.2px;
	line-height: 1.2;
	min-height: 0;
}

.bps-tile__upcharge:empty {
	display: none;
}

.bps-print-selector .bps-tile.is-active .bps-tile__upcharge {
	color: #000;
}

/* ===== "Popularne" pill on size tiles (Sekcja 2) ===== */
.bps-popular-pill {
	position: absolute;
	top: -7px;
	left: 50%;
	transform: translateX(-50%);
	background: #dccebc;
	color: #1a1a1a;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	padding: 2px 7px;
	border-radius: 8px;
	white-space: nowrap;
	pointer-events: none;
	line-height: 1.2;
	z-index: 1;
}

.bps-popular-pill[hidden] {
	display: none !important;
}

/* Push the active-state ✓ checkmark slightly down so it doesn't collide with
 * the "Popularne" pill on the small size tiles. */
.bps-print-selector .bps-tile--size.is-active::after {
	top: 4px;
	right: 4px;
}

/* ===== Handmade card (Sekcja 4) ===== */
.bps-print-selector .bps-handmade-card,
.bps-print-selector button.bps-handmade-card {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	width: 100%;
	border: 1px solid var(--bps-gray-border);
	border-radius: var(--bps-radius);
	padding: 16px;
	cursor: pointer;
	transition: 0.2s;
	background: #fff;
	color: inherit;
	text-align: left;
	font: inherit;
	letter-spacing: 0;
	text-transform: none;
	position: relative;
	overflow: hidden;
}

.bps-print-selector .bps-handmade-card:hover {
	border-color: #999;
	background: #fff;
}

.bps-print-selector .bps-handmade-card.is-active {
	border-color: var(--bps-primary);
	box-shadow: inset 0 0 0 1px var(--bps-primary);
	background: #fafafa;
}

.bps-handmade-badge {
	position: absolute;
	top: 0; right: 0;
	background: #000;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 0 0 0 var(--bps-radius);
}

.bps-handmade-checkbox {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border: 2px solid var(--bps-gray-border);
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: 0.2s;
	margin-top: 2px;
	background: #fff;
}

.bps-handmade-card.is-active .bps-handmade-checkbox {
	background: #000;
	border-color: #000;
}

.bps-handmade-checkbox::after {
	content: '';
	width: 6px;
	height: 10px;
	border-right: 2px solid transparent;
	border-bottom: 2px solid transparent;
	transform: rotate(45deg) translate(-1px, -1px);
}

.bps-handmade-card.is-active .bps-handmade-checkbox::after {
	border-right-color: #fff;
	border-bottom-color: #fff;
}

.bps-handmade-content {
	flex: 1;
	min-width: 0;
}

.bps-handmade-title {
	font-size: 14px;
	font-weight: 700;
	color: #111;
	margin-bottom: 4px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.bps-handmade-icon { font-size: 16px; }

.bps-handmade-desc {
	display: block;
	font-size: 12px;
	color: #666;
	line-height: 1.5;
	margin: 0 0 6px;
}

.bps-handmade-upcharge {
	display: inline-block;
	background: #fff3e0;
	color: #b35900;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 12px;
	letter-spacing: 0.2px;
	line-height: 1.4;
}

.bps-handmade-upcharge:empty {
	display: none;
}

/* ===== Pricing block (Sekcja 5) ===== */
.bps-pricing {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid #eee;
}

.bps-pricing[hidden] {
	display: none !important;
}

.bps-pricing__row {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 6px;
}

.bps-price-regular {
	font-size: 15px;
	color: #999;
	text-decoration: line-through;
	font-weight: 400;
	line-height: 1.2;
}

.bps-price-regular:empty {
	display: none;
}

.bps-price-sale {
	font-size: 26px;
	font-weight: 800;
	color: #000;
	line-height: 1;
	transition: opacity 0.15s ease;
}

.bps-price-sale.is-updating {
	opacity: 0.4;
}

.bps-price-savings {
	display: inline-block;
	background: #dccebc;
	color: #1a1a1a;
	font-size: 12px;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 20px;
	letter-spacing: 0.2px;
	line-height: 1.4;
}

.bps-price-savings[hidden] {
	display: none !important;
}

.bps-price-omnibus {
	font-size: 11px;
	color: #aaa;
	margin-top: 4px;
	line-height: 1.4;
}

.bps-price-omnibus:empty {
	display: none;
}

/* Hide the native WC variation price block — our `.bps-pricing` replaces it
 * (regular/sale/savings/omnibus all in one place, no duplicate). */
body.has-by-print-selector .single_variation_wrap .woocommerce-variation-price {
	display: none !important;
}

/* Hide GreenShift / GSPB Gutenberg price-box widgets that the theme injects
 * into the product summary (renders "Od: X" range pricing + omnibus line).
 * Scoped via :has() to the same `<section>` that contains our selector, so
 * related/cross-sell product chips elsewhere on the page stay visible. */
body.has-by-print-selector section:has(.bps-print-selector) .gspb-pricebox {
	display: none !important;
}

/* ===== Size modal ===== */
.bps-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.bps-modal[hidden] { display: none !important; }

.bps-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.bps-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: 12px;
	max-width: 520px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	animation: bpsModalIn 0.2s ease;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

@keyframes bpsModalIn {
	from { opacity: 0; transform: scale(0.96) translateY(8px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

.bps-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px 16px;
	border-bottom: 1px solid #eee;
}

.bps-modal__title {
	font-size: 16px;
	font-weight: 700;
	color: #111;
}

.bps-modal__close {
	width: 32px;
	height: 32px;
	border: none;
	background: var(--bps-gray-light);
	border-radius: 50%;
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #555;
	transition: 0.2s;
	padding: 0;
	line-height: 1;
}

.bps-modal__close:hover {
	background: #e0e0e0;
	color: #000;
}

.bps-modal__body {
	padding: 24px;
}

.bps-size-guide-image {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 0 20px;
	border-radius: 8px;
}

body.bps-modal-open {
	overflow: hidden;
}

/* ===== Size visualization ===== */
.bps-size-viz {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.bps-size-viz__row {
	display: flex;
	align-items: center;
	gap: 16px;
}

.bps-size-viz__label {
	font-size: 13px;
	font-weight: 600;
	color: #333;
	width: 110px;
	flex-shrink: 0;
}

.bps-size-viz__barwrap {
	flex: 1;
	display: flex;
	align-items: flex-end;
	gap: 4px;
}

.bps-size-viz__rect {
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 3px;
	position: relative;
}

.bps-size-viz__inner {
	position: absolute;
	inset: 4px;
	background: #e8e8e8;
	border-radius: 2px;
}

.bps-size-viz__note {
	font-size: 11px;
	color: #888;
	text-align: right;
	width: 60px;
	flex-shrink: 0;
}

.bps-size-viz__ref {
	font-size: 11px;
	color: #aaa;
	text-align: center;
	margin: 16px 0 0;
	padding-top: 16px;
	border-top: 1px dashed #eee;
}

/* ===== "Dostępne ramki" modal slider ===== */
.bps-frames-slider {
	position: relative;
	margin-bottom: 20px;
}

.bps-frames-track-wrap {
	overflow: hidden;
	border-radius: 8px;
}

.bps-frames-track {
	display: flex;
	transition: transform 0.3s ease;
}

.bps-frame-slide {
	flex: 0 0 100%;
	padding: 0 4px;
	box-sizing: border-box;
	text-align: center;
}

.bps-frame-photo {
	width: 100%;
	aspect-ratio: 4 / 3;
	background: #f0f0f0;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
	overflow: hidden;
}

.bps-frame-photo img {
	max-width: 80%;
	max-height: 80%;
	object-fit: contain;
}

.bps-frame-photo-inner {
	width: 60%;
	height: 70%;
	background: #fff;
	box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.12);
	border: 1px dashed #ccc;
}

.bps-frame-slide-name {
	font-size: 14px;
	font-weight: 700;
	color: #111;
	margin-bottom: 4px;
}

.bps-frame-slide-desc {
	font-size: 12px;
	color: #666;
	line-height: 1.5;
	margin: 0 8px;
}

.bps-frame-slide-desc p {
	margin: 0 0 6px;
}

.bps-frame-slide-desc p:last-child {
	margin-bottom: 0;
}

.bps-frames-nav {
	position: absolute;
	top: 40%;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid #ddd;
	cursor: pointer;
	font-size: 18px;
	font-weight: 700;
	color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	z-index: 2;
	padding: 0;
	line-height: 1;
	transition: background 0.15s;
}

.bps-frames-nav:hover {
	background: #fff;
}

.bps-frames-nav.prev {
	left: 4px;
}

.bps-frames-nav.next {
	right: 4px;
}

.bps-frames-dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 14px;
	flex-wrap: wrap;
}

.bps-frames-dots .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ddd;
	cursor: pointer;
	transition: background 0.15s, transform 0.15s;
	border: none;
	padding: 0;
}

.bps-frames-dots .dot.active {
	background: #000;
	transform: scale(1.2);
}

.bps-frames-availability {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid #eee;
}

.bps-avail-title {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: #555;
	margin: 0 0 12px;
	font-weight: 700;
}

.bps-avail-row {
	display: flex;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px dashed #eee;
	font-size: 13px;
}

.bps-avail-row:last-child {
	border-bottom: none;
}

.bps-avail-type {
	flex: 0 0 110px;
	font-weight: 700;
	color: #111;
}

.bps-avail-list {
	flex: 1;
	color: #555;
	line-height: 1.5;
}

.bps-avail-note {
	font-size: 11px;
	color: #999;
	margin-top: 12px;
	font-style: italic;
}

/* ===== RWD ===== */
/* Per V2 mockup: keep 3-col sizes / 4-col frames at all viewports. */
@media (max-width: 600px) {
	.bps-grid--sizes  { grid-template-columns: repeat(3, 1fr); }
	.bps-grid--frames { grid-template-columns: repeat(4, 1fr); }
	.bps-grid--extra  { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 420px) {
	.bps-grid--sizes  { grid-template-columns: repeat(3, 1fr); gap: 6px; }
	.bps-grid--frames { grid-template-columns: repeat(4, 1fr); gap: 6px; }
	.bps-grid--extra  { grid-template-columns: repeat(2, 1fr); gap: 6px; }
	.bps-tile--size   { padding: 14px 2px; font-size: 13px; }
	.bps-tile--extra  { padding: 12px 2px; font-size: 13px; }
	.bps-tile__visual { height: 50px; }
	.bps-tile__name   { font-size: 9px; padding: 5px 2px 2px; }
	.bps-tile__upcharge { font-size: 9px; padding: 0 2px 5px; }
	.bps-print-selector .bps-tab { font-size: 12px; padding: 10px 4px; }
	.bps-section__title { font-size: 13px; }
	.bps-price-sale { font-size: 22px; }
}
