/*
 * Karta produktu (motyw potomny phlox-child) - uklad v2:
 * 2 kolumny przez cala wysokosc tresci (lewa: H1 + galeria + opis w sekcjach, prawa: sticky
 * podsumowanie zakupu), okruszki pelna szerokoscia na gorze, "Ähnliche Produkte" pelna szerokoscia
 * pod obiema kolumnami. Tylko na karcie produktu (enqueue w inc/card.php). Budzet: <= 6 KB gzip.
 * Zera inline style, kolory/fonty przejete z motywu (var() z fallbackiem na istniejace kolory Phlox).
 */

:root {
	--imsf-fs-h1: 1.75rem;
	--imsf-fs-h2: 1.25rem;
	--imsf-fs-h3: 1.125rem;
	--imsf-fs-h4: 1rem;
	--imsf-fs-h5: 0.9375rem;
	--imsf-fs-h6: 0.8125rem;
	--imsf-fs-body: 0.875rem;
	--imsf-fs-label: 0.8125rem;
	--imsf-fs-price: 1.125rem;
	--imsf-fs-small: 0.75rem;
	--imsf-fs-card-title: 0.875rem;
	--imsf-color-label: #4b5563;
}

/* Okruszki - Phlox/Auxin ich domyslnie nie renderuje na karcie produktu (zdjete w parent, patrz
   woocommerce/single-product.php) - wywolane recznie, tylko odstep pod spodem. */
.woocommerce-breadcrumb {
	margin: 0 0 1.25rem;
	font-size: var(--imsf-fs-small);
	color: #666;
	overflow-wrap: anywhere;
}

.imsf-card {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(22.5rem, 1fr);
	gap: 1.875rem;
	align-items: start;
	min-width: 0;
	max-width: 87.5rem;
	margin: 0 auto 1.875rem;
	font-size: var(--imsf-fs-body);
}

.imsf-card__below {
	box-sizing: border-box;
	min-width: 0;
	max-width: 100%;
}

.imsf-card__main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.imsf-card__main > .product_title {
	margin: 0;
}

.imsf-card__main > .woocommerce-product-rating {
	margin: 0;
}

.imsf-card__gallery {
	min-width: 0;
}

/* WC lacza wlasny arkusz `woocommerce-layout.css` wymusza `div.product div.images{float:left;
   width:48%}` zakladajac klasyczny uklad 2-kol. (images + summary w jednym rodzicu) - u nas
   galeria jest zagniezdzona w .imsf-card__main, wiec trzeba to nadpisac (stad !important,
   specificity oryginalu jest porownywalna). Efekt bledu bez tej regulki: polowiczna szerokosc
   zdjecia glownego i pusta przestrzen obok */
.imsf-card__gallery .woocommerce-product-gallery {
	float: none !important;
	width: 100% !important;
	max-width: 100%;
	margin-bottom: 0;
	position: relative;
}

/* Rezerwa na miniatury istnieje zanim FlexSlider doda ich liste. */
@media (max-width: 782px) {
	.imsf-card__gallery .woocommerce-product-gallery {
		box-sizing: content-box;
		aspect-ratio: 1;
		overflow: hidden;
	}

	body.imsf-card-has-thumbs .imsf-card__gallery .woocommerce-product-gallery {
		padding-bottom: 15%;
	}

	body.imsf-card-has-thumbs .imsf-card__gallery .flex-control-thumbs,
	body.imsf-card-has-thumbs .imsf-card__gallery .imsf-thumbs {
		position: absolute;
		left: 0;
		bottom: 0;
		width: 100%;
	}

	body.imsf-card-has-thumbs .imsf-card__gallery .imsf-thumbs {
		aspect-ratio: 20 / 3;
	}
}

/* Bez max-width: flexslider ustawia inline width:400% (slajdy obok siebie) - limit 100%
   zwezal wrapper do 1 slajdu i drugie zdjecie spadalo pod pierwsze (puste po kliknieciu). */
.imsf-card__gallery .woocommerce-product-gallery__wrapper {
	margin-bottom: 0;
}

.imsf-card__gallery img {
	width: 100%;
	height: auto;
	display: block;
}

/* Opis jako kolejne sekcje (zamiast zakladek z JS) - immersafe_child_render_description_sections() */
.imsf-card__sections {
	display: flex;
	flex-direction: column;
	gap: 1.875rem;
	min-width: 0;
}

.imsf-card__section-title {
	margin: 0 0 0.625rem;
	padding-bottom: 0.625rem;
	border-bottom: 2px solid #e5e5e5;
}

/* Tabele na karcie (np. "Technische Daten" w opisie, "Zusatzliche Informationen" z atrybutow WC) -
   jednolity padding komorek 0.625rem (10px). font-style:normal
   !important, bo WC core (woocommerce.css) ma `.woocommerce table.shop_attributes td{font-style:
   italic}` z wyzsza specyficznoscia (dwie klasy) niz .imsf-card table td. */
.imsf-card table th,
.imsf-card table td {
	padding: 0.625rem;
	font-size: var(--imsf-fs-body);
	font-style: normal !important;
}

/* Kursywa wylaczona na karcie (opis, tabele, cytaty), tylko ten
   szablon (plik ladowany wylacznie na is_product(), patrz inc/card.php), bez zmian globalnych
   w motywie. */
body.single-product em,
body.single-product i,
body.single-product cite,
body.single-product blockquote,
body.single-product blockquote * {
	font-style: normal;
}

/* Skala naglowkow na karcie (h1 tytul produktu, h2 sekcje, h3-h6 w tresci opisu/sidebarze) -
   spojny line-height i marginesy w rem. */
.imsf-card h1 {
	font-size: var(--imsf-fs-h1);
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 1.25rem;
}

.imsf-card__main > .product_title {
	display: none !important;
}

.imsf-card h1.product_title {
	font-size: 1.5rem;
}

.imsf-card h1.imsf-card__title--side {
	margin: 0 0 0.25rem;
}

.imsf-card h2,
.imsf-card__below h2,
.imsf-anfrage h2 {
	font-size: var(--imsf-fs-h2);
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 0.625rem;
}

.imsf-card h3 {
	font-size: var(--imsf-fs-h3);
	line-height: 1.3;
	margin: 0 0 0.625rem;
}

.imsf-card h4 {
	font-size: var(--imsf-fs-h4);
	line-height: 1.3;
	margin: 0 0 0.625rem;
}

.imsf-card h5 {
	font-size: var(--imsf-fs-h5);
	line-height: 1.3;
	margin: 0 0 0.625rem;
}

.imsf-card h6 {
	font-size: var(--imsf-fs-h6);
	line-height: 1.3;
	margin: 0 0 0.625rem;
}

/* Elementor w opisie (np. "Technische Daten" obok "Anwendungsbereiche") - wymuszone 1 kolumna
   TYLKO wewnatrz opisu karty, zeby nie psuc Elementora gdzie indziej na stronie. */
@media (max-width: 1024px) {
	.imsf-card__sections .elementor-section .elementor-container,
	.imsf-card__sections .elementor-row {
		flex-wrap: wrap !important;
	}

	.imsf-card__sections .elementor-column {
		width: 100% !important;
	}
}

/* Prawa kolumna - sticky podsumowanie zakupu.
   WAZNE: sidebar ma klasy "summary entry-summary" (wymagane przez hooki WC), a
   woocommerce-layout.css ma regulke `.product div.summary{float:right;width:48%}` zalozona pod
   klasyczny uklad (images+summary w jednym rodzicu) - w gridzie ta sama regulka nadal trafia i
   NADPISUJE szerokosc z grid-template-columns (procent liczony od szerokosci sciezki gridu), co
   dawalo waski sidebar (~250px) i pusty pas obok).
   width:auto!important oddaje pelna szerokosc sciezki gridu z powrotem sidebarowi. */
.imsf-card__sidebar {
	min-width: 0;
	width: auto !important;
	float: none !important;
	position: sticky;
	top: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
	min-height: 8rem;
}

.imsf-card__sidebar .imsf-pf__field--select {
	min-height: 4rem;
}

.imsf-card__sidebar form.cart .quantity {
	min-height: 2.75rem;
}

.imsf-card__tabs {
	box-sizing: border-box;
	min-height: 2.8125rem;
}

/* Kolejnosc elementow w prawej kolumnie */
.imsf-card__sidebar > form.cart,
.imsf-card__sidebar > .imsf-b2b-tiers {
	display: contents;
}

.imsf-card__sidebar > form.cart > *,
.imsf-card__sidebar > .imsf-b2b-tiers > * {
	margin: 0;
}

.imsf-card__sidebar > form.cart > .imsf-pf {
	order: 1;
}

.imsf-card__sidebar > .price {
	order: 2;
	font-size: var(--imsf-fs-price);
	font-weight: 700;
	color: #be0225;
}

.imsf-card__sidebar > .stock {
	order: 3;
	margin: 0;
	font-size: var(--imsf-fs-small);
	font-weight: 600;
}

.imsf-card__sidebar > .stock.in-stock {
	color: #007a08;
}

.imsf-card__sidebar > .stock.out-of-stock,
.imsf-card__sidebar > .stock.available-on-backorder {
	color: #be0225;
}

.imsf-card__sidebar > .imsf-b2b-tiers > :not(.imsf-b2b-tiers__summary) {
	order: 5;
}

.imsf-card__sidebar > .imsf-b2b-tiers__legacy-summary {
	order: 5;
	margin: 0;
}

.imsf-card__sidebar > .imsf-b2b-tiers > .imsf-b2b-tiers__summary {
	order: 8;
}

.imsf-card__sidebar > .imsf-delivery {
	order: 6;
}

.imsf-card__sidebar > form.cart > .quantity {
	order: 7;
}

.imsf-card__sidebar > form.cart > .single_add_to_cart_button {
	order: 9;
}

.imsf-card__sidebar > form.cart > .imsf-b2b-anfrage {
	order: 10;
}

.imsf-card__main > .product_meta,
.imsf-card__main > .woocommerce-product-details__short-description {
	margin: 0;
}

.imsf-card__main > .product_meta {
	font-size: var(--imsf-fs-small);
	color: #666;
}

.imsf-card__main > .product_meta > span {
	display: block;
}

.imsf-card__main > .product_meta .sku_wrapper {
	display: none;
}

.imsf-card__sku {
	margin: 0;
	font-size: var(--imsf-fs-small);
	color: #666;
}

.imsf-card__sidebar .imsf-b2b-tiers {
	font-size: var(--imsf-fs-body);
}

.imsf-card__sidebar .imsf-pf__field > label,
.imsf-card__sidebar .imsf-pf__choices > legend,
.imsf-card__sidebar .imsf-qty__label,
.imsf-card__sidebar .imsf-b2b-tiers__table th,
.imsf-card__sidebar .imsf-b2b-tiers__summary-label {
	font-size: var(--imsf-fs-label);
	font-weight: 600;
	color: var(--imsf-color-label);
}

.imsf-card__sidebar .imsf-pf__description,
.imsf-card__sidebar .imsf-b2b-tiers__after-text,
.imsf-card__sidebar .imsf-b2b-tiers__qty-note,
.imsf-card__sidebar .woocommerce-price-suffix,
.imsf-card__sidebar > .price small {
	font-size: var(--imsf-fs-small);
}

.imsf-card__sidebar > .imsf-trust-list {
	order: 12;
	margin-top: 2rem;
	margin-bottom: 2rem;
}

.imsf-card__sidebar > .imsf-sales-contact,
.imsf-card__sidebar > .imsf-sales-rotator {
	order: 13;
}

.imsf-card__sidebar > .share,
.imsf-card__sidebar > .woocommerce-sharing {
	order: 14;
}

.imsf-card__sidebar > .imsf-card__recent {
	order: 15;
}

.imsf-card__sidebar > a.imsf-b2b-anfrage {
	order: 10;
}

/* Przyciski koszyka i zapytania sa ponizej bloku sumy. */
.imsf-card__sidebar form.cart .single_add_to_cart_button,
.imsf-card__sidebar .imsf-b2b-anfrage {
	display: block;
	width: 100%;
	text-align: center;
	margin: 0;
}

.elementor-shortcode .imsf-anfrage-trigger {
	display: flex;
	width: fit-content;
	margin: 0 auto;
}

.imsf-card__sidebar form.cart .single_add_to_cart_button {
	background: #be0225 !important;
	border-color: #be0225 !important;
	color: #fff !important;
}

.imsf-card__sidebar form.cart .single_add_to_cart_button:hover {
	background: #8f0119 !important;
	border-color: #8f0119 !important;
}

.imsf-card__sidebar .imsf-b2b-anfrage,
.elementor-shortcode .imsf-anfrage-trigger {
	background: transparent !important;
	color: #be0225 !important;
	border: 2px solid #be0225 !important;
}

.imsf-card__sidebar .imsf-b2b-anfrage:hover,
.elementor-shortcode .imsf-anfrage-trigger:hover {
	background: #fbe9ec !important;
}

/* Blok sumy netto/brutto i oszczednosci. */
.imsf-card__sidebar .imsf-b2b-tiers__summary {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 1rem;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary-row[hidden] {
	display: none !important;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary [data-imsf-summary-savings-row][hidden] {
	display: none !important;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.75rem;
	margin: 0;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary-label {
	min-width: 0;
	flex: 1 1 auto;
	overflow-wrap: anywhere;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary-row:not(.imsf-b2b-tiers__summary-row--savings):not(.imsf-b2b-tiers__summary-row--gross) .imsf-b2b-tiers__summary-value {
	flex: 0 0 auto;
	font-size: var(--imsf-fs-price);
	font-weight: 700;
	text-align: right;
	white-space: nowrap;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary--compact [data-imsf-sum-net] {
	align-self: flex-end;
	font-size: var(--imsf-fs-price);
	font-weight: 700;
	text-align: right;
	white-space: nowrap;
}

.imsf-card__sidebar .imsf-b2b-tiers__qty-note {
	margin: 0;
	font-size: var(--imsf-fs-small);
	color: #6b7280;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary-row--savings,
.imsf-card__sidebar .imsf-b2b-tiers__summary-row--savings .imsf-b2b-tiers__summary-value,
.imsf-card__sidebar .imsf-b2b-tiers__summary [data-imsf-summary-savings-row] {
	color: #007a08;
	font-weight: 700;
}

.imsf-card__sidebar .imsf-b2b-tiers__summary-row--gross {
	font-size: var(--imsf-fs-label);
	color: #6b7280;
}

/* Lista zaufania */
.imsf-trust-list {
	list-style: none;
	margin: 0;
	padding: 1rem 0;
	border-top: 1px solid #e5e5e5;
	border-bottom: 1px solid #e5e5e5;
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	font-size: var(--imsf-fs-body);
	color: #333;
}

.imsf-trust-list li:last-child {
	margin-bottom: 0; /* inaczej dolny odstep jest wiekszy niz gorny */
}

.imsf-trust-list li::before {
	content: "✓";
	color: #007a08;
	margin-right: 0.375rem;
}

/* Blok handlowca */
.imsf-sales-contact {
	display: flex;
	gap: 0.625rem;
	align-items: flex-start;
	padding: 1.25rem;
	background: #f7f7f7;
	border: 1px solid #e5e5e5;
	border-radius: 0.25rem;
}

.imsf-sales-contact__photo {
	border-radius: 50%;
	flex: 0 0 auto;
	object-fit: cover;
}

.imsf-sales-contact__title {
	margin: 0 0 0.25rem;
	font-weight: 700;
}

.imsf-sales-contact__name,
.imsf-sales-contact p {
	margin: 0 0 0.125rem;
}

.imsf-sales-contact__position {
	font-size: 0.875em;
	opacity: 0.75;
}

/* Rotator handlowcow: do wyboru osoby (inline JS) widac tylko pierwszy blok, potem decyduje atrybut hidden */
.imsf-sales-rotator:not(.is-ready) > .imsf-sales-contact:not(:first-child),
.imsf-sales-contact[hidden],
.imsf-anfrage__contact-line[hidden] {
	display: none;
}

/* Ostatnio oglądane produkty */
.imsf-card__recent {
	padding-top: 0.625rem;
	border-top: 1px solid #e5e5e5;
}

.imsf-card__recent-title {
	margin-bottom: 0.625rem;
}

.imsf-card__recent-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
}

.imsf-card__recent-item {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
}

.imsf-card__recent-image-link {
	flex: 0 0 4.5rem;
	width: 4.5rem;
}

.imsf-card__recent-image {
	display: block;
	width: 100%;
	height: auto;
	object-fit: contain;
}

.imsf-card__recent-content {
	flex: 1 1 auto;
	min-width: 0;
}

.imsf-card__recent-name {
	display: block;
	font-size: var(--imsf-fs-card-title);
	font-weight: 600;
	line-height: 1.35;
}

.imsf-card__below .woocommerce-loop-product__title {
	font-size: var(--imsf-fs-card-title);
	font-weight: 600;
	line-height: 1.35;
}

.imsf-card__recent-price {
	margin-top: 0.25rem;
	font-size: var(--imsf-fs-small);
}

/* Okno zapytania o produkt (WPForms "Kontaktformular" zachowany jak dzis) */
.imsf-anfrage {
	position: fixed;
	inset: 0;
	z-index: 2147483647; /* maksimum: nad naglowkiem, przyciskiem "do gory", koszykiem i paskiem klejonym */
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
}

body.imsf-anfrage-open {
	overflow: hidden;
}

.imsf-anfrage[hidden] {
	display: none;
}

.imsf-anfrage__panel {
	position: relative;
	background: #fff;
	max-width: 35rem;
	width: calc(100% - 10px);
	max-height: calc(100vh - 10px);
	overflow-y: auto;
	padding: 1.875rem 1.25rem;
	border-radius: 0.25rem;
}

.imsf-anfrage__contact {
	margin: 0 0 0.5rem;
}

.imsf-anfrage__contact-lead {
	margin: 0 0 0.5rem;
	color: #444;
	font-size: 0.875rem;
	line-height: 1.4;
}

.imsf-anfrage__contact-line {
	margin: 0 0 0.25rem;
	font-size: 0.875rem;
}

.imsf-anfrage__contact-line a {
	color: inherit;
	text-decoration: underline;
}

.imsf-anfrage textarea {
	min-height: 7.5rem;
}

/* Desktop: pole "Nachricht oder Kommentar" na pelna szerokosc panelu. */
@media (min-width: 601px) {
	.imsf-anfrage div.wpforms-container-full .wpforms-form textarea {
		width: 100%;
		box-sizing: border-box;
	}
}

.imsf-anfrage__close {
	position: absolute;
	top: 0.625rem;
	right: 0.625rem;
	background: none;
	border: 0;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
}

.imsf-anfrage__product {
	color: #666;
	margin-top: -0.625rem;
}

/* Sticky pasek koszyk/zapytanie na mobile po przewinieciu */
.imsf-sticky-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9000;
	display: none;
	gap: 0.625rem;
	padding: 0.625rem;
	background: #fff;
	box-shadow: 0 -0.125rem 0.625rem rgba(0, 0, 0, 0.12);
}

.imsf-sticky-bar.is-visible {
	display: flex;
}

.imsf-sticky-bar .button {
	flex: 1 1 50%;
	text-align: center;
}

@media (max-width: 782px) {
	.imsf-card {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		width: 100%;
	}

	/* `display: contents` wyjmuje title/galerie/sekcje z imsf-card__main, zeby mozna je bylo
	   przeplatac z sidebarem (kolejnosc mobile: tytul, galeria, sidebar, opis i sekcje). */
	.imsf-card__main {
		display: contents;
	}

	.imsf-card__main > .product_title {
		display: block !important;
		order: 1;
	}

	.imsf-card h1.imsf-card__title--side {
		display: none !important;
	}

	.imsf-card__sku {
		display: none;
	}

	.imsf-card__main > .product_meta .sku_wrapper {
		display: block;
	}

	.imsf-card__main > .woocommerce-product-rating {
		order: 1;
	}

	.imsf-card__gallery,
	.imsf-card__main > .product_meta,
	.imsf-card__main > .woocommerce-product-details__short-description {
		order: 2;
	}

	.imsf-card__sidebar {
		order: 4;
		position: static;
	}

	.imsf-card__tabs {
		order: 3;
	}

	.imsf-card__sections {
		order: 5;
	}

	.imsf-card__sidebar > * {
		margin-bottom: 0;
	}

	body.single-product {
		padding-bottom: 4rem; /* miejsce na sticky bar */
	}
}

@media (min-width: 783px) {
	.imsf-sticky-bar {
		display: none !important;
	}
}

/* Baner "Kontaktieren Sie uns" (karta: prawa kolumna, lista: lewy pasek) - otwiera okno zapytania. */
.imsf-contact-banner {
	position: relative;
	display: flex;
	align-items: center;
	box-sizing: border-box;
	width: 100%;
	max-width: 320px;
	height: 48px; /* stala wysokosc: site-scale.css zeruje min-height linkow poza karta */
	margin: 8px 0 0 10px;
	padding: 6px 16px 6px 62px;
	background: #ce4554;
	color: #fff;
	font-family: Montserrat, sans-serif;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.02em;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.15s ease;
}

.imsf-contact-banner:hover,
.imsf-contact-banner:focus-visible {
	background: #be0225;
	color: #fff;
	text-decoration: none;
}

.imsf-contact-banner__badge {
	position: absolute;
	top: 50%;
	left: -10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	border: 1px solid #ce4554;
	background: #fff;
	color: #ce4554;
	transform: translateY(-50%);
}

.imsf-contact-banner__icon {
	width: 36px;
	height: 36px;
}

.imsf-card__sidebar > .imsf-contact-banner,
.imsf-sidebar-contact .imsf-contact-banner {
	width: calc(100% - 10px); /* 10 px marginesu na wystajacy kwadrat z ikona */
	max-width: none;
}

.imsf-card__sidebar > .imsf-contact-banner {
	order: 13;
	margin-top: 20px;
	margin-bottom: 3rem;
}

.imsf-sidebar-contact {
	margin: 24px 0 8px;
}
