/* Popup kontaktowy — kolory i layout (źródło: popup-kontakt-madra-sowka.html, bez demo strony) */
:root {
	--ms-popup-ivory: #f7f3eb;
	--ms-popup-white: #fff;
	--ms-popup-sage: #5b8c7a;
	--ms-popup-sage-mid: #7caf9a;
	--ms-popup-sage-light: #e2edea;
	--ms-popup-sage-deep: #3d6357;
	--ms-popup-blue: #6fa3c0;
	--ms-popup-blue-light: #d8edf5;
	--ms-popup-rose: #c98b7d;
	--ms-popup-rose-light: #f5e5e1;
	--ms-popup-amber: #d9a84c;
	--ms-popup-amber-light: #fbf0d5;
	--ms-popup-ink: #2c3a35;
	--ms-popup-muted: #7a8a84;
	--ms-popup-subtle: #a8b8b3;
	--ms-popup-border: rgba(91, 140, 122, 0.12);
	--ms-popup-border-mid: rgba(91, 140, 122, 0.22);
}

.popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	background: rgba(44, 58, 53, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	overscroll-behavior: contain;
}

.popup-overlay.open {
	opacity: 1;
	pointer-events: all;
}

.popup {
	position: relative;
	width: 100%;
	max-width: 860px;
	max-height: 90vh;
	overflow: hidden;
	display: grid;
	grid-template-columns: 1fr 1.15fr;
	border-radius: 28px;
	background: var(--ms-popup-white);
	box-shadow:
		0 32px 96px rgba(44, 58, 53, 0.25),
		0 8px 32px rgba(44, 58, 53, 0.12);
	transform: translateY(24px) scale(0.97);
	transition: transform 0.35s cubic-bezier(0.22, 0.68, 0, 1.2);
	overscroll-behavior: contain;
}

.popup-overlay.open .popup {
	transform: translateY(0) scale(1);
}

.popup-close {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 10;
	display: flex;
	width: 36px;
	height: 36px;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba(44, 58, 53, 0.08);
	cursor: pointer;
	transition:
		background 0.2s,
		transform 0.15s;
}

.popup-close:hover {
	background: rgba(44, 58, 53, 0.14);
	transform: scale(1.08);
}

.popup-close svg path {
	stroke: var(--ms-popup-ink);
}

.popup-left {
	position: relative;
	display: flex;
	overflow: hidden;
	flex-direction: column;
	padding: 44px 36px 40px;
	background: var(--ms-popup-sage);
}

.popup-left::before {
	position: absolute;
	top: -80px;
	right: -80px;
	width: 280px;
	height: 280px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.05);
	pointer-events: none;
	content: "";
}

.popup-left::after {
	position: absolute;
	bottom: -40px;
	left: -40px;
	width: 160px;
	height: 160px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.04);
	pointer-events: none;
	content: "";
}

.pl-owl {
	position: relative;
	z-index: 1;
	display: flex;
	width: 52px;
	height: 52px;
	align-items: center;
	justify-content: center;
	margin-bottom: 20px;
	border: 1.5px solid rgba(255, 255, 255, 0.2);
	border-radius: 15px;
	background: rgba(255, 255, 255, 0.12);
}

.pl-owl .pl-owl-img {
	display: block;
	width: 30px;
	height: 30px;
	object-fit: contain;
}

.pl-title {
	position: relative;
	z-index: 1;
	margin-bottom: 6px;
	color: #fff;
	font-family: Nunito, sans-serif;
	font-size: 1.45rem;
	font-weight: 900;
	line-height: 1.15;
}

.pl-title .amber {
	color: var(--ms-popup-amber);
}

.pl-sub {
	position: relative;
	z-index: 1;
	margin-bottom: 28px;
	color: rgba(255, 255, 255, 0.65);
	font-size: 0.86rem;
	line-height: 1.6;
}

.pl-contacts {
	position: relative;
	z-index: 1;
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
}

.pl-contact-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.1);
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s;
}

.pl-contact-item:hover {
	background: rgba(255, 255, 255, 0.16);
}

.pl-contact-item--tels {
	cursor: default;
}

.pl-contact-item--tels:hover {
	background: rgba(255, 255, 255, 0.1);
}

.pl-ci-value--tels-stack {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	align-content: flex-start;
	gap: 0.35rem;
	width: 100%;
	min-width: 0;
}

.pl-ci-tel-line {
	display: block;
	width: 100%;
	min-width: 0;
}

.pl-ci-tel-line .pl-ci-tel {
	display: inline-block;
	max-width: 100%;
	white-space: nowrap;
}

.pl-ci-tel {
	color: #fff;
	font-family: Nunito, sans-serif;
	font-size: 0.96rem;
	font-weight: 800;
	line-height: 1.2;
	text-decoration: none;
}

.pl-ci-tel:hover {
	color: var(--ms-popup-amber);
}

.pl-ci-tel-sep {
	color: rgba(255, 255, 255, 0.45);
	font-weight: 800;
	user-select: none;
}

.pl-ci-sub--above-tels {
	margin-top: 0;
	margin-bottom: 4px;
}

.pl-ci-icon {
	display: flex;
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	border-radius: 11px;
	background: rgba(255, 255, 255, 0.15);
}

.pl-ci-label {
	margin-bottom: 2px;
	color: rgba(255, 255, 255, 0.45);
	font-family: Nunito, sans-serif;
	font-size: 0.67rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.pl-ci-value {
	color: #fff;
	font-family: Nunito, sans-serif;
	font-size: 0.96rem;
	font-weight: 800;
	line-height: 1.2;
}

.pl-ci-value a {
	color: #fff;
	text-decoration: none;
}

.pl-ci-value a:hover {
	color: var(--ms-popup-amber);
}

.pl-ci-sub {
	margin-top: 2px;
	color: rgba(255, 255, 255, 0.5);
	font-size: 0.76rem;
	line-height: 1.3;
}

.pl-divider {
	height: 1px;
	margin: 4px 0;
	background: rgba(255, 255, 255, 0.12);
}

.pl-hours {
	position: relative;
	z-index: 1;
	margin-top: 18px;
	padding: 14px 16px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.07);
}

.pl-hours-label {
	margin-bottom: 8px;
	color: rgba(255, 255, 255, 0.4);
	font-family: Nunito, sans-serif;
	font-size: 0.67rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.pl-hours-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 4px 0;
	font-size: 0.82rem;
}

.pl-hours-day {
	color: rgba(255, 255, 255, 0.6);
}

.pl-hours-time {
	color: #fff;
	font-family: Nunito, sans-serif;
	font-weight: 700;
}

.pl-hours-time.closed {
	color: rgba(255, 255, 255, 0.3);
	font-weight: 400;
}

.popup-right {
	display: flex;
	overflow-y: auto;
	flex-direction: column;
	padding: 44px 36px 40px;
	min-height: 0;
}

.pr-head {
	margin-bottom: 22px;
}

.pr-title {
	margin-bottom: 4px;
	color: var(--ms-popup-ink);
	font-family: Nunito, sans-serif;
	font-size: 1.25rem;
	font-weight: 900;
}

.pr-sub {
	color: var(--ms-popup-muted);
	font-size: 0.83rem;
	line-height: 1.5;
}

.pr-form-inner {
	display: flex;
	flex: 1;
	flex-direction: column;
}

.pr-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 12px;
}

.pr-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.pr-full {
	margin-bottom: 12px;
}

.pr-label {
	color: var(--ms-popup-ink);
	font-family: Nunito, sans-serif;
	font-size: 0.74rem;
	font-weight: 800;
	letter-spacing: 0.02em;
}

.pr-label .req {
	margin-left: 2px;
	color: var(--ms-popup-rose);
}

.pr-input,
.pr-select,
.pr-textarea {
	width: 100%;
	padding: 10px 13px;
	border: 1.5px solid rgba(91, 140, 122, 0.2);
	border-radius: 11px;
	background: var(--ms-popup-white);
	color: var(--ms-popup-ink);
	font-family: Lato, sans-serif;
	font-size: 0.87rem;
	outline: none;
	appearance: none;
	transition:
		border-color 0.2s,
		box-shadow 0.2s;
}

.pr-input::placeholder,
.pr-textarea::placeholder {
	color: var(--ms-popup-subtle);
	font-size: 0.83rem;
}

.pr-input:focus,
.pr-select:focus,
.pr-textarea:focus {
	border-color: var(--ms-popup-sage);
	box-shadow: 0 0 0 3px rgba(91, 140, 122, 0.1);
}

.pr-textarea {
	min-height: 80px;
	line-height: 1.5;
	resize: vertical;
}

.pr-select-wrap {
	position: relative;
}

.pr-select-wrap::after {
	position: absolute;
	top: 50%;
	right: 13px;
	width: 0;
	height: 0;
	border-top: 5px solid var(--ms-popup-muted);
	border-right: 4px solid transparent;
	border-left: 4px solid transparent;
	pointer-events: none;
	content: "";
	transform: translateY(-50%);
}

.pr-select {
	padding-right: 32px;
	cursor: pointer;
}

.pr-rodo {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 16px;
	cursor: pointer;
}

.pr-rodo input[type="checkbox"] {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin-top: 2px;
	appearance: none;
	border: 1.5px solid rgba(91, 140, 122, 0.3);
	border-radius: 4px;
	background: var(--ms-popup-white);
	cursor: pointer;
	transition:
		background 0.15s,
		border-color 0.15s;
}

.pr-rodo input:checked {
	border-color: var(--ms-popup-sage);
	background: var(--ms-popup-sage);
	background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2 5l2 2 4-4' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
}

.pr-rodo-text {
	color: var(--ms-popup-muted);
	font-size: 0.76rem;
	line-height: 1.5;
}

.pr-rodo-text a {
	color: var(--ms-popup-sage);
	font-weight: 600;
}

.pr-submit {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px;
	border: none;
	border-radius: 13px;
	background: var(--ms-popup-sage);
	box-shadow: 0 5px 18px rgba(91, 140, 122, 0.28);
	color: #fff;
	cursor: pointer;
	font-family: Nunito, sans-serif;
	font-size: 0.92rem;
	font-weight: 800;
	transition:
		background 0.2s,
		transform 0.15s,
		box-shadow 0.2s;
}

.pr-submit:hover {
	background: #4a7a6a;
	box-shadow: 0 8px 24px rgba(91, 140, 122, 0.32);
	transform: translateY(-1px);
}

.pr-submit:disabled {
	cursor: not-allowed;
	opacity: 0.65;
	transform: none;
}

.pr-form-error {
	margin-top: 10px;
	margin-bottom: 0;
	color: var(--ms-popup-rose);
	font-size: 0.8rem;
	line-height: 1.4;
}

.pr-info {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	margin-top: 10px;
	color: var(--ms-popup-subtle);
	font-size: 0.73rem;
}

.pr-success {
	display: none;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 20px 0;
	text-align: center;
}

.pr-success-icon {
	display: flex;
	width: 72px;
	height: 72px;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--ms-popup-sage-light);
}

.pr-success-title {
	color: var(--ms-popup-ink);
	font-family: Nunito, sans-serif;
	font-size: 1.25rem;
	font-weight: 900;
}

.pr-success-sub {
	max-width: 280px;
	color: var(--ms-popup-muted);
	font-size: 0.88rem;
	line-height: 1.6;
}

.pr-success-close {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	padding: 10px 22px;
	border: none;
	border-radius: 999px;
	background: var(--ms-popup-sage);
	color: #fff;
	cursor: pointer;
	font-family: Nunito, sans-serif;
	font-size: 0.86rem;
	font-weight: 800;
	transition: background 0.2s;
}

.pr-success-close:hover {
	background: #4a7a6a;
}

@media (max-width: 700px) {
	/* Przewijanie wewnątrz karty — stabilniejsze na iOS niż scroll całego overlay */
	.popup-overlay {
		align-items: center;
		justify-content: center;
		padding-top: max(0.75rem, env(safe-area-inset-top));
		padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
		padding-left: max(0.75rem, env(safe-area-inset-left));
		padding-right: max(0.75rem, env(safe-area-inset-right));
		overflow: hidden;
		-webkit-overflow-scrolling: touch;
	}

	.popup {
		grid-template-columns: 1fr;
		border-radius: 22px;
		margin: 0 auto;
		width: 100%;
		max-width: 860px;
		/* Ograniczenie do viewportu + wyraźny scroll w dół po treści */
		max-height: calc(100vh - 2rem);
		max-height: calc(100dvh - max(2rem, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
		min-height: 0;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-y;
		overscroll-behavior: contain;
	}

	.popup-left {
		padding: 48px 24px 28px;
		overflow: visible;
		flex-shrink: 0;
	}

	.pl-hours {
		display: none;
	}

	.popup-right {
		overflow: visible;
		min-height: 0;
		padding: 28px 24px max(2rem, env(safe-area-inset-bottom));
		flex: 1 1 auto;
	}

	#popup-form {
		padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
	}

	.pr-submit {
		margin-bottom: 0.35rem;
	}

	.pr-row {
		grid-template-columns: 1fr;
	}

	/* X zawsze nad treścią przy przewijaniu (względem viewport) */
	.popup-close {
		position: fixed;
		top: max(10px, env(safe-area-inset-top));
		right: max(10px, env(safe-area-inset-right));
		z-index: 1001;
		box-shadow: 0 2px 12px rgba(44, 58, 53, 0.2);
		background: rgba(255, 255, 255, 0.95);
	}
}

@media (max-width: 420px) {
	.popup-overlay {
		padding: max(0.5rem, env(safe-area-inset-left)) max(0.5rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom));
		padding-top: max(0.5rem, env(safe-area-inset-top));
	}

	.popup {
		border-radius: 18px;
	}

	.popup-left {
		padding: 44px 18px 22px;
	}

	.popup-right {
		padding: 24px 18px max(1.75rem, env(safe-area-inset-bottom));
	}
}

@keyframes ms-popup-spin {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

.pr-submit .ms-popup-spin {
	animation: ms-popup-spin 0.9s linear infinite;
}
