/* ============================================
   Block: PLAN BUDYNKU
   ============================================ */

.block--plan-budynku {
	position: relative;
	background: #ebeff3;
	color: #223248;
	padding: clamp(72px, 8vw, 124px) 0 clamp(88px, 10vw, 132px);
	overflow: hidden;
}

.plan-budynku__inner {
	position: relative;
	z-index: 1;
	width: min(100%, var(--width));
	margin: 0 auto;
	padding: 0 var(--frame-padding-inline);
	box-sizing: border-box;
	display: grid;
	gap: clamp(28px, 3.6vw, 42px);
}

/* ============================================
   Heading (spójny z lista_apartamentow)
   ============================================ */

.plan-budynku__heading {
	display: grid;
	gap: 10px;
}

.plan-budynku__number {
	margin: 0;
	font-family: var(--font-family-display);
	font-size: 32px;
	font-weight: 400;
	line-height: 1;
	color: #b76b34;
}

.plan-budynku__title {
	margin: 0;
	width: 100%;
	max-width: 100%;
	font-family: var(--font-family-display);
	font-size: clamp(34px, 3.8vw, 48px);
	font-weight: 300;
	line-height: 0.95;
	letter-spacing: -0.04em;
	text-transform: uppercase;
	color: #334d76;
	text-wrap: pretty;
	text-align: left;
	text-box-trim: trim-both;
	text-box-edge: cap alphabetic;
	word-break: normal;
	overflow-wrap: normal;
}

.plan-budynku__separator {
	width: 100%;
	height: 1px;
	margin-top: clamp(18px, 2vw, 26px);
	background: rgba(38, 54, 77, 0.18);
}

.plan-budynku__intro {
	font-family: var(--font-family-body);
	font-size: var(--fs-base);
	line-height: 1.6;
	color: #223248;
	max-width: 680px;
	opacity: 0.75;
}

/* ============================================
   Toolbar: select + legend
   ============================================ */

.plan-budynku__map-wrapper {
	display: grid;
	gap: 0;
}

.plan-budynku__toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 24px;
	padding: 20px 0 0;
	margin-bottom: 20px;
}

.plan-budynku__floor-select-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.plan-budynku__floor-select-wrap {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Native select — visually hidden, kept for form logic */
.plan-budynku__floor-select {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 0;
	height: 0;
}

/* Custom trigger button */
.plan-budynku__custom-select-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 46px;
	padding: 0 20px 0 24px;
	border: 1px solid rgba(38, 54, 77, 0.22);
	border-radius: 100px;
	background: transparent;
	font-family: var(--font-family-body-accent);
	font-size: 16px;
	font-weight: 500;
	color: #223248;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	min-width: 160px;
	white-space: nowrap;
}

.plan-budynku__custom-select-trigger:hover {
	border-color: rgba(38, 54, 77, 0.4);
}

.plan-budynku__custom-select-trigger:focus-visible,
.plan-budynku__custom-select-trigger.is-open {
	outline: none;
	border-color: #b76b34;
	box-shadow: 0 0 0 3px rgba(183, 107, 52, 0.15);
}

.plan-budynku__custom-select-value {
	flex: 1;
	text-align: left;
	line-height: 1;
}

.plan-budynku__custom-select-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.is-open .plan-budynku__custom-select-arrow {
	transform: rotate(180deg);
}

/* Dropdown panel */
.plan-budynku__custom-select-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	min-width: 100%;
	background: #fff;
	border: 1px solid rgba(38, 54, 77, 0.12);
	border-radius: 16px;
	padding: 0;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
	z-index: 50;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.plan-budynku__custom-select-dropdown[hidden] {
	display: none;
}

/* Dropdown options */
.plan-budynku__custom-select-option {
	display: block;
	width: 100%;
	padding: 8px 16px;
	border: none;
	border-radius: 100px;
	background: transparent;
	font-family: var(--font-family-body-accent);
	font-size: 15px;
	font-weight: 500;
	color: #223248;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
	line-height: 1.3;
}

.plan-budynku__custom-select-option:hover,
.plan-budynku__custom-select-option:focus-visible {
	background: #334d76;
	color: #fff;
	outline: none;
}

.plan-budynku__custom-select-option.is-selected {
	background: #334d76;
	color: #fff;
}

/* ---- Legend ---- */

.plan-budynku__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	align-items: center;
	flex-shrink: 0;
}

.plan-budynku__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-family-body-accent);
	font-size: 18px;
	color: #26364D;
	line-height: 1;
}

.plan-budynku__legend-dot {
	display: inline-block;
	width: 40px;
	height: 40px;
	border-radius: 100px;
	flex-shrink: 0;
	border: 1px solid #26364D
}

.plan-budynku__legend-dot--available {
	background: #ADE6A6;
}

.plan-budynku__legend-dot--reserved {
	background: #F8F1A6;
}

.plan-budynku__legend-dot--taken {
	background: #DEC1B3;
}

/* ============================================
   Floor panels
   ============================================ */

.plan-budynku__floors {
	position: relative;
}

.plan-budynku__floor {
	display: none;
}

.plan-budynku__floor.is-active {
	display: block;
}

.plan-budynku__svg-wrap {
	width: 100%;
	max-width: 100%;
	line-height: 0;
}

.plan-budynku__svg-wrap--zoomed {
	overflow: scroll;
	-webkit-overflow-scrolling: touch;
	touch-action: auto;
	cursor: grab;
}

.plan-budynku__svg-wrap--zoomed:active {
	cursor: grabbing;
}

.plan-budynku__svg-wrap svg,
.plan-budynku__svg-wrap object {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	user-select: none;
}

/* SVG interactive elements (inline SVG fallback) */
.plan-budynku__svg-wrap svg [data-id] {
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.15s ease;
}

.plan-budynku__svg-wrap svg [data-id]:hover {
	opacity: 0.75;
}

.plan-budynku__no-svg {
	text-align: center;
	padding: 60px 20px;
	color: #223248;
	opacity: 0.5;
	font-family: var(--font-family-body);
	font-size: var(--fs-base);
}

/* ============================================
   Tooltip
   ============================================ */

.plan-budynku__tooltip {
	position: fixed;
	z-index: 100;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.18s ease, visibility 0.18s ease;
}

.plan-budynku__tooltip.is-visible {
	opacity: 1;
	visibility: visible;
}

.plan-budynku__tooltip-body {
	background: #223248;
	color: #fff;
	padding: 10px 16px;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	font-family: var(--font-family-body-accent);
	font-size: 14px;
	line-height: 1.4;
	min-width: 140px;
	text-align: center;
}

.plan-budynku__tooltip-name {
	margin: 0;
	font-weight: 600;
	font-size: 15px;
}

.plan-budynku__tooltip-area {
	margin: 2px 0 0;
	opacity: 0.8;
	font-size: 13px;
}

.plan-budynku__tooltip-arrow {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 6px solid #223248;
}

/* ============================================
   Modal
   ============================================ */

.plan-budynku__modal {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.plan-budynku__modal.is-open {
	opacity: 1;
	visibility: visible;
}

.plan-budynku__modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
}

.plan-budynku__modal-dialog {
	position: relative;
	width: min(90vw, 1200px);
	max-height: 85vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 12px;
	padding: 36px 32px 32px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	transform: translateY(12px) scale(0.97);
	transition: transform 0.25s ease;
	z-index: 1;
}

.is-open .plan-budynku__modal-dialog {
	transform: translateY(0) scale(1);
}

.plan-budynku__modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.06);
	color: #223248;
	font-size: 18px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s ease;
	z-index: 2;
}

.plan-budynku__modal-close:hover,
.plan-budynku__modal-close:focus-visible {
	background: rgba(0, 0, 0, 0.12);
	outline: none;
}

.plan-budynku__modal-title {
	font-family: var(--font-family-display);
	font-size: 24px;
	font-weight: 500;
	color: #223248;
	margin: 0 0 6px;
	padding-right: 40px;
}

.plan-budynku__modal-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 20px;
}

.plan-budynku__modal-meta > span {
	display: inline-flex;
	align-items: center;
	padding: 6px 16px;
	border-radius: 100px;
	background: rgba(38, 54, 77, 0.07);
	font-family: var(--font-family-display);
	font-size: 15px;
	font-weight: 400;
	color: #223248;
	line-height: 1.3;
	white-space: nowrap;
}

.plan-budynku__modal-meta strong {
	font-weight: 500;
}

.plan-budynku__modal-pdf {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	border-radius: 8px;
}

.plan-budynku__modal-pdf-page {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	border-radius: 6px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	touch-action: pan-x pan-y;
	transition: transform 0.2s ease;
	transform-origin: 0 0;
	cursor: zoom-in;
}

.plan-budynku__modal-pdf-page--zoomed {
	touch-action: auto;
	cursor: grab;
	transition: none;
}

.plan-budynku__modal-pdf-page--zoomed:active {
	cursor: grabbing;
}

.plan-budynku__modal-pdf-loading,
.plan-budynku__modal-pdf-error {
	padding: 40px 20px;
	text-align: center;
	font-family: var(--font-family-body);
	font-size: 15px;
	color: #223248;
	opacity: 0.5;
	width: 100%;
}

/* ---- Modal actions ---- */

.plan-budynku__modal-actions {
	display: flex;
	justify-content: flex-end;
	padding-top: 20px;
}

.plan-budynku__modal-btn--reserve {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 28px;
	border: none;
	border-radius: 100px;
	background: #b76b34;
	color: #fff;
	font-family: var(--font-family-body-accent);
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.plan-budynku__modal-btn--reserve:hover,
.plan-budynku__modal-btn--reserve:focus-visible {
	background: #a05d2c;
	color: #fff;
	outline: none;
}

/* ---- Modal data table ---- */

.plan-budynku__modal-table {
	margin-bottom: 20px;
}

.plan-budynku__modal-table__table {
	width: 100%;
	border-collapse: collapse;
	font-family: var(--font-family-body-accent);
	font-size: 15px;
}

.plan-budynku__modal-table__table tr {
	border-bottom: 1px solid rgba(38, 54, 77, 0.1);
}

.plan-budynku__modal-table__table tr:last-child {
	border-bottom: none;
}

.plan-budynku__modal-table__table td {
	padding: 10px 12px;
	vertical-align: middle;
}

.plan-budynku__modal-table__label {
	font-weight: 500;
	color: #223248;
	opacity: 0.6;
	width: 40%;
	white-space: nowrap;
}

.plan-budynku__modal-table__value {
	font-weight: 500;
	color: #223248;
	text-align: right;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1099px) {
	.plan-budynku__toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
	}

	.plan-budynku__legend {
		justify-content: flex-start;
	}
}

@media (max-width: 767px) {
	.plan-budynku__heading {
		gap: 6px;
	}

	.plan-budynku__title {
		font-size: clamp(24px, 6vw, 34px);
	}

	.plan-budynku__custom-select-trigger {
		width: 100%;
		min-width: 0;
	}

	.plan-budynku__custom-select-dropdown {
		min-width: 100%;
	}

	.plan-budynku__legend-item {
		font-size: 12px;
		gap: 6px;
	}

	.plan-budynku__legend-dot {
		width: 24px;
		height: 24px;
	}

	.plan-budynku__svg-object {
		max-height: 60vh;
	}

	.plan-budynku__modal-dialog {
		width: 100vw;
		max-width: 100vw;
		height: 100vh;
		max-height: 100vh;
		border-radius: 0;
		padding: 24px 16px 60px;
		overflow-y: auto;
	}

	.plan-budynku__modal-pdf {
		gap: 10px;
	}
}

@media (max-width: 480px) {
	.plan-budynku__legend {
		gap: 10px;
	}

	.plan-budynku__legend-item {
		font-size: 11px;
	}

	.plan-budynku__legend-dot {
		width: 20px;
		height: 20px;
	}
}
