/* Konfigurator zintegrowany ze stroną główną */
.sz-konfigurator-section {
	padding: 90px 0;
	background: var(--sz-grey, #f4f4f4);
	scroll-margin-top: 88px;
	overflow-x: clip;
	max-width: 100%;
}

.sz-konfigurator-section .sz-container {
	max-width: 100%;
}

.sz-konfigurator-section--page {
	padding-top: 120px;
	min-height: 60vh;
}

@media (max-width: 640px) {
	.sz-konfigurator-section {
		scroll-margin-top: 72px;
	}
}

.sz-konfigurator-section__intro {
	margin-bottom: 36px;
}

.sz-konfigurator-section__lead {
	margin: 0;
	max-width: 720px;
	color: var(--sz-text-light, #666);
	font-size: 1rem;
	line-height: 1.6;
}

.sz-configurator {
	max-width: 100%;
	overflow-x: clip;
	--sz-red: var(--sz-orange, #e85d24);
	--sz-red-dark: var(--sz-orange-dark, #c74b18);
	--sz-charcoal: var(--sz-text, #333333);
	--sz-charcoal-light: #4a4a4a;
	--sz-muted: #5c5c5c;
	--sz-bg: var(--sz-grey, #f4f4f4);
	--sz-white: #ffffff;
	--sz-border: #e0e0e0;
	--sz-radius: 12px;
	font-family: inherit;
	color: var(--sz-charcoal);
	background: transparent;
}

.sz-configurator * { box-sizing: border-box; }
.sz-configurator__form { display: block; }

.sz-configurator__layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	min-height: auto;
}

.sz-panel {
	background: var(--sz-white);
	padding: 28px 32px;
	border: 1px solid var(--sz-border);
	border-radius: var(--sz-radius);
}

.sz-panel--left { border-right: 1px solid var(--sz-border); }
.sz-panel__header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--sz-bg); }
.sz-panel__header--inline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sz-panel__title { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--sz-charcoal); text-transform: uppercase; letter-spacing: 0.02em; }
.sz-panel__subtitle { margin: 8px 0 0; font-size: 0.92rem; color: var(--sz-muted); line-height: 1.5; }
.sz-accent { color: var(--sz-red); }

.sz-form { display: flex; flex-direction: column; gap: 18px; }
.sz-field__label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sz-field__label { font-size: 0.92rem; font-weight: 700; color: var(--sz-charcoal); }

.sz-input, .sz-select {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--sz-border);
	border-radius: 8px;
	background: var(--sz-white);
	font-size: 0.95rem;
	color: var(--sz-charcoal);
}

.sz-input:focus, .sz-select:focus {
	outline: none;
	border-color: var(--sz-red);
	box-shadow: 0 0 0 3px rgba(232, 93, 36, 0.12);
}

.sz-select {
	appearance: none;
	cursor: pointer;
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23333' d='M1.4 1.4 6 6l4.6-4.6L12 3.4 6 9.4 0 3.4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.sz-info-btn {
	width: 22px;
	height: 22px;
	border: 1px solid var(--sz-red);
	border-radius: 50%;
	background: transparent;
	color: var(--sz-red);
	font-size: 0.72rem;
	font-weight: 700;
	font-style: italic;
	font-family: Georgia, serif;
	cursor: pointer;
}

.sz-info-btn:hover, .sz-info-btn.is-active { background: var(--sz-red); color: #fff; }

.sz-products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 16px;
}

.sz-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	border: 2px solid var(--sz-border);
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
}

.sz-product-card.is-selected {
	border-color: var(--sz-red);
	box-shadow: 0 0 0 3px rgba(232, 93, 36, 0.12);
}

.sz-product-card__input { position: absolute; opacity: 0; pointer-events: none; }
.sz-product-card__visual { position: relative; aspect-ratio: 4/3; background: #eee; }
.sz-product-card__visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sz-product-card__placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #e0e0e0, #ccc); }

.sz-product-card__check {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--sz-red);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transform: scale(0.8);
	transition: opacity 0.2s, transform 0.2s;
}

.sz-product-card.is-selected .sz-product-card__check { opacity: 1; transform: scale(1); }
.sz-product-card__meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.sz-product-card__name { font-size: 0.92rem; font-weight: 700; }
.sz-product-card__price { font-size: 0.85rem; font-weight: 600; color: var(--sz-red); }

.sz-panel--map,
.sz-panel--footer {
	margin-top: 24px;
}

.sz-map-wrap {
	display: block;
}

.sz-map-container {
	position: relative;
	border: 1px solid var(--sz-border);
	border-radius: 10px;
	overflow: hidden;
}

.sz-map {
	height: 400px;
	width: 100%;
}

.sz-map-bubble {
	position: absolute;
	left: 16px;
	bottom: 16px;
	z-index: 500;
	max-width: min(360px, calc(100% - 32px));
	padding: 14px 16px;
	background: rgba(255, 255, 255, 0.97);
	border: 1px solid var(--sz-border);
	border-left: 4px solid var(--sz-red);
	border-radius: 10px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(4px);
}

.sz-map-bubble.is-success {
	border-left-color: #2e7d32;
}

.sz-map-bubble.is-error {
	border-left-color: var(--sz-red);
	background: #fff8f6;
}

.sz-map-bubble__text {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--sz-charcoal);
	line-height: 1.45;
}

.sz-map-bubble.is-success .sz-map-bubble__text {
	color: #1b5e20;
}

.sz-map-bubble.is-error .sz-map-bubble__text {
	color: #b71c1c;
}

.sz-map-bubble__clear {
	margin-top: 10px;
	padding: 8px 14px;
	border: 1px solid var(--sz-border);
	border-radius: 8px;
	background: #fff;
	color: var(--sz-charcoal);
	font-size: 0.85rem;
	font-weight: 700;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}

.sz-map-bubble__clear:hover {
	border-color: var(--sz-red);
	color: var(--sz-red);
}

/* Ikony SVG */
.sz-ui-icon {
	display: block;
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.sz-ui-icon--card {
	width: 24px;
	height: 24px;
}

.sz-ui-icon--chip {
	width: 20px;
	height: 20px;
}

.sz-extra-card--photos .sz-extra-card__icon {
	color: var(--sz-red);
}

.sz-extra-card--removal .sz-extra-card__icon {
	color: #2e7d32;
}

.sz-removal-chip__icon {
	color: var(--sz-red);
}

/* Pod mapą — zdjęcia i usunięcia */
.sz-map-extras {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.sz-extra-card {
	border: 1px solid var(--sz-border);
	border-radius: 12px;
	background: #fff;
	overflow: hidden;
}

.sz-extra-card__toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	cursor: pointer;
	margin: 0;
}

.sz-extra-card__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px 10px;
}

.sz-extra-card__icon {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	background: var(--sz-bg);
	line-height: 0;
}

.sz-extra-card--photos .sz-extra-card__icon {
	background: rgba(232, 93, 36, 0.1);
}

.sz-extra-card--removal .sz-extra-card__icon {
	background: rgba(46, 125, 50, 0.1);
}

.sz-extra-card__copy {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.sz-extra-card__title {
	font-size: 0.95rem;
	font-weight: 800;
	color: var(--sz-charcoal);
	line-height: 1.3;
}

.sz-extra-card__desc {
	font-size: 0.84rem;
	font-weight: 500;
	color: var(--sz-muted);
	line-height: 1.4;
}

.sz-extra-card__input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sz-extra-card__switch {
	flex-shrink: 0;
	width: 46px;
	height: 26px;
	border-radius: 999px;
	background: #d8d8d8;
	position: relative;
	transition: background 0.2s;
}

.sz-extra-card__switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s;
}

.sz-extra-card__input:checked + .sz-extra-card__switch {
	background: var(--sz-red);
}

.sz-extra-card__input:checked + .sz-extra-card__switch::after {
	transform: translateX(20px);
}

.sz-extra-card__toggle:has(.sz-extra-card__input:checked) {
	background: rgba(232, 93, 36, 0.04);
}

.sz-extra-card__body {
	padding: 14px 16px 16px;
	border-top: 1px solid var(--sz-border);
	background: var(--sz-bg);
}

.sz-extra-card--removal .sz-extra-card__head {
	padding-bottom: 14px;
}

.sz-extra-card--removal .sz-extra-card__body {
	border-top: 0;
	padding: 16px;
}

.sz-extra-card__hint {
	margin: 0 0 12px;
	font-size: 0.82rem;
	color: var(--sz-muted);
}

.sz-photo-upload {
	display: block;
	cursor: pointer;
}

.sz-photo-upload input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
}

.sz-photo-upload__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 12px 16px;
	border-radius: 10px;
	border: 2px dashed var(--sz-red);
	background: #fff;
	color: var(--sz-red);
	font-size: 0.9rem;
	font-weight: 700;
	transition: background 0.15s, color 0.15s;
}

.sz-photo-upload:hover .sz-photo-upload__btn {
	background: var(--sz-red);
	color: #fff;
	border-style: solid;
}

.sz-photo-preview {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}

.sz-photo-preview__item {
	position: relative;
	aspect-ratio: 1;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid var(--sz-border);
	background: #eee;
}

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

.sz-photo-preview__remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 24px;
	height: 24px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.sz-removal-chips {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.sz-removal-chip {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 12px;
	border: 1px solid var(--sz-border);
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.sz-removal-chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sz-removal-chip__icon {
	flex-shrink: 0;
	font-size: 1.15rem;
	line-height: 1;
}

.sz-removal-chip__label {
	font-size: 0.86rem;
	font-weight: 700;
	color: var(--sz-charcoal);
	line-height: 1.25;
}

.sz-removal-chip:has(input:checked) {
	border-color: var(--sz-red);
	background: rgba(232, 93, 36, 0.05);
	box-shadow: 0 0 0 3px rgba(232, 93, 36, 0.1);
}

.sz-removal-notes {
	margin-top: 12px;
}

.sz-input--textarea {
	min-height: 88px;
	resize: vertical;
}

.sz-map-pin span {
	display: block;
	width: 28px;
	height: 28px;
	background: var(--sz-red);
	border: 3px solid #fff;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.sz-footer-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 28px;
}

.sz-configurator .sz-section-title {
	margin: 0 0 16px;
	font-size: 1.1rem;
	font-weight: 800;
	text-transform: uppercase;
}

.sz-contact-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px;
}

.sz-contact-grid .sz-field--full {
	grid-column: 1 / -1;
}

.sz-summary {
	padding: 20px;
	background: var(--sz-bg);
	border: 1px solid var(--sz-border);
	border-radius: 10px;
}

.sz-price-table {
	margin-bottom: 14px;
}

.sz-price-table__head,
.sz-price-breakdown li.sz-price-table__row {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(72px, 0.9fr) minmax(64px, 0.75fr) minmax(80px, 1fr);
	gap: 8px;
	align-items: start;
}

.sz-price-table__head {
	padding-bottom: 8px;
	border-bottom: 2px solid var(--sz-border);
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--sz-muted);
}

.sz-price-breakdown { list-style: none; margin: 0; padding: 0; }

.sz-price-breakdown li {
	padding: 10px 0;
	border-bottom: 1px dashed #e4e4e4;
	font-size: 0.88rem;
}

.sz-price-col--name {
	color: var(--sz-charcoal);
	font-weight: 600;
	line-height: 1.35;
}

.sz-price-col--unit,
.sz-price-col--qty {
	color: var(--sz-muted);
	font-size: 0.84rem;
}

.sz-price-col--sum {
	color: var(--sz-charcoal);
	font-weight: 700;
	text-align: right;
}

.sz-price-breakdown__empty {
	color: var(--sz-muted);
	font-style: italic;
	border: 0;
	grid-column: 1 / -1;
}

.sz-price-breakdown__pending {
	grid-column: 1 / -1;
	color: var(--sz-muted);
	font-size: 0.85rem;
	font-weight: 600;
}
.sz-price-total span { color: var(--sz-charcoal); font-weight: 700; }

.sz-price-total {
	display: flex;
	justify-content: space-between;
	padding: 14px 0;
	border-top: 2px solid var(--sz-charcoal);
	margin-bottom: 10px;
}

.sz-price-total strong { font-size: 1.5rem; color: var(--sz-red); }
.sz-price-note { margin: 0 0 16px; font-size: 0.84rem; color: var(--sz-muted); line-height: 1.5; }

.sz-configurator .sz-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 18px;
	border-radius: 8px;
	border: 0;
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
}

.sz-configurator .sz-btn--primary {
	width: 100%;
	background: linear-gradient(135deg, var(--sz-red), var(--sz-red-dark));
	color: #fff;
}

.sz-configurator .sz-btn--primary:disabled { opacity: 0.7; cursor: wait; }
.sz-configurator .sz-btn--ghost { background: #fff; color: var(--sz-charcoal); border: 1px solid var(--sz-border); }

.sz-form-message { margin-top: 12px; font-weight: 600; }
.sz-form-message.is-success { color: #2e7d32; }
.sz-form-message.is-error { color: var(--sz-red); }

.sz-info-popover {
	position: fixed;
	z-index: 100001;
	max-width: 360px;
	padding: 18px 36px 18px 20px;
	background: #fff;
	color: var(--sz-charcoal, #333);
	border: 1px solid var(--sz-border);
	border-top: 3px solid var(--sz-red);
	border-radius: 10px;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

.sz-info-popover[hidden] { display: none; }

.sz-info-popover__content {
	color: var(--sz-charcoal, #333);
	font-size: 0.92rem;
	line-height: 1.55;
}

.sz-info-popover__content p,
.sz-info-popover__content li,
.sz-info-popover__content span,
.sz-info-popover__content div,
.sz-info-popover__empty {
	color: var(--sz-charcoal, #333) !important;
}

.sz-info-popover__content a {
	color: var(--sz-red) !important;
	text-decoration: underline;
}

.sz-info-popover__empty {
	font-style: italic;
	color: var(--sz-muted, #5c5c5c) !important;
}

.sz-info-popover__close {
	position: absolute;
	top: 8px;
	right: 10px;
	border: 0;
	background: transparent;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	color: var(--sz-charcoal, #333);
}

/* Tablet i telefon — wszystkie ramki jedna pod drugą */
@media (max-width: 900px) {
	.sz-configurator__form {
		display: flex;
		flex-direction: column;
		gap: 20px;
	}

	.sz-configurator__layout {
		display: contents;
	}

	/* Najpierw wybór wzoru płotu, potem parametry, mapa, formularz */
	.sz-panel--right {
		order: 1;
	}

	.sz-panel--left {
		order: 2;
		border-right: 0;
	}

	.sz-panel--map {
		order: 3;
		margin-top: 0;
	}

	.sz-panel--footer {
		order: 4;
		margin-top: 0;
	}

	.sz-panel {
		padding: 22px 18px;
	}

	.sz-panel__header--inline {
		flex-direction: column;
		align-items: flex-start;
	}

	.sz-panel__title {
		font-size: 1.1rem;
	}

	.sz-products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.sz-footer-grid,
	.sz-contact-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.sz-map {
		height: 300px;
	}

	.sz-map-bubble {
		left: 12px;
		right: 12px;
		bottom: 12px;
		max-width: none;
	}

	.sz-extra-card__toggle,
	.sz-extra-card__head {
		padding: 14px 16px;
		gap: 12px;
	}

	.sz-extra-card__body {
		padding: 14px 16px 16px;
	}

	.sz-extra-card--removal .sz-extra-card__body {
		padding: 16px;
	}

	.sz-removal-chips {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 540px) {
	.sz-price-table__head,
	.sz-price-breakdown li.sz-price-table__row {
		grid-template-columns: minmax(0, 1.2fr) minmax(60px, 0.85fr) minmax(56px, 0.7fr) minmax(72px, 0.95fr);
		gap: 6px;
		font-size: 0.8rem;
	}

	.sz-price-table__head {
		font-size: 0.62rem;
	}

	.sz-panel {
		padding: 18px 14px;
		border-radius: 10px;
	}

	.sz-products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.sz-product-card__meta {
		padding: 8px 10px;
	}

	.sz-product-card__name {
		font-size: 0.82rem;
		line-height: 1.25;
	}

	.sz-product-card__price {
		font-size: 0.78rem;
	}

	.sz-map {
		height: 260px;
	}

	.sz-price-total {
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;
	}

	.sz-price-total strong {
		font-size: 1.35rem;
	}

	.sz-configurator .sz-btn--primary {
		padding: 14px 18px;
		font-size: 1rem;
	}

	.sz-info-popover {
		left: 12px !important;
		right: 12px !important;
		max-width: none;
		width: auto;
	}

	.sz-map-extras {
		gap: 12px;
		margin-top: 18px;
	}

	.sz-extra-card__icon {
		width: 40px;
		height: 40px;
		font-size: 1.2rem;
	}

	.sz-extra-card__title {
		font-size: 0.9rem;
	}

	.sz-extra-card__desc {
		font-size: 0.8rem;
	}

	.sz-extra-card__switch {
		width: 42px;
		height: 24px;
	}

	.sz-extra-card__switch::after {
		width: 18px;
		height: 18px;
	}

	.sz-extra-card__input:checked + .sz-extra-card__switch::after {
		transform: translateX(18px);
	}

	.sz-removal-chips {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.sz-removal-chip {
		flex-direction: column;
		align-items: center;
		text-align: center;
		padding: 10px 8px;
		gap: 6px;
	}

	.sz-removal-chip__label {
		font-size: 0.78rem;
	}

	.sz-photo-preview {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}
