/* =========================================================
   1. Design Tokens

   ========================================================= */
:root {
	/* Typografie */
	--font-family-base:
		system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-size-base: 14px;
	--line-height-base: 1.5;

	/* Farben */
	--color-bg: #f5f7fb;
	--color-border: #d7dce5;
	--color-border-subtle: #e3e7f0;
	--color-primary: #bb0056;
	--color-primary-soft: #fdb913;
	--color-primary-strong: #7c154d;
	--color-text: #1f2430;
	--color-text-muted: #6b7280;
	--color-scrollbar: #c0c7d6;

	/* Sonstiges */
	--shadow-soft: 0 2px 6px rgba(15, 23, 42, 0.08);
	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 14px;
	--header-height: 72px;
	--sidebar-width: 280px;
	--transition-fast: 160ms ease-out;
}

/* =========================================================
   2. Base / Reset

   ========================================================= */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: hidden;
}

body {
	font-family: var(--font-family-base);
	font-size: var(--font-size-base);
	line-height: var(--line-height-base);
	color: var(--color-text);
}

img {
	max-width: 100%;
	display: block;
}

button {
	font-family: inherit;
}

/* =========================================================
   3. Reusable Components / Utilities

   ========================================================= */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	padding: 0.6rem 1.2rem;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	cursor: pointer;
	transition:
		background-color var(--transition-fast),
		color var(--transition-fast),
		box-shadow var(--transition-fast),
		transform 80ms ease-out;
	text-decoration: none;
}

.btn-primary {
	background: var(--color-primary);
	color: var(--color-bg);
	box-shadow: 0 2px 4px rgba(19, 94, 242, 0.25);
}

.btn-primary:hover {
	background: var(--color-primary-strong);
}

.btn-pill {
	border-radius: 999px;
}

.overlay {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.overlay--dimmed {
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(2px);
}

.scroll-y-thin {
	overflow-y: auto;
	scrollbar-width: thin;
}

.scroll-y-thin::-webkit-scrollbar {
	width: 6px;
}

.scroll-y-thin::-webkit-scrollbar-track {
	background: transparent;
}

.scroll-y-thin::-webkit-scrollbar-thumb {
	background: var(--color-scrollbar);
	border-radius: 999px;
}

/* =========================================================
   4. App Layout

   ========================================================= */

.app {
	height: 100vh;
	display: flex;
	flex-direction: column;
}

/* -------------------- Header -------------------- */

.app-header {
	position: sticky;
	top: 0;
	z-index: 20;
	height: var(--header-height);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem 1rem;
}

.app-header-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.app-logo {
	width: auto;
	height: 80px;
	border-radius: 4px;
	object-fit: contain;
}

.app-title-block {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.app-title {
	font-size: 24px;
	font-weight: 650;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	white-space: nowrap;
}

.app-subtitle {
	font-size: 18px;
	color: var(--color-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.app-header-right {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.app-header-label {
	font-size: 18px;
	color: var(--color-text-muted);
	white-space: nowrap;
}

.partner-logos {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.partner-logo {
	height: 50px;
	object-fit: contain;
}

/* -------------------- Sidebar Toggle für Mobile -------------------- */

.header-toggle {
	border: 1px solid var(--color-border);
	background: #ffffffcc;
	color: var(--color-text);
	border-radius: 999px;
	padding: 6px 10px;
	font-size: 14px;
	font-weight: 500;
	display: none;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	backdrop-filter: blur(6px);
}

.header-toggle-icon {
	width: 16px;
	height: 2px;
	border-radius: 999px;
	background: var(--color-text);
	position: relative;
}

.header-toggle-icon::before,
.header-toggle-icon::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: 2px;
	border-radius: inherit;
	background: inherit;
}

.header-toggle-icon::before {
	top: -5px;
}

.header-toggle-icon::after {
	top: 5px;
}

/* -------------------- Body Layout -------------------- */

.app-body {
	flex: 1;
	min-height: 0;
	display: flex;
	overflow: hidden;
}

/* =========================================================
   5. Sidebar

   ========================================================= */

.sidebar {
	width: var(--sidebar-width);
	max-width: 100%;
	display: flex;
	flex-direction: column;
	padding: 12px 12px 10px;
	overflow-y: hidden;
	scrollbar-width: thin;
}

.sidebar-section {
	margin-bottom: 16px;
}

.sidebar-heading {
	margin: 8px 4px 4px;
	font-size: 15px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--color-primary-strong);
}

.sidebar-section--countries {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.sidebar-subhint {
	font-size: 10px;
	color: var(--color-text-muted);
	margin-left: 4px;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}

.sidebar-country-scroll {
	flex: 1;
	min-height: 0;
	position: relative;
	overflow-y: auto;
	padding-right: 4px;
	scrollbar-width: thin;
}

/* Scrollbar für Sidebar */
.sidebar-country-scroll::-webkit-scrollbar {
	width: 6px;
}

.sidebar-country-scroll::-webkit-scrollbar-track {
	background: transparent;
}

.sidebar-country-scroll::-webkit-scrollbar-thumb {
	background: var(--color-scrollbar);
	border-radius: 999px;
}

.sidebar-scroll-hint-bottom {
	position: sticky;
	bottom: 0;
	text-align: center;
	font-size: 13px;
	color: var(--color-text-muted);
	padding-top: 8px;
	padding-bottom: 2px;
	background: linear-gradient(to top, #ffffffd4 65%, rgba(245, 247, 251, 0));
	pointer-events: none;
	height: 5rem;
	display: flex;
	align-items: end;
	justify-content: center;
	transition: opacity 0.2s ease-out;
	opacity: 1;
}

/* Tab-Navi in Sidebar */

.tab-nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding-bottom: 12px;
}

.tab-link {
	border: none;
	background: transparent;
	text-align: left;
	padding: 8px 10px;
	border-radius: var(--radius-sm);
	color: var(--color-text);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	cursor: pointer;
	transition:
		background var(--transition-fast),
		color var(--transition-fast),
		box-shadow var(--transition-fast),
		transform 80ms ease-out;
}

.tab-link:hover {
	background: var(--color-primary-soft);
}

.tab-link.is-active {
	background: var(--color-primary);
	color: #ffffff;
	box-shadow:
		0 0 0 1px rgba(19, 94, 242, 0.15),
		0 6px 12px rgba(19, 94, 242, 0.35);
	transform: translateY(-1px);
}

.tab-link-label {
	display: inline-flex;
	align-items: baseline;
	gap: 4px;
}

.tab-link-country {
	font-weight: 600;
}

.tab-link-code {
	font-size: 11px;
	opacity: 0.9;
}

.sidebar-divider {
	height: 1px;
	margin: 8px 0;
	background: var(--color-border-subtle);
	border: 0;
}

.sidebar-footer {
	margin-top: auto;
	padding: 8px 10px 4px;
	font-size: 14px;
	color: var(--color-text-muted);
	border-top: 1px dashed var(--color-border-subtle);
}

.version-label {
	font-weight: 600;
	color: var(--color-text);
}

/* =========================================================
   6. Main Content / Tabs

   ========================================================= */

.main {
	flex: 1;
	min-width: 0;
	min-height: 0;
	padding: 0;
	display: flex;
}

.main-inner {
	flex: 1;
	min-height: 0;
	border-radius: 12px;
	position: relative;
	overflow: hidden;
	display: flex;
	margin: 1rem;
	border: 1px solid #efefef;
}
.tab-panel {
	position: absolute;
	inset: 0;
	display: none;
}

.tab-panel.is-active {
	display: block;
}

.map-frame {
	width: 100%;
	height: 100%;
	border: none;
}

/* =========================================================
   7. Karten-Wrapper & Consent-Overlay

   ========================================================= */

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

#map-consent-overlay {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.9);
	background-image: url(consent_map.jpg);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	padding: 1rem;
	z-index: 1000;
}

#map-consent-content {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	background: #fff;
	padding: 6rem 4rem;
	border-radius: 20px;
	box-shadow: 4px 6px 34px -27px #777;
	gap: 1rem;
}

#map-consent-content input {
	line-height: 1;
	vertical-align: bottom;
}

#map-consent-accept {
	padding: 1em 4em;
}

/* =========================================================
   8. Responsive Verhalten

   ========================================================= */

@media (max-width: 960px) {
	.app-header {
		padding-inline: 10px;
		gap: 8px;
		flex-wrap: wrap;
		height: auto;
	}

	.app-subtitle {
		display: none;
	}

	.header-toggle {
		display: inline-flex;
	}

	.app-header-right {
		gap: 1.5rem;
	}

	.partner-logo {
		height: 40px;
	}

	.app-body {
		position: relative;
	}

	.sidebar {
		position: fixed;
		top: var(--header-height);
		bottom: 0;
		left: -100%;
		z-index: 30;
		max-width: 80vw;
		transition: left var(--transition-fast);
	}

	.app.sidebar-open .sidebar {
		left: 0;
		z-index: 11000;
		background: #ffffffe3;
	}

	.app-overlay {
		position: fixed;
		inset: calc(var(--header-height) - 0.5rem) 0 0 0;
		background: #f5f7fbe5;
		backdrop-filter: blur(2px);
		z-index: 25;
		display: none;
	}

	.app.sidebar-open .app-overlay {
		display: block;
	}
}

@media (max-width: 640px) {
	.app-title {
		font-size: 16px;
	}
}
