:root {
	--base-light: #e3ecec;
	--base-medium: #d7e4e4;
	--base-gray: #c8dada;
	--base-gray-dark: #99b8b8;
	--spot: #f5ee65;
	--spot-bright: #fff879;
}

html {
	background: var(--spot);
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: "Roboto", Arial, sans-serif;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

header {
	width: 100%;
	background-color: var(--spot);
	height: 50px;
	z-index: 10;
	transition: position 0.3s ease;
}

/* Header ist immer fixed, da Info-Panel jetzt modal ist */
header {
	position: fixed;
}

header nav {
	position: fixed;
	left: 20px;
	display: flex;
	gap: 6px;
	height: 50px;
}

/* Tabs in header nav: make .tab look like clickable tabs */
header nav .tab {
	margin-top: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 15px 0px 15px;
	border-radius: 8px 8px 0 0;
	background: var(--base-gray);
	color: rgba(0, 0, 0, 0.8);
	border: 1px solid rgba(0, 0, 0, 0);
	border-bottom: none;
	text-decoration: none;
	letter-spacing: 0.03em;
	font-size: 1em;
}

header nav .tab:last-child {
	margin-right: 0;
}

header nav .tab:not(.active) {
	box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.1);
}

header nav .tab:not(.active):hover {
	text-decoration: underline;
	cursor: pointer;
}

/* Active/selected tab - appears raised and white to contrast with the header "spot" background */
header nav .tab.active,
header nav .tab[aria-current="true"] {
	background: var(--base-light);
	color: #000;
	font-weight: 600;
	/* hides the seam to content below */
}

/* Help button */
.help-btn {
	margin-top: 18px;
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: #ffffff;
	border: none;
	color: var(--base-gray-dark);
	font-size: 1.1rem;
	font-weight: bold;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	padding: 0;
	margin-left: 4px;
	box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}

.help-btn:hover {
	background: var(--base-gray-dark);
	color: var(--base-light);
}

/* Make sure tabs remain usable on small screens */
@media screen and (max-width: 420px) {
	header nav {
		left: 10px;
		top: 8px;
		gap: 4px;
	}

	header nav .tab {
		padding: 5px 8px;
		font-size: 0.85rem;
		border-radius: 8px 8px 0 0;
	}
}

header h1 {
	font-size: 1em;
	letter-spacing: 0.05em;
	font-weight: lighter;
	text-transform: uppercase;
	align-self: center;
	margin-top: 7px;
	margin-right: 15px;
}

header h1 span {
	font-weight: bold;
}

#info {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: #fff;
	padding: 30px;
	display: none;
	font-size: 1rem;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	border-radius: 12px;
	z-index: 1001;
	max-width: 600px;
	width: 90%;
	max-height: 80vh;
	overflow-y: auto;
}

/* Modal-Overlay als separates Element */
#info-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 1000;
	display: none;
}

/* Info-Icon im Modal */
#info::before {
	left: 20px;
	content: "i";
	position: absolute;
	right: 15px;
	top: 30px;
	width: 30px;
	height: 30px;
	margin-bottom: 20px;
	margin-top: -10px;
	background-color: var(--spot);
	color: #000;
	font-weight: bold;
	font-size: 0.9rem;
	display: flex;
	align-items: center;
	justify-content: center;
	/* border-radius: 50%; */
	cursor: pointer;
}

/* Schließen-Button */
#info .close-btn {
	position: absolute;
	right: 15px;
	top: 15px;
	width: 24px;
	height: 24px;
	background: none;
	border: none;
	font-size: 18px;
	font-weight: bold;
	color: #666;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background-color 0.1s;
}

#info .close-btn:hover {
	background-color: #f0f0f0;
	color: #000;
}

#info .content {
	margin: 0;
	max-width: none;
	margin-left: 40px;
}

#info h2 {
	font-size: 1.2rem;
	margin-bottom: 8px;
	color: #333;
	font-weight: 600;
}

#info p {
	color: #555;
	margin: 0 0 12px 0;
}

#info a {
	color: var(--base-gray-dark);
	text-decoration: none;
}

#info a:hover {
	text-decoration: underline;
}

.container {
	display: flex;
	flex: 1;
}

/* Container bekommt immer margin-top, da Header immer fixed ist */
.container {
	margin-top: var(--header-height, 60px);
}

.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.sidebar {
	width: 150px;
	min-width: 150px;
	max-width: 150px;
	flex-shrink: 0;
	background-color: var(--base-gray);
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	box-shadow: 0px 0px 1px rgba(0, 0, 0, 1);
	z-index: 1;
}

.logo {
	opacity: 0.6;
	margin: 18px 3px 0px 3px;
}

.logo:nth-child(3) {
	width: 70px;
}

/* Sidebar divider */
.sidebar-divider {
	border: none;
	height: 1px;
	background-color: var(--base-gray-dark);
	margin: 10px 0;
	opacity: 0.6;
}

/* Sidebar download button */
.sidebar-download-btn {
	background: #5f8888;
	color: #e3ecec;
	border: solid 1px #6d8989;
	border-radius: 8px;
	font-size: 0.8rem;
	cursor: pointer;
	padding: 8px 6px;
	text-align: center;
	transition: all 0.2s;
	margin-top: 5px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	line-height: 1.2;
}

.sidebar-download-btn::before {
	content: "";
	width: 18px;
	height: 18px;
	background: url("img/icons/zip.png") no-repeat center;
	background-size: 18px 18px;
	display: block;
}

.sidebar-download-btn:hover {
	background: #466666;
}

/* Sidebar imprint link */
.sidebar-imprint-link {
	display: block;
	text-align: center;
	color: var(--base-gray-dark);
	font-size: 0.75rem;
	margin-top: 10px;
	text-decoration: none;
}

.sidebar-imprint-link:hover {
	color: #000;
}

main {
	flex: 1;
	background-color: #000;
	display: flex;
}

/* Restoration Potentials Layout */
#restoration-potentials {
	background-color: var(--base-light);
	overflow: auto;
	flex: 1;
}

/* Robustness Layout */
#robustness {
	background-color: var(--base-light);
}

.restoration-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	/* Increased gap to match scenario padding feel */
	padding: 40px;
	height: 100%;
	min-height: min-content;
	align-items: start;
}

.grid-cell {
	display: flex;
	flex-direction: column;
}



/* Ensure map controls in restoration grid look like scenario controls */
.restoration-grid .map-controls {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	margin: 0;
	margin-top: -1px;
	/* Overlap border slightly if needed, or just 0 */
}

.restoration-grid .map-tabs {
	display: flex;
	gap: 10px;
}

.restoration-grid .map-tabs button {
	border: none;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	padding: 6px 12px 9px 12px;
	font-size: 0.91em;
	background-color: var(--base-gray);
	box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);
	color: rgba(0, 0, 0, 0.5);
	cursor: pointer;
}

.restoration-grid .map-tabs button.active {
	box-shadow: none;
	background-color: var(--base-medium);
	/* Match figure background */
	color: #000;
	font-weight: normal;
}

.restoration-grid .map-tabs button:hover {
	text-decoration: underline;
}

/* Responsive */
@media (max-width: 1000px) {
	.restoration-grid {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
	}
}

.restoration-grid .figure.map {
	height: 500px;
}


/* Responsive */
@media (max-width: 1000px) {
	.restoration-grid {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
	}
}

.scenario {
	background-color: var(--base-light);
	padding: 40px;
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	border-right: solid 1px var(--base-gray-dark);
	border-left: solid 1px #fff;
	overflow: auto;
	min-width: 550px;
	/* Mindestbreite um Overflow von .settings-selects zu verhindern */
	/* transition entfernt: verhindert Chart-Render-Probleme beim Tab-Wechsel */
}

.figure.map {
	border-bottom-left-radius: 0;
}

/* Map Legend Styles */
.map-legend {
	position: absolute;
	bottom: 10px;
	right: 10px;
	width: auto;
	padding: 10px;
	background-color: rgb(236 246 246 / 85%);
	border: 1px solid #ccc;
	border-radius: 6px;
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.map-legend.cluster-mode {
	align-items: flex-start;
}

.map-legend .legend-labels {
	display: contents;
	/* Makes children behave as direct children of the legend */
}

.map-legend .legend-gradient {
	width: 18px;
	height: 100px;
	background: linear-gradient(to top, #007cdc 0%, #ffea2a 100%);
	border-radius: 2px;
	flex-shrink: 0;
	order: 2;
	/* Place gradient in the middle */
}

/* Robustness Legend 
.robustness-legend {
	padding: 8px;
	background-color: rgba(255, 255, 255, 0.9);
	border: 1px solid #ccc;
	border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
*/
.legend-grid {
	display: grid;
	grid-template-columns: repeat(3, 18px);
	grid-template-rows: repeat(3, 18px);
	gap: 2px;
}

.legend-cell {
	width: 100%;
	height: 100%;
	cursor: help;
	border: none;
	border-radius: 2px;
}

/* Restoration Potential specific gradient */
#map-potential .map-legend .legend-gradient,
#map-condition .map-legend .legend-gradient {
	background: linear-gradient(to top,
			#ffd4c8 0%,
			#dfba91 25%,
			#a39e6b 50%,
			#248c85 75%,
			#00393e 100%);
}

.map-legend .legend-label {
	font-size: 0.75rem;
	color: #333;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
}

.map-legend .legend-label.high,
.map-legend .legend-label.increase {
	order: 1;
	margin-bottom: 2px;
	/* Place at top */
}

.map-legend .legend-label.low,
.map-legend .legend-label.decrease {
	order: 3;
	margin-top: 3px;
	/* Place at bottom */
}

.restoration-content .map-controls,
#scenarios .map-controls {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	margin: 0;
}

.map-tabs {
	display: flex;
	gap: 10px;
}

.restoration-content .map-controls .map-tabs button,
#scenarios .map-controls .map-tabs button {
	border: none;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	padding: 6px 12px 9px 12px;
	font-size: 0.91em;
}

.restoration-content .map-controls .map-tabs button.active,
#scenarios .map-controls .map-tabs button.active {
	box-shadow: none;
	background-color: var(--base-medium);
}

button:not(.active),
#scenarios .map-controls .map-buttons button {
	cursor: pointer;
}

.map-controls .map-tabs button:not(.active) {
	background-color: var(--base-gray);
	box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);
	color: rgba(0, 0, 0, 0.5);
}

.map-controls .map-tabs button:not(.active):hover {
	text-decoration: underline;
}

.map-buttons {
	display: flex;
	gap: 4px;
	margin-top: 8px;
}

.map-buttons button {
	padding: 6px 12px;
	font-size: 0.91em;
}

.map-buttons button.active {
	background: var(--spot);
	box-shadow: inset 1px 1px 1px rgb(255 255 255);
	filter: brightness(1.03);
}

.map-buttons button:hover {
	border-color: #000;
}

.map-buttons .mask-select {
	padding: 6px 28px 6px 12px;
	font-size: 0.91em;
	border: 1px solid var(--base-gray-dark);
	border-radius: 8px;
	background: white url('data:image/svg+xml;utf8,<svg fill="%23666" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7.293 8.293a1 1 0 011.414 0L10 9.586l1.293-1.293a1 1 0 111.414 1.414l-2 2a1 1 0 01-1.414 0l-2-2a1 1 0 010-1.414z"/></svg>') no-repeat right 10px center/18px 18px;
	color: #333;
	min-width: 180px;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

.map-buttons .mask-select:focus {
	outline: none;
	border-color: var(--spot);
	box-shadow: 0 0 0 2px rgba(var(--spot-rgb), 0.2);
}

@media screen and (max-width: 1499px) {
	.restoration-content {
		max-width: 900px;
	}
}

@media screen and (min-width: 1500px) {
	.restoration-content {
		min-height: 100vh;
		display: block;
		column-count: 2;
		column-gap: 40px;
	}

	body.mode-cockpit .scenario:only-of-type {
		display: block;
		column-count: 2;
		column-gap: 40px;
	}
}

.settings {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	background-color: #fff;
	padding: 20px;
	border-radius: 8px;
	box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.panel {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-width: max-content;
}

.panel.disabled {
	opacity: 0.3;
	pointer-events: none;
}

/* Zwei-Spalten-Layout für Taxonomic Group Panel */
.panel.two-column-layout {
	display: flex;
	flex-direction: column;
}

.panel.two-column-layout h2 {
	width: 100%;
}

.panel.two-column-layout .option-buttons-container {
	display: grid !important;
	grid-template-columns: 1fr 1fr !important;
	/*
	border-radius: 8px;
	border: solid 1px var(--base-gray-dark);
	overflow: hidden;
	*/
}

.panel.two-column-layout .option-buttons-container .value {
	width: 100% !important;
}

.panel.two-column-layout .option-buttons-container .value.grid-col-2 {
	/* Zweite Spalte Styling */
	border-left: solid 1px var(--base-gray-dark);
}

/* ALTERNATIVE: Robuste nth-child Lösung für Grid-Layout */
/* Erste Spalte: ungerade Positionen (1, 3, 5, ...) */
.panel.two-column-layout .option-buttons-container .value:nth-child(odd) {
	border-right: none;
}

/* Erste Spalte - Erstes Element (Position 1) */
.panel.two-column-layout .option-buttons-container .value:nth-child(1) {
	border-top-left-radius: 8px;
	border-top-right-radius: 0;
}

/* Zweite Spalte - Erstes Element (Position 2) */
.panel.two-column-layout .option-buttons-container .value:nth-child(2) {
	border-top-right-radius: 8px;
	border-top-left-radius: 0;
}

/* Erste Spalte - Letztes Element (ungerade Position, aber nur wenn es auch das letzte ungerade ist) */
.panel.two-column-layout .option-buttons-container .value:nth-child(odd):nth-last-child(-n + 2) {
	border-bottom-left-radius: 8px;
	border-bottom-right-radius: 0;
	border-bottom: solid 1px var(--base-gray-dark);
}

/* Zweite Spalte - Letztes Element (gerade Position und letztes Element gesamt) */
.panel.two-column-layout .option-buttons-container .value:nth-child(even):last-child {
	border-bottom-right-radius: 8px;
	border-bottom-left-radius: 0;
}

/* Alternative: nth-child Lösung (falls JavaScript-Klassen nicht gewünscht) */
/*
.panel.two-column-layout .option-buttons-container .value:nth-child(odd) {
	border-left: 3px solid #4a90e2;
	background-color: #f8fbff;
}

.panel.two-column-layout .option-buttons-container .value:nth-child(even) {
	border-left: 3px solid #7ed321;
	background-color: #f8fff8;
}
*/

.panel h2 {
	font-size: 1.1rem;
	margin-bottom: 5px;
	display: flex;
	align-items: center;
	gap: 8px;
	position: relative;
}

/* Basis-Stil für alle Info-Icons */
.info-icon {
	position: absolute;
	right: 8px;
	width: 18px;
	height: 18px;
	background-color: #666;
	color: white;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: bold;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: background 0.2s, opacity 0.2s;
	z-index: 10;
}

/* Info-Icon direkt im Panel h2 (Titel): vertikal auf Höhe des Icons */
.panel h2>.info-icon {
	top: 50%;
	transform: translateY(-50%);
}

/* Info-Icon in Buttons: vertikal zentriert */
button.value .info-icon {
	top: 50%;
	transform: translateY(-50%);
}

.info-icon:hover {
	background-color: #444;
}

/* Container müssen position: relative haben für absolute Info-Icons */
.panel h2,
.map-tabs button {
	position: relative;
}

.panel h2:hover .info-icon,
.value:hover .info-icon,
.map-tabs button:hover .info-icon {
	opacity: 1;
	pointer-events: auto;
}

.panel-icon-container {
	position: relative;
}

.panel-icon {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.panel-title-text {
	flex: 1;
}

/* Custom Tooltip */
.custom-tooltip {
	position: absolute;
	background-color: #333;
	color: white;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 0.85rem;
	white-space: nowrap;
	z-index: 99999;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.custom-tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #333;
}

.custom-tooltip.show {
	opacity: 1;
}

.panel.narrow h2 {
	flex-direction: row;
	justify-content: flex-start;
	align-items: center;
	gap: 8px;
}

.panel.narrow h2 .panel-icon-container {
	margin-right: 0;
	margin-left: 0;
}

.panel.narrow h2 .panel-title-text {
	display: none;
}

/* Ultra-narrow Panels: Kleinere Schrift für kurze Labels */
.panel.ultra-narrow button.value {
	font-size: 13px;
	padding: 6px 8px 4px 8px;
	letter-spacing: -0.01em;
}

button.value {
	font-size: 14px;
	white-space: nowrap;
	letter-spacing: 0.01em;
	box-sizing: border-box;
	width: 100%;
	padding: 7px 10px 5px 10px;
	border-width: 1px;
	border-style: solid;
	background-color: var(--base-light);
	border-color: var(--base-gray-dark);
	position: relative;
	transition: background 0.2s, box-shadow 0.2s;
	cursor: pointer;
	max-width: 100%;
	overflow-wrap: break-word;
	word-break: break-word;
	border-bottom: none;
	border-top: solid 1px #b9cecf;
}

button.value:first-of-type {
	border-top-left-radius: 8px;
	border-top-right-radius: 8px;
}

button.value:last-of-type {
	border-bottom: solid 1px var(--base-gray-dark);
	border-bottom-left-radius: 8px;
	border-bottom-right-radius: 8px;
}

button.value:hover {
	filter: brightness(1.03);
}

.panel:not(.disabled) .value.selected {
	background-color: var(--spot);
	box-shadow: inset 1px 1px 1px rgb(255 255 255);
	filter: brightness(1.03);
}

.image-placeholder,
.figure {
	width: 100%;
	height: 400px;
	max-width: 100%;
	background-color: var(--base-medium);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
}

.image-placeholder .placeholder-text {
	color: #666;
	font-weight: bold;
	font-size: 1rem;
	text-align: center;
	line-height: 1.4;
	max-width: 90%;
	padding: 10px;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.image-placeholder .placeholder-text strong {
	color: #333;
	display: block;
	margin-bottom: 8px;
	font-size: 1.1rem;
}

.image-placeholder .placeholder-text small {
	color: #777;
	font-size: 0.8rem;
	font-weight: normal;
	word-break: break-all;
	display: block;
	margin-top: 4px;
	width: 400px;
	max-width: 100%;
}

/* Chart container and canvas sizing */
.figure.chart {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	padding: 12px 16px 0 16px;
	/* Rand links und rechts für das Chart */
	height: auto;
	/* Automatische Höhe für Chart + Legende */
}

.figure.chart canvas {
	width: 100% !important;
	height: 400px !important;
	/* Fixe Höhe für das Canvas */
	max-width: 100%;
	max-height: 400px;
	display: block;
	flex-shrink: 0;
}

/* Chart Legend - direkt in der Chart-Box */
.chart-legend {
	font-size: 0.8em;
	color: #6c6c6c;
	padding: 10px 0px 12px 0px;
}

.chart-legend p {
	margin: 0;
	padding-top: 10px;
	line-height: 1.4;
	border-top: solid 1px var(--base-gray-dark);
}

/* Chart Info Boxes - gemeinsame Eigenschaften */
.box {
	width: 100%;
	border-radius: 8px;
	box-sizing: border-box;
	background-color: var(--base-medium);
}

/* Text Box - Service-spezifische Beschreibung */
.text {
	background-color: transparent;
	margin-top: 30px;
	font-size: 0.9em;
	line-height: 1.4em;
	padding: 4px;
}

.restoration-grid .text {
	margin-top: 40px;
}

#addScenario {
	flex-shrink: 0;
	width: 54px;
	height: 54px;
	background: var(--spot);
	color: #000;
	border: none;
	border-radius: 50%;
	font-size: 2.2em;
	font-weight: bold;
	cursor: pointer;
	margin: 20px;
	align-self: flex-start;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.13);
	position: relative;
	transition: background 0.2s;
}

/* Remove Scenario Button */
.remove-scenario-btn {
	position: absolute;
	top: -18px;
	right: -18px;
	width: 36px;
	height: 36px;
	background: var(--spot);
	color: #000;
	border-radius: 50%;
	font-size: 1.5em;
	font-weight: bold;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1),
		inset 1px 1px 1px rgb(255, 255, 255);
	border: solid 1px #afafaf;
	z-index: 1;
}

/* Scenario Animation Classes */
.scenario-adding {
	flex: 0 1 0 !important;
	padding-left: 0;
	padding-right: 0;
	overflow: hidden;
}

.scenario-added {
	flex: 1 1 0;
	padding-left: 40px;
	padding-right: 40px;
}

.scenario-removing {
	flex: 0 1 0 !important;
	padding-left: 0;
	padding-right: 0;
	border: none;
	overflow: hidden;
}

/* Custom Select Styles */
.custom-select-wrapper {
	display: flex;
	flex-direction: column;
	margin-right: 18px;
}

.settings-selects {
	display: flex;
	align-items: center;
	padding-bottom: 12px;
	gap: 18px;
	border-bottom: solid 1px var(--base-gray);
	justify-content: space-between;
	/* Push assistant button to the right */
}

.settings-selects .custom-select-wrapper {
	flex-direction: row;
	align-items: center;
	margin-right: 0;
}

/* Assistant button in settings */
.assistant-btn {
	background: #93cbcb url("img/icons/assistant.png") no-repeat 10px center;
	background-size: 22px 22px;
	border: solid 1px var(--base-gray-dark);
	border-radius: 8px;
	font-size: 0.9rem;
	cursor: pointer;
	white-space: nowrap;
	margin-left: auto;
	padding: 7px 15px 5px 40px;
	height: 32px;
	/* Gleiche Höhe wie custom-select */
	box-sizing: border-box;
	display: flex;
	align-items: center;
	/* left padding for icon */
}

/* Ultra-narrow: Nur Icon zeigen, kein Text */
.settings.ultra-narrow .assistant-btn {
	padding: 7px 10px 5px 10px;
	background-position: center center;
	min-width: 40px;
	justify-content: center;
}

.settings.ultra-narrow .assistant-btn span {
	display: none;
}

/* Download button in settings */
.download-btn {
	display: none;
	background: #93cbcb;
	border: solid 1px var(--base-gray-dark);
	border-radius: 8px;
	font-size: 0.9rem;
	cursor: pointer;
	white-space: nowrap;
	padding: 7px 15px 5px 15px;
	/* no icon, so equal padding */
}

/* Download button container positioning */
.download-container {
	display: flex;
	justify-content: flex-end;
	padding-right: 0;
	margin-bottom: 20px;
}

/* Nur bei narrow ausblenden */
.custom-select-wrapper.narrow .select-label-text {
	display: none;
}

.select-icon {
	display: inline-flex;
	align-items: center;
	margin-right: 3px;
	cursor: pointer;
	position: relative;
}

.custom-select {
	padding: 7px 18px 5px 10px;
	border-radius: 8px;
	border: 1px solid var(--base-gray-dark);
	font-size: 14px;
	background: #fff url('data:image/svg+xml;utf8,<svg fill="%23666" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7.293 8.293a1 1 0 011.414 0L10 9.586l1.293-1.293a1 1 0 111.414 1.414l-2 2a1 1 0 01-1.414 0l-2-2a1 1 0 010-1.414z"/></svg>') no-repeat right 10px center/18px 18px;
	appearance: none;
	cursor: pointer;
	height: 32px;
	/* Feste Höhe für Konsistenz */
	box-sizing: border-box;
	-webkit-appearance: none;
	-moz-appearance: none;
	min-width: 120px;
	transition: border-color 0.2s, background-color 0.2s;
	background-color: var(--base-light);
}

.custom-select:focus {
	border-color: var(--spot);
	outline: none;
	background-color: var(--base-light);
}

.custom-select-wrapper label {
	font-size: 1.1rem;
	color: #000;
	margin: 5px 10px 0 0;
	font-weight: bold;
}

/* Panel Container */
.panel-container {
	display: flex;
	gap: 10px;
	flex: 1;
}

/* Biodiversity Mode: 3-Spalten Layout */
.panel-container.biodiversity-mode {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	/* 3 gleich breite Spalten */
	grid-template-rows: auto auto;
	/* 2 Reihen */
	gap: 10px;
}

/* Biodiversity Grid-Positionen */
.panel-container.biodiversity-mode [data-driver-id="climate"] {
	grid-column: 1;
	grid-row: 1;
}

.panel-container.biodiversity-mode [data-driver-id="species"] {
	grid-column: 1;
	grid-row: 2;
}

.panel-container.biodiversity-mode [data-driver-id="taxgroups"] {
	/* Taxonomic groups jetzt in die mittlere (2.) Spalte */
	grid-column: 2;
	grid-row: 1 / 3;
}

.panel-container.biodiversity-mode [data-driver-id="lulc"] {
	/* LULC ganz nach rechts (3. Spalte) verschoben */
	grid-column: 3;
	grid-row: 1 / 3;
}

/* Assistant Mode Styles */
.assistant-progress {
	margin-bottom: 10px;
	border-radius: 8px;
}

.progress-bar {
	width: 100%;
	height: 12px;
	background: var(--base-gray);
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 8px;
	box-shadow: inset 0px 0px 1px rgba(0, 0, 0, 0.5);
	padding: 1px;
}

.progress-fill {
	height: 100%;
	background: var(--spot-bright);
	transition: width 0.6s ease-out;
	border-radius: 4px;
	min-width: 2px;
	/* Ensure progress bar is always visible */
}

.progress-text {
	text-align: center;
	font-size: 0.9rem;
	color: #666;
	font-weight: 500;
}

.assistant-step {
	margin-bottom: 20px;
}

.step-content h3 {
	font-size: 1.4rem;
	margin-bottom: 10px;
	color: #333;
}

.step-content p {
	margin-bottom: 20px;
	color: #666;
	line-height: 1.5;
}

.step-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.step-option {
	padding: 15px;
	border: 2px solid var(--base-gray);
	background: #fff;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s;
	text-align: left;
}

.step-option:hover {
	border-color: var(--base-gray-dark);
	background: var(--base-light);
}

.step-option.selected {
	border-color: var(--spot);
	background: var(--spot);
	font-weight: bold;
}

.step-option .option-label {
	font-weight: bold;
	margin-bottom: 5px;
}

.step-option .option-description {
	font-size: 0.9rem;
	color: #666;
	max-width: 700px;
}

.step-option.selected .option-description {
	color: #333;
}

.assistant-navigation {
	margin-top: 30px;
	display: flex;
	gap: 10px;
	align-items: center;
}

.nav-btn {
	padding: 10px 20px;
	border: 1px solid var(--base-gray-dark);
	background: #fff;
	border-radius: 8px;
	cursor: pointer;
	font-size: 1rem;
	transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
	background: var(--base-light);
}

.nav-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.nav-btn.cancel-btn {
	background: #f8f9fa;
	border-color: #dc3545;
	color: #dc3545;
	margin-left: auto;
	/* Push to right */
}

.nav-btn.cancel-btn:hover:not(:disabled) {
	background: #dc3545;
	color: white;
}

.nav-btn.back-btn {
	background: var(--base-light);
	border-color: var(--base-gray-dark);
	margin-right: auto;
	/* Push to left */
}

/* Hide cockpit elements in assistant mode */
.mode-assistant .settings-selects,
.mode-assistant .panel-container {
	display: none;
}

/* Hide assistant elements in cockpit mode */
.mode-cockpit .assistant-progress,
.mode-cockpit .assistant-step,
.mode-cockpit .assistant-navigation {
	display: none;
}

/* Results Container */
.results {
	transition: all 0.3s ease;
	display: flex;
	flex-direction: column;
	width: 100%;
	margin-top: 20px;
}

.mode-assistant .results {
	display: none;
}

.mode-cockpit .results {
	display: flex;
	/* Ensure flex display is maintained */
	flex-direction: column;
}

/* Language Selector */
.language-selector-container {
	position: fixed;
	right: 20px;
	top: 18px;
	z-index: 11;
}

.language-selector {
	display: flex;
	gap: 2px;
	overflow: hidden;
}

.lang-btn {
	padding: 0px 6px;
	border: none;
	background: var(--spot);
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #333;
}

.lang-btn:not(:last-child) {
	border-right: 1px solid #000000;
}

.lang-btn.active {
	font-weight: bold;
}

.figure.map {
	position: relative;
	overflow: hidden;
	/* a must for panning */
	cursor: grab;
}

.figure.map img {
	transform-origin: center;
	/* transition: transform 0.2s ease-out; */
	/* Disabled - causes desync with SVG overlay */
	pointer-events: none;
	/* prevent image dragging */
}

/* SVG overlay should match image transform exactly (transition disabled - sync with image) */

.zoom-controls {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.zoom-controls button {
	width: 30px;
	height: 30px;
	font-size: 18px;
	font-weight: bold;
	background-color: rgb(236 246 246 / 85%);
	border: 1px solid #ccc;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.zoom-controls button:hover {
	background-color: rgba(255, 255, 255, 1);
}

.map-controls {
	display: flex;
	gap: 8px;
	align-items: center;
	margin: 6px 0 16px;
	/* Prevent splitting across columns */
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
}

.map-controls button {
	background-color: #f9ffff;
	border: solid 1px #99b8b8;
	border-radius: 6px;
	padding: 3px 8px;
}

/* Keep map and its controls together, avoid column breaks */
.map-block {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	display: block;
}

/* Keep dynamically created map-with-controls wrapper together */
.map-with-controls-wrapper {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	display: block;
	margin-bottom: 20px;
}

/* ============================================================================
   SCENARIO COMPARISON STYLING
   ============================================================================ */

/* Comparison Button Container */
.comparison-button-container {
	width: 20px;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding-top: 500px;
	margin: 0;
	background: var(--base-gray);
}

.comparison-button {
	background: var(--spot);
	color: black;
	border: solid 1px var(--base-gray-dark);
	padding: 12px 12px 6px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	white-space: nowrap;
	display: flex;
	flex-direction: column;
	align-items: center;
	box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1),
		inset 1px 1px 1px rgb(255, 255, 255);
	z-index: 1;
}

.comparison-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.comparison-arrow {
	font-size: 20px;
	font-weight: bold;
}

/* Scenario Comparison Area */
.scenario-comparison {
	/* Erbt alle Eigenschaften von .scenario */
	position: relative;
}

/* Spezielle Regeln für Vergleichskarten */
.comparison-map .map-controls,
.comparison-map .map-tabs,
.scenario-comparison .comparison-map .map-controls,
.scenario-comparison .comparison-map .map-tabs {
	display: none !important;
}

/* Progress-Loader für Vergleichsberechnung */
.comparison-progress-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(255, 255, 255, 0);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	border-radius: 8px;
}

.comparison-progress-spinner {
	width: 40px;
	height: 40px;
	border: 5px solid #000;
	border-top: 5px solid var(--primary-color, var(--spot));
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin-bottom: 10px;
	filter: drop-shadow(white 0px 0px 1px);
}

.comparison-progress-text {
	position: absolute;
	bottom: -35px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 14px;
	color: #666;
	white-space: nowrap;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}

	100% {
		transform: rotate(360deg);
	}
}

/* Alternative: Rotierende Pfeile */
.comparison-progress-arrows {
	width: 40px;
	height: 40px;
	position: relative;
	animation: spin 1.5s ease-in-out infinite;
}

.comparison-progress-arrows::before {
	content: "⚡";
	font-size: 24px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

/* Comparison Legend */
.comparison-legend {
	background: white;
	border-radius: 8px;
	padding: 16px;
	box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
	margin-bottom: 20px;
	position: relative;
}

/* Ensure scenario-comparison .results has enough top margin for legend */
.scenario-comparison .results {
	position: relative;
	margin-top: 0;
	/* Reset any inherited margin */
}

.legend-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
}

.legend-header h4 {
	margin: 0;
	color: #333;
	font-size: 16px;
	font-weight: 500;
}

.comparison-legend .close-comparison {
	position: absolute;
	top: -18px;
	right: -18px;
	width: 36px;
	height: 36px;
	background: var(--spot);
	color: #000;
	border-radius: 50%;
	font-size: 1.5em;
	font-weight: bold;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1),
		inset 1px 1px 1px rgb(255, 255, 255);
	border: solid 1px #afafaf;
	z-index: 1;
}

.comparison-legend .close-comparison:hover {
	background: var(--spot-bright);
}

.comparison-legend h4 {
	margin: 0 0 12px 0;
	color: #333;
	font-size: 16px;
	font-weight: 500;
}

.legend-item {
	display: flex;
	align-items: center;
	margin-bottom: 8px;
	gap: 10px;
}

.legend-item:last-child {
	margin-bottom: 0;
}

.legend-color {
	width: 20px;
	height: 20px;
	border-radius: 2px;
	border: none;
	flex-shrink: 0;
}

.legend-item span {
	font-size: 14px;
	color: #555;
}

.comparison-content {
	padding: 20px;
	display: grid;
	grid-template-columns: 2fr 300px;
	gap: 20px;
	align-items: start;
}

.comparison-maps {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 15px;
}

.comparison-map {
	border-radius: 8px;
	border-bottom-left-radius: 8px;
	padding: 10px;
	text-align: center;
}

.comparison-map h4 {
	margin: 0 0 10px 0;
	font-size: 14px;
	color: #666;
	font-weight: 500;
}

.comparison-map img {
	border-radius: 4px;
}

.legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.legend-item:last-child {
	margin-bottom: 0;
}

.legend-color {
	width: 20px;
	height: 20px;
	border-radius: 2px;
	border: none;
	flex-shrink: 0;
}

.legend-color.green {
	background-color: rgb(209, 255, 97);
}

.legend-color.red {
	background-color: rgb(209, 0, 98);
}

.legend-color.gray {
	background-color: rgb(178, 178, 178);
}

.legend-item span {
	font-size: 14px;
	color: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
	.comparison-content {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.comparison-maps {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.comparison-button {
		padding: 10px 20px;
		font-size: 14px;
		min-width: 180px;
	}

	.comparison-icon {
		font-size: 16px;
	}
}

/* Cluster Info Grid */
.cluster-grid {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin-top: 30px;
	margin-bottom: 20px;
	background-color: rgba(255, 255, 255, 0.5);
	padding: 15px;
	border-radius: 8px;
	border: 1px solid var(--base-gray-dark);
}

.cluster-group {
	width: 100%;
}

.cluster-group h4 {
	margin: 0 0 10px 0;
	font-size: 1rem;
	color: #333;
	border-bottom: 1px solid var(--base-gray-dark);
	padding-bottom: 4px;
	width: 100%;
}

.cluster-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 10px 20px;
}

.cluster-item {
	font-size: 0.85rem;
	line-height: 1.3;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cluster-id {
	font-weight: bold;
	color: #000;
	font-size: 0.9rem;
}

.cluster-desc {
	color: #555;
}

/* Mask Controls in Map */
.mask-controls {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 10;
}

.mask-controls .mask-select {
	background-color: rgb(236 246 246 / 85%);
	border: 1px solid #ccc;
	border-radius: 6px;
	padding: 0 30px 0 8px;
	font-size: 0.85rem;
	cursor: pointer;
	height: 30px;
	color: #333;
	transition: background-color 0.2s;

	/* Custom Arrow */
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7.293 8.293a1 1 0 011.414 0L10 9.586l1.293-1.293a1 1 0 111.414 1.414l-2 2a1 1 0 01-1.414 0l-2-2a1 1 0 010-1.414z"/></svg>');
	background-repeat: no-repeat;
	background-position: right 4px center;
	background-size: 22px 22px;
}

.mask-controls .mask-select:hover {
	background-color: rgba(255, 255, 255, 1);
}

.mask-controls .mask-select:focus {
	outline: none;
	border-color: #999;
}

h3 {
	margin-bottom: 18px;
}

.content p {
	margin-bottom: 12px;
}