/*
 * Cennik — Szpital Pucki
 *
 * Standardowe tabele Gutenberga są stylowane wyłącznie wewnątrz tego bloku.
 * Dzięki temu kopiowanie Excel → Gutenberg pozostaje całkowicie standardowe.
 */

.wp-block-szpitalpucki-cennik.sp-price-list {
	width: 100%;
	margin: 36px 0 70px;
	color: var(--ink, #0B304C);
}

.sp-price-list__layout {
	display: grid;
	grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
	gap: clamp(42px, 6vw, 78px);
	align-items: start;
}

.sp-price-list__nav-wrap {
	position: sticky;
	top: 24px;
	align-self: start;
	min-width: 0;
	height: max-content;
}

.sp-price-list__nav {
	position: static;
	padding: 20px 26px;
	border: 1px solid var(--line, #D8DFE6);
	background: var(--paper-deep, #EEF2F6);
}

.sp-price-list__nav-link {
	display: block;
	padding: 17px 0;
	border-bottom: 1px solid var(--line, #D8DFE6);
	font-family: "Inter", sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.35;
	color: var(--ink-soft, #3A556B);
	text-decoration: none;
	transition: color .18s ease, padding-left .18s ease;
}

.sp-price-list__nav-link:first-child {
	padding-top: 4px;
}

.sp-price-list__nav-link:last-child {
	padding-bottom: 4px;
	border-bottom: 0;
}

.sp-price-list__nav-link:hover,
.sp-price-list__nav-link:focus,
.sp-price-list__nav-link.is-active {
	color: var(--ink, #0B304C);
}

.sp-price-list__nav-link.is-active {
	font-weight: 600;
}

.sp-price-list__sections {
	min-width: 0;
}

.sp-price-section {
	scroll-margin-top: 24px;
	margin: 0 0 58px;
}

.sp-price-section:last-child {
	margin-bottom: 0;
}

.sp-price-section__header {
	display: grid;
	grid-template-columns: 44px minmax(0, auto) minmax(24px, 1fr);
	align-items: center;
	column-gap: 14px;
	margin: 0 0 18px;
}

.sp-price-section__icon {
	display: inline-flex;
	width: 44px;
	height: 44px;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--paper-deep, #EEF2F6);
	color: var(--terra, #166299);
	font-size: 20px;
}

.sp-price-section__heading {
	min-width: 0;
}

.sp-price-section__eyebrow {
	display: block;
	margin: 0 0 4px;
	font-family: "JetBrains Mono", monospace;
	font-size: 10px;
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--fog, #8597A6);
}

.sp-price-section__title {
	min-width: 0;
	margin: 0;
	font-family: "Inter", sans-serif;
	font-size: clamp(22px, 2.2vw, 28px);
	font-weight: 600;
	line-height: 1.18;
	letter-spacing: -.025em;
	color: var(--ink, #0B304C);
	overflow-wrap: anywhere;
}

.sp-price-section__line {
	width: 100%;
	height: 1px;
	min-width: 24px;
	background: var(--line, #D8DFE6);
}

.sp-price-section__content {
	min-width: 0;
}

/* --------------------------------------------------------------
 * Standardowa tabela Gutenberga — wyłącznie w Cenniku.
 * -------------------------------------------------------------- */
.sp-price-section .wp-block-table {
	width: 100%;
	margin: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.sp-price-section .wp-block-table table {
	width: 100%;
	min-width: 640px;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	background: transparent;
	font-family: "Inter", sans-serif;
	color: var(--ink, #0B304C);
}

.sp-price-section .wp-block-table th,
.sp-price-section .wp-block-table td {
	height: auto;
	padding: 15px 10px;
	border: 0;
	border-bottom: 1px solid var(--line, #D8DFE6);
	background: transparent;
	vertical-align: top;
	text-align: left;
	font-size: 15px;
	line-height: 1.45;
}

.sp-price-section .wp-block-table th:first-child,
.sp-price-section .wp-block-table td:first-child {
	width: 42px;
	padding-left: 2px;
	padding-right: 8px;
	color: var(--fog, #8597A6);
	font-family: "JetBrains Mono", monospace;
	font-size: 12px;
	font-weight: 400;
	text-align: left;
}

.sp-price-section .wp-block-table th:last-child,
.sp-price-section .wp-block-table td:last-child {
	width: 170px;
	padding-right: 2px;
	text-align: right;
	white-space: nowrap;
}

.sp-price-section .wp-block-table tbody td:last-child {
	font-size: 16px;
	font-weight: 600;
	color: var(--ink, #0B304C);
}

/* Nagłówek ustawiony normalnie w bloku Tabela. */
.sp-price-section .wp-block-table thead th {
	padding-top: 8px;
	padding-bottom: 12px;
	font-family: "JetBrains Mono", monospace;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--fog, #8597A6);
}

/*
 * Przy wklejeniu prosto z Excela Gutenberg może potraktować pierwszy wiersz
 * jako zwykły tbody. Jeśli tabela nie ma <thead>, pierwszy wiersz dostaje
 * wygląd nagłówka automatycznie.
 */
.sp-price-section .wp-block-table table:not(:has(thead)) tbody > tr:first-child > td {
	padding-top: 8px;
	padding-bottom: 12px;
	font-family: "JetBrains Mono", monospace;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--fog, #8597A6);
}

.sp-price-section .wp-block-table table:not(:has(thead)) tbody > tr:first-child > td:last-child {
	font-size: 10px;
	font-weight: 500;
}

/* Wyłączamy standardowe paskowanie/obramowania wariantów WordPressa. */
.sp-price-section .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: transparent;
}

.sp-price-section .wp-block-table.is-style-stripes {
	border-bottom: 0;
}

/* Tekst, przypisy i pozostałe bloki wewnątrz działu. */
.sp-price-section__content > :first-child {
	margin-top: 0;
}

.sp-price-section__content > :last-child {
	margin-bottom: 0;
}

.sp-price-section__content p {
	max-width: 820px;
	line-height: 1.65;
}

/* Podgląd w Gutenbergu. */
.sp-price-list-editor__help {
	margin-bottom: 18px;
	padding: 14px 16px;
	border-left: 3px solid var(--terra, #166299);
	background: var(--paper-deep, #EEF2F6);
}

.sp-price-list-editor__help p {
	margin: 5px 0 0;
	font-size: 13px;
}

.sp-price-list__empty {
	padding: 18px;
	border: 1px dashed var(--line, #D8DFE6);
	background: var(--paper, #F8F9FA);
}

/* --------------------------------------------------------------
 * Tablet / mobile.
 * -------------------------------------------------------------- */
@media (max-width: 900px) {
	.sp-price-list__layout {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.sp-price-list__nav-wrap {
		position: sticky;
		top: 0;
		z-index: 8;
		height: auto;
		margin-left: -12px;
		margin-right: -12px;
		padding: 8px 12px;
		background: var(--paper, #F8F9FA);
	}

	.sp-price-list__nav {
		position: static;
		display: flex;
		gap: 0;
		overflow-x: auto;
		padding: 0;
		border: 1px solid var(--line, #D8DFE6);
		background: var(--paper-deep, #EEF2F6);
		scrollbar-width: thin;
	}

	.sp-price-list__nav-link,
	.sp-price-list__nav-link:first-child,
	.sp-price-list__nav-link:last-child {
		flex: 0 0 auto;
		padding: 12px 16px;
		border: 0;
		border-right: 1px solid var(--line, #D8DFE6);
		white-space: nowrap;
		font-size: 14px;
	}

	.sp-price-list__nav-link:last-child {
		border-right: 0;
	}

	.sp-price-section {
		scroll-margin-top: 82px;
	}
}

@media (max-width: 620px) {
	.wp-block-szpitalpucki-cennik.sp-price-list {
		margin-top: 24px;
		margin-bottom: 48px;
	}

	.sp-price-section {
		margin-bottom: 44px;
	}

	.sp-price-section__header {
		grid-template-columns: 40px minmax(0, 1fr);
		column-gap: 10px;
	}

	.sp-price-section__icon {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}

	.sp-price-section__line {
		display: none;
	}

	.sp-price-section__eyebrow {
		font-size: 9px;
		margin-bottom: 3px;
	}

	.sp-price-section__title {
		font-size: 21px;
	}

	.sp-price-section .wp-block-table th,
	.sp-price-section .wp-block-table td {
		padding-top: 13px;
		padding-bottom: 13px;
		font-size: 14px;
	}
}

/* --------------------------------------------------------------
 * Mobile: tabela ma mieścić LP + nazwę + cenę bez scrollowania w bok.
 * Nazwa świadczenia może się swobodnie zawijać.
 * -------------------------------------------------------------- */
@media (max-width: 620px) {
	.sp-price-section .wp-block-table {
		overflow-x: visible;
	}

	.sp-price-section .wp-block-table table {
		width: 100%;
		min-width: 0;
		table-layout: auto;
	}

	.sp-price-section .wp-block-table th,
	.sp-price-section .wp-block-table td {
		padding-left: 5px;
		padding-right: 5px;
	}

	.sp-price-section .wp-block-table th:first-child,
	.sp-price-section .wp-block-table td:first-child {
		width: 26px;
		min-width: 26px;
		padding-left: 0;
		padding-right: 4px;
		font-size: 10.5px;
	}

	.sp-price-section .wp-block-table th:nth-child(2),
	.sp-price-section .wp-block-table td:nth-child(2) {
		width: auto;
		min-width: 0;
		white-space: normal;
		overflow-wrap: anywhere;
		word-break: normal;
		hyphens: auto;
	}

	.sp-price-section .wp-block-table th:last-child,
	.sp-price-section .wp-block-table td:last-child {
		width: 94px;
		min-width: 94px;
		padding-left: 4px;
		padding-right: 0;
		white-space: nowrap;
	}

	.sp-price-section .wp-block-table tbody td:last-child {
		font-size: 13px;
		line-height: 1.35;
	}

	.sp-price-section .wp-block-table thead th:last-child,
	.sp-price-section .wp-block-table table:not(:has(thead)) tbody > tr:first-child > td:last-child {
		font-size: 9px;
	}
}



/* ==============================================================
 * Nawigacja Cennika.
 * ============================================================== */

/* Długa lista na desktopie pozostaje sticky, ale nigdy nie wypada poza ekran. */
@media (min-width: 901px) {
	.sp-price-list__nav-wrap {
		position: sticky;
		top: 24px;
		align-self: start;
		max-height: calc(100vh - 48px);
		overflow: hidden;
	}

	.sp-price-list__nav {
		max-height: calc(100vh - 48px);
		overflow-y: auto;
		overflow-x: hidden;
		scrollbar-width: thin;
		scrollbar-color: var(--line, #D8DFE6) transparent;
	}

	.sp-price-list__nav::-webkit-scrollbar {
		width: 6px;
	}

	.sp-price-list__nav::-webkit-scrollbar-track {
		background: transparent;
	}

	.sp-price-list__nav::-webkit-scrollbar-thumb {
		border-radius: 999px;
		background: var(--line, #D8DFE6);
	}
}

/*
 * Telefon/tablet: bez poziomego przewijania.
 * Przy wielu działach menu ma dwie kolumny i własny pionowy scroll,
 * więc sticky nawigacja nie zajmuje całego ekranu.
 */
@media (max-width: 900px) {
	.sp-price-list__nav-wrap {
		position: sticky;
		top: 0;
		z-index: 20;
		margin-left: -12px;
		margin-right: -12px;
		padding: 8px 12px;
		background: var(--paper, #F8F9FA);
	}

	.sp-price-list__nav {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0;
		max-height: min(34vh, 210px);
		overflow-x: hidden;
		overflow-y: auto;
		padding: 0;
		border: 1px solid var(--line, #D8DFE6);
		background: var(--paper-deep, #EEF2F6);
		scrollbar-width: thin;
	}

	.sp-price-list__nav-link,
	.sp-price-list__nav-link:first-child,
	.sp-price-list__nav-link:last-child {
		min-width: 0;
		padding: 11px 13px;
		border: 0;
		border-right: 1px solid var(--line, #D8DFE6);
		border-bottom: 1px solid var(--line, #D8DFE6);
		white-space: normal;
		overflow-wrap: anywhere;
		font-size: 13.5px;
		line-height: 1.28;
	}

	.sp-price-list__nav-link:nth-child(even) {
		border-right: 0;
	}

	.sp-price-list__nav-link.is-active {
		background: rgba(255,255,255,.55);
	}
}

@media (max-width: 430px) {
	.sp-price-list__nav-link,
	.sp-price-list__nav-link:first-child,
	.sp-price-list__nav-link:last-child {
		padding: 10px 10px;
		font-size: 12.5px;
	}
}

/* --------------------------------------------------------------
 * Mobile: kompaktowy sticky wybór działu zamiast długiej listy.
 * -------------------------------------------------------------- */
.sp-price-list__mobile-nav {
	display: none;
}

@media (max-width: 900px) {
	.sp-price-list__mobile-nav {
		position: sticky;
		top: 0;
		z-index: 30;
		display: grid;
		grid-template-columns: 38px minmax(0, 1fr) 34px;
		align-items: center;
		width: 100%;
		min-height: 58px;
		margin: 0 0 28px;
		border: 1px solid var(--line, #D8DFE6);
		background: var(--paper-deep, #EEF2F6);
		box-shadow: 0 6px 12px rgba(11,48,76,.04);
	}

	.sp-price-list__mobile-nav-icon,
	.sp-price-list__mobile-nav-chevron {
		display: flex;
		align-items: center;
		justify-content: center;
		color: var(--terra, #166299);
		font-size: 18px;
		pointer-events: none;
	}

	.sp-price-list__mobile-nav-chevron {
		color: var(--fog, #8597A6);
		font-size: 16px;
	}

	.sp-price-list__mobile-select {
		width: 100%;
		height: 56px;
		padding: 0 10px;
		border: 0;
		outline: 0;
		background: transparent;
		appearance: none;
		-webkit-appearance: none;
		font-family: "Inter", sans-serif;
		font-size: 16px;
		font-weight: 600;
		line-height: 1.2;
		color: var(--ink, #0B304C);
		cursor: pointer;
	}

	.sp-price-list__mobile-select:focus {
		box-shadow: inset 0 0 0 2px var(--terra, #166299);
	}

	/* Na mobile desktopowa lista znika całkowicie. */
	.sp-price-list__nav-wrap {
		display: none;
	}

	.sp-price-list__layout {
		display: block;
	}

	.sp-price-section {
		scroll-margin-top: 76px;
	}
}

@media (max-width: 620px) {
	.sp-price-list__mobile-nav {
		min-height: 56px;
		margin-bottom: 24px;
	}

	.sp-price-list__mobile-select {
		height: 54px;
		font-size: 15px;
	}
}

