/* =====================================================================
 * Blok mapy — układ dwukolumnowy: mapa (lewo) + sidebar z listą (prawo)
 * ===================================================================== */
.gm-map-block {
	/* Desktop: pełna dostępna szerokość (bez ograniczenia). */
	margin: 1.5em 0;
	display: flex;
	align-items: stretch;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #dde0e4;
	/* height ustawiane inline przez PHP (data-height) */
}

.gm-map {
	flex: 1 1 0%;
	min-width: 0;
	min-height: 200px;
	z-index: 0;
}

.gm-map-block--empty {
	display: block;
	padding: 24px;
	text-align: center;
	background: #f3f4f5;
	border: 1px dashed #c3c4c7;
	border-radius: 8px;
	color: #50575e;
}

/* =====================================================================
 * Sidebar — lista nawigacyjna obiektów (klik przenosi na marker)
 * ===================================================================== */
.gm-sidebar {
	flex: 0 0 270px;
	min-width: 0;
	overflow-y: auto;
	background: #fff;
	border-left: 1px solid #dde0e4;
}

.gm-sidebar:empty {
	display: none;
}

.gm-sidebar-item {
	padding: 10px 14px;
	border-bottom: 1px solid #f0f0f0;
	cursor: pointer;
	transition: background 0.12s;
}

.gm-sidebar-item:last-child {
	border-bottom: 0;
}

.gm-sidebar-item:hover {
	background: #f6f7fb;
}

.gm-sidebar-item--active {
	background: #eef1fb;
}

.gm-sidebar-item__title {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	display: flex;
	align-items: center;
	gap: 7px;
}

.gm-sidebar-item__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	color: #fff;
}

/* Wielokąt w sidebarze — kwadrat z zaokrąglonymi rogami */
.gm-sidebar-item__dot--polygon {
	border-radius: 3px;
	opacity: 0.85;
}

.gm-sidebar-item__dot .dashicons {
	width: 12px;
	height: 12px;
	font-size: 12px;
}

.gm-sidebar-item__dot i {
	font-size: 10px;
}

/* =====================================================================
 * Panel szczegółów — pojawia się pod mapą po kliknięciu markera
 * ===================================================================== */
.gm-map-detail {
	display: none;
	margin: 0 0 1.5em;
	border: 1px solid #dde0e4;
	border-top: 0;
	border-radius: 0 0 8px 8px;
	background: #fff;
	overflow: hidden;
}

.gm-map-detail--visible {
	display: block;
}

.gm-map-detail__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px 10px;
	border-bottom: 1px solid #eee;
	background: #f8f9fb;
}

.gm-map-detail__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	color: #fff;
}

.gm-map-detail__dot--polygon {
	border-radius: 4px;
	opacity: 0.85;
}

.gm-map-detail__dot .dashicons {
	width: 15px;
	height: 15px;
	font-size: 15px;
}

.gm-map-detail__dot i {
	font-size: 13px;
}

.gm-map-detail__heading {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.gm-map-detail__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.gm-map-detail__year {
	font-size: 12px;
	color: #666;
	line-height: 1.2;
}

.gm-map-detail__body {
	padding: 14px 16px;
	font-size: 14px;
	line-height: 1.65;
	color: #2a2a2a;
}

.gm-map-detail__body img,
.gm-map-detail__body video,
.gm-map-detail__body iframe {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
	margin-top: 6px;
}

.gm-map-detail__body > *:first-child {
	margin-top: 0;
}

.gm-map-detail__body > *:last-child {
	margin-bottom: 0;
}

/* =====================================================================
 * Modal opisu obiektu — pojawia się po kliknięciu markera
 * ===================================================================== */
.gm-map-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba( 0, 0, 0, 0.55 );
}

.gm-map-modal--open {
	display: flex;
}

body.gm-map-modal-lock {
	overflow: hidden;
}

.gm-map-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.3 );
	overflow: hidden;
}

.gm-map-modal__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.92 );
	color: #333;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.2 );
}

.gm-map-modal__close:hover {
	background: #fff;
	color: #000;
}

.gm-map-modal__content {
	overflow-y: auto;
}

/* Zostaw miejsce na krzyżyk w nagłówku opisu. */
.gm-map-modal__content .gm-map-detail__header {
	padding-right: 50px;
}

/* ---------------------------------------------------------------------
 * Animacja otwierania modala (display: none ↔ flex, więc @keyframes).
 * --------------------------------------------------------------------- */
@keyframes gmModalBg {
	from { background: rgba( 0, 0, 0, 0 ); }
	to   { background: rgba( 0, 0, 0, 0.55 ); }
}

@keyframes gmModalIn {
	from { opacity: 0; transform: translateY( 16px ) scale( 0.97 ); }
	to   { opacity: 1; transform: translateY( 0 ) scale( 1 ); }
}

.gm-map-modal--open {
	animation: gmModalBg 0.25s ease both;
}

.gm-map-modal--open .gm-map-modal__dialog {
	animation: gmModalIn 0.28s cubic-bezier( 0.22, 1, 0.36, 1 ) both;
}

/* Wariant „--slow”: wolniejszy, łagodniejszy wjazd po dolocie GPS. */
.gm-map-modal--slow.gm-map-modal--open {
	animation-duration: 0.6s;
}

.gm-map-modal--slow.gm-map-modal--open .gm-map-modal__dialog {
	animation-duration: 0.7s;
}

@media ( prefers-reduced-motion: reduce ) {
	.gm-map-modal--open,
	.gm-map-modal--open .gm-map-modal__dialog,
	.gm-map-modal--slow.gm-map-modal--open,
	.gm-map-modal--slow.gm-map-modal--open .gm-map-modal__dialog {
		animation: none;
	}
}

/* =====================================================================
 * Pinezka markera
 * ===================================================================== */
.gm-pin-wrap {
	background: transparent;
	border: 0;
}

.gm-pin {
	width: 30px;
	height: 30px;
	border-radius: 50% 50% 50% 0;
	transform: rotate( -45deg );
	box-shadow: 0 2px 5px rgba( 0, 0, 0, 0.35 );
	border: 2px solid #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gm-pin-glyph {
	transform: rotate( 45deg );
	color: #fff;
	font-size: 15px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gm-pin-glyph .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
}

.gm-pin-glyph i {
	font-size: 14px;
	color: #fff;
	line-height: 1;
}

/* =====================================================================
 * Strzałki kierunku szlaku
 * ===================================================================== */
.gm-arrow {
	background: none !important;
	border: 0 !important;
}

.gm-arrow__i {
	display: block;
	text-align: center;
	text-shadow: 0 0 2px #fff, 0 0 2px #fff;
	pointer-events: none;
}

/* =====================================================================
 * Przycisk GPS / lokalizacja
 * ===================================================================== */
.gm-locate-btn {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 26px !important;
	height: 26px !important;
	color: #333 !important;
	text-decoration: none !important;
	transition: color 0.15s, background 0.15s;
}

.gm-locate-btn svg {
	display: block;
	pointer-events: none;
}

.gm-locate-btn--active {
	color: #1a73e8 !important;
	background: #e8f0fe !important;
}

.gm-locate-btn--error {
	color: #c62828 !important;
	background: #fdecea !important;
}

.gm-error {
	padding: 16px;
	color: #b32d2e;
}

/* =====================================================================
 * Legenda wielu map — kontrolka Leaflet (topright), hover-expandable
 * ===================================================================== */
.gm-map-legend {
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 1px 5px rgba( 0, 0, 0, 0.25 );
	padding: 8px 12px;
	min-width: 140px;
	max-width: 220px;
	cursor: default;
}

.gm-map-legend__title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #666;
	display: flex;
	align-items: center;
	gap: 5px;
}

.gm-map-legend__title::after {
	content: '';
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid #999;
	transform: rotate( -90deg );
	transition: transform 0.15s;
	flex-shrink: 0;
}

.gm-map-legend--open .gm-map-legend__title::after {
	transform: rotate( 0deg );
}

.gm-map-legend__body {
	display: none;
	margin-top: 6px;
	padding-bottom: 2px;
}

.gm-map-legend--open .gm-map-legend__body {
	display: block;
}

.gm-map-legend__row {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 3px 0;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.3;
	color: #1a1a1a;
}

.gm-map-legend__cb {
	flex-shrink: 0;
	cursor: pointer;
	accent-color: #2e7d32;
}

.gm-map-legend__label {
	user-select: none;
}

/* =====================================================================
 * Sidebar — grupy map (tryb multi)
 * ===================================================================== */
.gm-sidebar-group {
	border-bottom: 1px solid #dde0e4;
}

.gm-sidebar-group:last-child {
	border-bottom: 0;
}

.gm-sidebar-group__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 9px 14px;
	cursor: pointer;
	background: #f0f2f7;
	border-bottom: 1px solid transparent;
	font-size: 11px;
	font-weight: 700;
	color: #444;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	user-select: none;
	transition: background 0.12s;
}

.gm-sidebar-group__header:hover {
	background: #e6e9f4;
}

.gm-sidebar-group--open > .gm-sidebar-group__header {
	border-bottom-color: #dde0e4;
}

.gm-sidebar-group__title {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gm-sidebar-group__toggle {
	flex-shrink: 0;
	width: 12px;
	height: 12px;
	position: relative;
	margin-left: 6px;
}

.gm-sidebar-group__toggle::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid #777;
	transform: translate( -50%, -50% ) rotate( -90deg );
	transition: transform 0.15s;
}

.gm-sidebar-group--open > .gm-sidebar-group__header .gm-sidebar-group__toggle::before {
	transform: translate( -50%, -50% ) rotate( 0deg );
}

.gm-sidebar-group__body {
	display: none;
}

.gm-sidebar-group--open > .gm-sidebar-group__body {
	display: block;
}

/* =====================================================================
 * Paywall — blokada mapy (integracja z RSD Membership)
 * ===================================================================== */
.gm-paywall {
	padding: 28px 24px;
	background: #fafbff;
	border: 1px solid #dde0e4;
	border-top: 0;
	border-radius: 0 0 8px 8px;
	text-align: center;
}

.gm-paywall--standalone {
	margin: 1.5em 0;
	border-top: 1px solid #dde0e4;
	border-radius: 8px;
}

.gm-paywall__icon {
	font-size: 40px;
	line-height: 1;
	margin-bottom: 14px;
}

.gm-paywall__teaser {
	font-size: 15px;
	line-height: 1.6;
	color: #2a2a2a;
	margin-bottom: 16px;
}

.gm-paywall__teaser > *:first-child { margin-top: 0; }
.gm-paywall__teaser > *:last-child  { margin-bottom: 0; }

.gm-paywall__login {
	font-size: 13px;
	color: #555;
	margin-bottom: 20px;
}

.gm-paywall__plan {
	max-width: 480px;
	margin: 16px auto 0;
	text-align: left;
	border: 1px solid #dde0e4;
	border-radius: 6px;
	overflow: hidden;
}

.gm-paywall__plan-name {
	margin: 0;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 700;
	background: #f0f2f7;
	border-bottom: 1px solid #dde0e4;
}

.gm-paywall__plan .rsd-membership-form {
	padding: 16px;
	margin: 0;
}

/* Zablokowane obiekty na liście (poza limitem darmowych). */
.gm-sidebar-item--locked {
	opacity: 0.55;
}

.gm-sidebar-item--locked .gm-sidebar-item__title::after {
	content: " \01F512";
	font-size: 0.9em;
}

/* Paywall wyświetlany wewnątrz modala (zamiast nakładki na mapie). */
.gm-paywall-modal .gm-paywall {
	border: 0;
	border-radius: 0;
	background: #fff;
	padding: 28px 24px 24px;
}

/* =====================================================================
 * Responsive
 * ===================================================================== */
@media ( max-width: 640px ) {
	/* Mapa: ta sama szerokość co modal (marginesy boczne = padding modala 12px),
	 * lista obiektów ląduje POD mapą (układ pionowy). */
	.gm-map-block {
		flex-direction: column;
		height: auto !important;
		width: auto;
		margin-left: 12px;
		margin-right: 12px;
	}

	.gm-map {
		height: 70vh !important;
		flex: none;
	}

	.gm-sidebar {
		flex: none;
		border-left: 0;
		border-top: 1px solid #dde0e4;
		max-height: 45vh;
	}

	.gm-map-modal {
		padding: 12px;
	}

	.gm-map-modal__dialog {
		max-height: 88vh;
	}
}
