/*
 * Wspólne kontrolki mapy publicznej i edytora.
 * Arkusz jest ładowany po legacy ol.css/style.css i musi wygrać ze starymi
 * tłami oraz rozmiarami oznaczonymi !important.
 */
#map {
	--iac-tool: 36px;
	--iac-tool-gap: 8px;
	--iac-tool-step: calc(var(--iac-tool) + var(--iac-tool-gap));
}

#map .ol-control,
#map .ol-control .panel {
	box-sizing: border-box;
	border: 1px solid rgba(20, 32, 48, 0.12);
	border-radius: 8px;
	background-color: rgba(255, 255, 255, 0.96) !important;
	background-image: none !important;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 18px rgba(15, 23, 42, 0.12);
	padding: 0;
	color: #243044;
}

#map .ol-control:hover {
	background-color: #ffffff !important;
}

#map .ol-control button {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: var(--iac-tool) !important;
	height: var(--iac-tool) !important;
	margin: 0 !important;
	padding: 0;
	border: 0;
	border-radius: 7px;
	background-color: transparent !important;
	background-image: none !important;
	color: #243044;
	font: 600 16px/1 Arial, sans-serif !important;
	text-shadow: none;
	box-shadow: none;
	float: none !important;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease;
}

#map .ol-control button:hover,
#map .ol-control button:focus-visible {
	background-color: #eef3f8 !important;
	color: #174f78;
	outline: none;
}

#map .ol-zoom {
	top: 12px;
	left: 12px;
	width: var(--iac-tool);
	overflow: hidden;
}

#map .ol-zoom .ol-zoom-in,
#map .ol-zoom .ol-zoom-out {
	border-radius: 0;
}

#map .ol-zoom .ol-zoom-out {
	border-top: 1px solid #e6ebf1;
}

/* Domyślne „dopasuj zasięg” OL zajmowało to samo miejsce co suwak. */
#map .ol-zoom-extent {
	top: 276px;
	left: 12px;
	width: var(--iac-tool);
	height: var(--iac-tool);
}

/* Smukła prowadnica zamiast starego szerokiego, czarnego słupka. */
#map .ol-zoomslider {
	top: 96px;
	left: 12px;
	width: var(--iac-tool);
	height: 168px;
	border-radius: 18px;
	background-color: rgba(255, 255, 255, 0.96) !important;
	background-image: none !important;
	padding: 0;
}

#map .ol-zoomslider::before {
	content: "";
	position: absolute;
	top: 14px;
	bottom: 14px;
	left: 50%;
	width: 4px;
	margin-left: -2px;
	border-radius: 2px;
	background: #c9d3de;
	pointer-events: none;
}

/*
 * W OL6 uchwyt suwaka jest przyciskiem, więc ogólna reguła przycisków
 * robiła go przezroczystym kwadratem 36×36. Tu wraca do widocznej pigułki.
 */
#map .ol-zoomslider button.ol-zoomslider-thumb {
	position: relative;
	z-index: 1;
	display: block;
	width: 24px !important;
	height: 12px !important;
	margin: 0 0 0 5px !important;
	border: 2px solid #ffffff;
	border-radius: 6px;
	background-color: #1f4e79 !important;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
	cursor: grab;
	transition: none;
}

#map .ol-zoomslider button.ol-zoomslider-thumb:hover,
#map .ol-zoomslider button.ol-zoomslider-thumb:focus-visible {
	background-color: #2b6aa3 !important;
}

#map .ol-zoomslider button.ol-zoomslider-thumb:active {
	cursor: grabbing;
}

/* Krzyżak kierunków: cztery przyciski w kole, środek zostaje pusty. */
#map #ol-pan {
	top: 12px;
	left: 58px;
	width: 84px;
	height: 84px;
	border-radius: 50%;
	padding: 0;
	touch-action: none;
	background-color: rgba(255, 255, 255, 0.96) !important;
	background-image: none !important;
}

#map #ol-pan-wrapper {
	position: relative;
	width: 100%;
	height: 100%;
}

#map #ol-pan-wrapper::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 6px;
	height: 6px;
	margin: -3px 0 0 -3px;
	border-radius: 50%;
	background: #c9d3de;
	pointer-events: none;
}

#map #ol-pan button.move_arrow {
	position: absolute;
	display: block;
	width: 28px !important;
	height: 28px !important;
	margin: 0 !important;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent !important;
	color: #243044;
	cursor: pointer;
	touch-action: none;
}

#map #ol-pan button.move_arrow:hover,
#map #ol-pan button.move_arrow:focus-visible {
	background-color: #e6eef6 !important;
	color: #174f78;
}

#map #ol-pan button.move_arrow:active {
	background-color: #d6e3f0 !important;
}

#map #ol-pan button.move_arrow::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	margin: -5px 0 0 -4px;
	border-right: 2.5px solid currentColor;
	border-bottom: 2.5px solid currentColor;
}

#map #ol-pan #move-up::before {
	margin-top: -2px;
	transform: rotate(-135deg);
}

#map #ol-pan #move-down::before {
	margin-top: -7px;
	transform: rotate(45deg);
}

#map #ol-pan #move-left::before {
	margin-left: -2px;
	transform: rotate(135deg);
}

#map #ol-pan #move-right::before {
	margin-left: -6px;
	transform: rotate(-45deg);
}

#map #ol-pan #move-up {
	top: 4px;
	left: 28px;
}

#map #ol-pan #move-down {
	bottom: 4px;
	left: 28px;
}

#map #ol-pan #move-left {
	top: 28px;
	left: 4px;
}

#map #ol-pan #move-right {
	top: 28px;
	right: 4px;
}

#map .ol-full-screen,
#map .ResetAngle,
#map .ShowHideLegend,
#map .InfoIcon,
#map .layer-switcher,
#map .TooltipHoverControl {
	top: 12px;
	left: auto;
	width: var(--iac-tool);
	height: var(--iac-tool);
	padding: 0;
}

#map .ol-full-screen {
	right: 12px;
}

#map .ResetAngle {
	right: calc(12px + var(--iac-tool-step));
}

#map .ShowHideLegend {
	right: calc(12px + (var(--iac-tool-step) * 2));
}

#map .InfoIcon {
	right: calc(12px + (var(--iac-tool-step) * 3));
}

#map .layer-switcher {
	right: calc(12px + (var(--iac-tool-step) * 4));
	overflow: visible;
	text-align: center;
}

/* Podgląd po najechaniu jest tylko w edytorze IAC — szósty przycisk tego samego rzędu. */
#map .TooltipHoverControl {
	right: calc(12px + (var(--iac-tool-step) * 5));
}

#map .TooltipHoverControl button.fa {
	font-family: FontAwesome, sans-serif !important;
	font-weight: 400 !important;
	font-style: normal !important;
	font-size: 16px !important;
	line-height: 1 !important;
}

#map .TooltipHoverControl.tooltip_hover_active button,
#map .TooltipHoverControl.tooltip_hover_active button:hover,
#map .TooltipHoverControl.tooltip_hover_active button:focus-visible {
	background-color: #1f4e79 !important;
	color: #ffffff !important;
}

#map .layer-switcher button {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23243044' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5Z'/%3E%3Cpath d='m3 12 9 5 9-5'/%3E%3Cpath d='m3 16 9 5 9-5'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
	background-size: 16px 16px !important;
}

#map .layer-switcher.shown {
	width: auto;
	height: auto;
	background: transparent !important;
	border-color: transparent;
	box-shadow: none;
}

#map .layer-switcher .panel {
	position: absolute;
	top: calc(var(--iac-tool) + 8px);
	right: 0;
	width: 220px;
	padding: 8px 10px 8px 8px;
	background-color: #ffffff !important;
	background-image: none !important;
	color: #243044;
}

/* Przycisk R resetuje kąt. Kompas OL dublował go i rozpychał rząd na dwa. */
#map .ol-rotate {
	display: none !important;
}

/* Przycisk minimapy zostaje przy niej, w tym samym kształcie co reszta narzędzi. */
#map .ShowHideMinimap {
	top: auto;
	left: 12px;
	bottom: 56px;
	width: var(--iac-tool);
	height: var(--iac-tool);
	padding: 0;
}

#map .ol-scale-line {
	border-radius: 7px;
	background-color: rgba(23, 32, 51, 0.72) !important;
	background-image: none !important;
	padding: 3px 6px;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
}

@media (max-width: 640px), (pointer: coarse) {
	#map {
		--iac-tool: 40px;
		--iac-tool-gap: 8px;
	}

	#map .ol-zoomslider {
		top: 104px;
		left: 12px;
		height: 136px;
	}

	#map .ol-zoomslider button.ol-zoomslider-thumb {
		width: 28px !important;
		height: 14px !important;
		margin-left: 6px !important;
	}

	#map .ol-zoom-extent {
		top: 252px;
		left: 12px;
	}

	#map #ol-pan {
		left: 62px;
		width: 96px;
		height: 96px;
	}

	#map #ol-pan button.move_arrow {
		width: 32px !important;
		height: 32px !important;
	}

	#map #ol-pan #move-up,
	#map #ol-pan #move-down {
		left: 32px;
	}

	#map #ol-pan #move-left,
	#map #ol-pan #move-right {
		top: 32px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#map .ol-control button,
	#map #ol-pan .move_arrow {
		transition: none;
	}
}
