/* Moduł: Proponowane produkty — sekcja na stronie produktu.
 * Karty renderuje motyw (molecules/product-card); tu tylko rama sekcji
 * oraz siatka dla fallbacku, gdy motyw nie udostępnia komponentu. */

.wce-suggested {
	margin: 1.5rem 0 2rem;
}

.wce-suggested__title {
	font-size: 1.25rem;
	line-height: 1.3;
	margin: 0 0 1rem;
}

.wce-suggested__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1rem;
	align-items: stretch;
}

/* --- Fallback card (używana tylko bez komponentu motywu) --- */
.wce-suggested__card {
	display: flex;
	flex-direction: column;
	gap: .5rem;
	padding: .75rem;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	background: #fff;
}

.wce-suggested__media {
	display: block;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border-radius: 8px;
}

.wce-suggested__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.wce-suggested__name {
	font-weight: 600;
	font-size: .95rem;
	line-height: 1.3;
	color: inherit;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wce-suggested__name:hover {
	text-decoration: underline;
}

.wce-suggested__price {
	font-weight: 700;
	margin-top: auto;
}

.wce-suggested__card .button {
	width: 100%;
	text-align: center;
}

@media (max-width: 480px) {
	.wce-suggested__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ============================================================
 *  „Często kupowane razem" — bundle
 * ========================================================== */

/* Separatory nad i pod sekcją */
.wce-fbt-sep {
	border: 0;
	border-top: 1px solid #e6e6e6;
	margin: 0;
	height: 0;
}

.wce-fbt {
	margin: 1.5rem 0;
}

.wce-fbt__title {
	font-size: 1.35rem;
	line-height: 1.2;
	font-weight: 700;
	margin: 0 0 1.1rem;
}

.wce-fbt__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 1.25rem;
}

/* Rząd produktów z plusami */
.wce-fbt__items {
	display: flex;
	align-items: stretch;
	gap: .5rem;
	flex: 1 1 60%;
	min-width: 0;
	flex-wrap: wrap;
}

.wce-fbt__item {
	position: relative;
	flex: 1 1 0;
	min-width: 160px;
	max-width: 260px;
}

.wce-fbt__item.is-unavailable {
	opacity: .7;
}

/* Oznaczenie bieżącego produktu — nakładka po lewej, w jednej linii z checkboxem */
.wce-fbt__thisitem {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 4;
	height: 28px;
	display: inline-flex;
	align-items: center;
	font-size: .68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: #fff;
	background: #2563eb;
	border-radius: 6px;
	padding: 0 10px;
	white-space: nowrap;
	box-shadow: 0 1px 3px rgba(16, 24, 40, .18);
}

/* Plus między produktami */
.wce-fbt__plus {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.8rem;
	line-height: 1;
	color: #98a2b3;
	font-weight: 300;
	flex: 0 0 auto;
	padding: 0 .1rem;
	/* wyrównaj do środka miniatury (górna część karty) */
	align-self: flex-start;
	height: clamp(180px, 22vw, 300px);
}

/* W sekcji bundle chowamy serduszko z karty motywu */
.wce-fbt .product-card__wishlist {
	display: none !important;
}

/* Checkbox w miejscu serduszka */
.wce-fbt__check {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 4;
	width: 28px;
	height: 28px;
	cursor: pointer;
	margin: 0;
}

.wce-fbt__check.is-disabled {
	cursor: not-allowed;
}

.wce-fbt__check input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: inherit;
}

.wce-fbt__box {
	display: block;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	background: #fff;
	border: 2px solid #cbd5e1;
	box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
	transition: background .12s, border-color .12s;
	position: relative;
}

.wce-fbt__check input:checked + .wce-fbt__box {
	background: #2563eb;
	border-color: #2563eb;
}

.wce-fbt__check input:checked + .wce-fbt__box::after {
	content: "";
	position: absolute;
	left: 9px;
	top: 4px;
	width: 6px;
	height: 12px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.wce-fbt__check input:focus-visible + .wce-fbt__box {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

.wce-fbt__check.is-disabled .wce-fbt__box {
	background: #f1f5f9;
	border-color: #e2e8f0;
}

/* Panel podsumowania */
.wce-fbt__summary {
	flex: 1 1 230px;
	max-width: 300px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: .75rem;
	padding: 1.1rem 1.25rem;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	align-self: flex-start;
}

.wce-fbt__total {
	font-size: 1.05rem;
}

.wce-fbt__total-label {
	color: #475467;
}

.wce-fbt__total-value {
	font-weight: 700;
	font-size: 1.35rem;
	white-space: nowrap;
}

.wce-fbt__add {
	width: 100%;
	text-align: center;
	cursor: pointer;
}

.wce-fbt__add[disabled] {
	opacity: .55;
	cursor: not-allowed;
}

.wce-fbt__note {
	margin: 0;
	font-size: .9rem;
}

.wce-fbt__note.is-ok {
	color: #067647;
}

.wce-fbt__note.is-error {
	color: #b42318;
}

@media (max-width: 782px) {
	.wce-fbt__inner {
		flex-direction: column;
	}
	.wce-fbt__summary {
		max-width: none;
		width: 100%;
	}
}


/* ============================================================
 *  Mobile FBT (≤767.98px) — slider miniatur.
 *  Cele: bez ramki; jedna linia z poziomym scrollem (ostatnia miniatura
 *  może być przycięta, ale scroll pokazuje resztę); NIC nie wychodzi poza
 *  viewport (button ani sekcja nie rozpychają strony w poziomie);
 *  zdjęcia +50%; biała przestrzeń nad/pod sekcją −50%.
 *  Klucz do braku poziomego scrolla strony: min-width:0 w całym łańcuchu
 *  flex (bez tego nowrap-owy rząd miniatur rozpycha rodziców = flexbox
 *  min-width:auto). Scope .wce-fbt--mobile podbija specyficzność nad motyw.
 * ========================================================== */
@media (max-width: 767.98px) {
	/* Sekcja nie może być źródłem poziomego scrolla strony */
	.wce-fbt--mobile {
		overflow-x: clip;
		margin-block: .75rem;          /* było 1.5rem — połowa własnego marginesu sekcji */
	}
	.wce-fbt--mobile,
	.wce-fbt--mobile .wce-fbt__inner,
	.wce-fbt--mobile .wce-fbt__collapsed {
		min-width: 0;                  /* pozwól zejść poniżej szerokości treści */
		max-width: 100%;
	}

	/* Zwinięty box — bez ramki */
	.wce-fbt--mobile .wce-fbt__collapsed {
		position: relative;
		border: 0;
		padding: 0;
		gap: .75rem;
		overflow: hidden;              /* zapas: nic nie wystaje z boxu */
	}

	/* Miniatury: jedna linia, poziomy scroll TYLKO tutaj */
	.wce-fbt--mobile .wce-fbt__thumbs {
		min-width: 0;
		max-width: 100%;
		margin: 0;
		justify-content: flex-start;
		flex-wrap: nowrap;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		padding-right: 2.25rem;        /* miejsce pod strzałkę */
	}
	.wce-fbt--mobile .wce-fbt__thumbs::-webkit-scrollbar { display: none; }

	/* Zdjęcia +50% (72 → 108px); obraz w środku, bez zniekształceń */
	.wce-fbt--mobile .wce-fbt__thumb {
		width: 108px;
		height: 108px;
		flex: 0 0 auto;
		scroll-snap-align: start;
	}
	.wce-fbt--mobile .wce-fbt__thumb img {
		max-width: 100%;
		max-height: 100%;
		object-fit: contain;
	}

	/* CTA nigdy nie wychodzi poza szerokość viewportu */
	.wce-fbt--mobile .wce-fbt__cta {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		white-space: normal;
	}

	/* Strzałka do przewijania slidera */
	.wce-fbt--mobile .wce-fbt__thumbs-arrow {
		position: absolute;
		top: 54px;                     /* środek miniatury 108px */
		right: 0;
		transform: translateY(-50%);
		z-index: 2;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 34px;
		height: 34px;
		padding: 0;
		border: 0;
		border-radius: 999px;
		background: #fff;
		box-shadow: 0 1px 6px rgba(16, 24, 40, .18);
		color: #101828;
		cursor: pointer;
	}
	.wce-fbt--mobile .wce-fbt__thumbs-arrow[hidden] { display: none; }
	.wce-fbt--mobile .wce-fbt__thumbs-arrow svg { width: 18px; height: 18px; }

	/* Biała przestrzeń nad/pod sekcją −50%
	   (kompensata flex-gap 80px w .product-sections wokół kresek FBT) */
	.product-sections .wce-fbt-sep--top {
		margin-top: calc(-1 * var(--space-40, 40px));
		margin-bottom: calc(-1 * var(--space-40, 40px));
	}
	.product-sections .wce-fbt-sep--bottom {
		margin-top: calc(-1 * var(--space-40, 40px));
	}
}

/* ============================================================
 *  Mobile FBT — miniatury BEZ ścinania (nadpisuje reguły powyżej).
 *  Portretowa komórka pod okładki + wymuszony object-fit:contain,
 *  by cały obrazek był widoczny (bez pionowego przycięcia).
 * ========================================================== */
@media (max-width: 767.98px) {
	.wce-fbt--mobile .wce-fbt__thumb {
		width: 108px;
		height: 144px;                 /* portret ~3:4 pod okładki książek */
		overflow: visible;
	}
	.wce-fbt--mobile .wce-fbt__thumb img {
		width: 100% !important;
		height: 100% !important;
		object-fit: contain !important;   /* cały obrazek w kadrze, nic nie ścięte */
		object-position: center !important;
	}
	/* strzałka wyśrodkowana na wyższej miniaturze (144px) */
	.wce-fbt--mobile .wce-fbt__thumbs-arrow { top: 72px; }
}

/* ============================================================
 *  Mobile FBT — dwie strzałki: prawa (right) i lewa (left).
 * ========================================================== */
@media (max-width: 767.98px) {
	.wce-fbt--mobile .wce-fbt__thumbs-arrow--next { right: 0; left: auto; }
	.wce-fbt--mobile .wce-fbt__thumbs-arrow--prev { left: 0; right: auto; }
	.wce-fbt--mobile .wce-fbt__thumbs-arrow--prev svg { transform: rotate(180deg); }
	/* zapas miejsca również z lewej, gdy lewa strzałka jest widoczna */
	.wce-fbt--mobile .wce-fbt__thumbs { padding-left: 0; }
}

/* ============================================================
 *  mcx-fbt-expanded-320: karty w widoku ROZWINIĘTYM jak w kategorii.
 *  Problem: bazowe .wce-fbt__item ma min-width:160px → 2 karty + gap
 *  > 320px = overflow (sekcja „nie radzi sobie" przy ~320px).
 *  Kategoria (.shop__grid) mieści 2 karty obok siebie na każdej
 *  szerokości, bo używa repeat(2, minmax(0,1fr)) i karty NIE mają
 *  min-width (mogą zejść poniżej treści). Tu robimy dokładnie to samo
 *  dla rozwiniętego FBT na mobile. Zwinięty slider + CTA bez zmian.
 * ========================================================== */
@media (max-width: 767.98px) {
	.wce-fbt--mobile.is-expanded .wce-fbt__items {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));  /* jak .shop__grid */
		gap: 1rem 0.5rem;                                   /* 16px / 8px — jak kategoria */
	}
	.wce-fbt--mobile.is-expanded .wce-fbt__item {
		min-width: 0;    /* KLUCZ: karta może zejść <160px, więc mieści się parami */
		max-width: none;
		flex: none;
		margin: 0;
	}
	/* Bieżący produkt („TEN PRODUKT") pełna szerokość, reszta parami (układ 1/2/1). */
	.wce-fbt--mobile.is-expanded .wce-fbt__item:first-child {
		grid-column: 1 / -1;
	}
	.wce-fbt--mobile.is-expanded .wce-fbt__plus { display: none; }
}

/* ============================================================
 *  mcx-fbt-summary-320: ramka podsumowania FBT („W sumie / Dodaj
 *  wszystkie") po rozwinięciu na mobile.
 *  Problem: .wce-fbt__summary ma flex:1 1 230px. W układzie kolumnowym
 *  (≤782px, np. 320px) flex-basis 230px staje się WYSOKOŚCIĄ → ramka
 *  ~230px z ogromną pustą przestrzenią (justify-content:center centruje
 *  treść w środku). Gasimy rozdmuchanie i ograniczamy oddech góra/dół
 *  do 32px. Tekst przycisku <480px → 14px, żeby nie był przycinany.
 * ========================================================== */
@media (max-width: 1023.98px) {
	.wce-fbt__summary {
		flex: 0 0 auto;        /* usuń flex-basis:230px rozdmuchujący wysokość */
		padding-top: 32px;
		padding-bottom: 32px;  /* puste przestrzenie góra/dół = 32px */
	}
}
@media (max-width: 479.98px) {
	.wce-fbt__add,
	.wce-fbt__add .btn__label {
		font-size: 14px;       /* mniejszy tekst, mieści się bez przycięcia */
	}
}
