/* Base Box-Sizing for all KFM Elements to prevent overflow */
.kfm-header-wrapper,
.kfm-header-wrapper *,
.kfm-footer,
.kfm-footer *,
.kfm-mobile-menu-popup,
.kfm-mobile-menu-popup * {
	box-sizing: border-box !important;
}

/* Base Container */
.kfm-container,
.kfm-footer-bottom-inner {
	max-width: 1140px;
	margin: 0 auto;
}

/* Header */
.kfm-header-wrapper {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 1000;
}

.kfm-header-wrapper.kfm-header-wrapper-subpage {
	position: relative !important;
	display: block !important;
}

.kfm-header {
	position: relative;
	background: var(--header-bg, linear-gradient(0deg, rgba(8, 8, 8, 0.25) 0%, transparent 100%)) !important;
	backdrop-filter: blur(20px) !important;
	-webkit-backdrop-filter: blur(20px) !important;
	border-bottom: none !important;
}

.kfm-header-subpage {
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
}

/* Reset Elementor border-radius and default styles */
.kfm-header img,
.kfm-footer img,
.kfm-header button,
.kfm-footer button {
	border-radius: 0 !important;
}

.kfm-header-container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	max-width: 1140px;
	margin: 0 auto;
	height: var(--kfm-header-height, 100px);
}

.kfm-logo-container a {
	display: block;
}

.kfm-logo-large {
	max-height: 60px;
	width: auto;
}

/* News Ticker */
.kfm-news-ticker {
	background: var(--ticker-bg, var(--primary)) !important;
	color: var(--ticker-text, var(--background)) !important;
	width: 100%;
	overflow: hidden;
}

.kfm-news-ticker a {
	color: var(--ticker-link, var(--background)) !important;
	text-decoration: underline !important;
}

.kfm-ticker-container {
	height: 40px;
	display: flex;
	align-items: center;
	overflow: hidden;
}

.kfm-ticker-track-wrap {
	width: 100%;
	overflow: hidden;
	white-space: nowrap;
	position: relative;
}

.kfm-ticker-track {
	display: inline-block;
	white-space: nowrap;
	animation: kfm-marquee 30s linear infinite;
}

.kfm-ticker-track:hover {
	animation-play-state: paused;
}

.kfm-ticker-item {
	display: inline-block;
	padding-right: 50px;
	font-size: var(--text-small-size);
	font-family: inherit;
}

@keyframes kfm-marquee {
	0% {
		transform: translateX(0);
	}

	100% {
		transform: translateX(-20%);
	}

	/* Assuming content is duplicated 5 times */
}

.kfm-header-container.layout-centered {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	width: 100%;
}

.kfm-header-container.layout-centered .kfm-logo-container {
	justify-self: start;
}

.kfm-header-container.layout-centered .kfm-nav-desktop {
	justify-self: center;
}

.kfm-header-container.layout-centered .kfm-cta-desktop {
	justify-self: end;
}

/* CTA Buttons */
.kfm-cta-buttons {
	display: flex;
	gap: 20px;
	align-items: center;
}

.kfm-cta-buttons a {
	text-decoration: none !important;
}

.kfm-cta-desktop {
	display: none;
}

.kfm-mobile-cta {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 15px;
}

/* Desktop Nav */
.kfm-nav-desktop {
	display: none;
}

.kfm-nav-desktop ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: var(--kfm-gap-nav, 20px);
}

.kfm-nav-desktop a {
	text-decoration: none !important;
	color: var(--header-text, var(--background)) !important;
	font-family: inherit !important;
	font-weight: 500 !important;
	transition: color 0.3s ease !important;
}

.kfm-nav-desktop a:hover {
	color: var(--header-hover, var(--accent)) !important;
}

.kfm-burger-button {
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	cursor: pointer;
	padding: 10px;
	z-index: 1002;
	font-size: var(--text-size);
	color: var(--header-burger, var(--text)) !important;
}

.kfm-burger-custom-icon {
	font-size: var(--text-size);
}

.kfm-burger-box {
	display: inline-block;
	width: 30px;
	height: 24px;
	position: relative;
}

.kfm-burger-inner,
.kfm-burger-inner::before,
.kfm-burger-inner::after {
	position: absolute;
	width: 30px;
	height: 3px;
	background-color: var(--header-burger, var(--primary)) !important;
	border-radius: 4px;
	transition: transform 0.15s ease;
}

.kfm-burger-inner {
	top: 50%;
	transform: translateY(-50%);
}

.kfm-burger-inner::before {
	content: '';
	top: -10px;
}

.kfm-burger-inner::after {
	content: '';
	bottom: -10px;
}

.kfm-burger-button[aria-expanded="true"] .kfm-burger-inner {
	background-color: transparent;
}

.kfm-burger-button[aria-expanded="true"] .kfm-burger-inner::before {
	transform: translateY(10px) rotate(45deg);
}

.kfm-burger-button[aria-expanded="true"] .kfm-burger-inner::after {
	transform: translateY(-10px) rotate(-45deg);
}

/* Mobile Menu Popup */
.kfm-mobile-menu-popup {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(8, 8, 8, 0.5);
	backdrop-filter: blur(15px);
	-webkit-backdrop-filter: blur(15px);
	z-index: 1001;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 40px !important;
}

.kfm-mobile-menu-popup.active {
	opacity: 1;
	visibility: visible;
}

.kfm-mobile-menu-inner {
	width: 100%;
	max-width: 600px;
	margin: auto;
	transform: translateY(50px);
	transition: transform 0.4s ease;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.kfm-mobile-menu-popup.active .kfm-mobile-menu-inner {
	transform: translateY(0);
}

.kfm-mobile-close {
	background: none;
	border: none;
	font-size: 40px;
	line-height: 1;
	padding: 0;
	margin: 40px auto 0 auto;
	display: block;
	color: var(--heading, #fff);
	cursor: pointer;
	z-index: 10;
}

.kfm-mobile-menu-popup ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--kfm-gap-burger, 20px);
}

.kfm-mobile-menu-popup a {
	display: block;
	font-family: var(--text-family);
	font-size: var(--text-size);
	font-weight: var(--text-weight);
	line-height: var(--text-lh);
	color: var(--heading);
	text-decoration: none;
	padding: 10px 0;
	transition: color 0.3s ease;
}

.kfm-mobile-menu-popup a:hover {
	color: var(--primary);
}

.kfm-mobile-menu-popup .kfm-submenu {
	padding-left: 0;
	width: 100%;
}

.kfm-mobile-menu-popup .kfm-submenu a {
	font-size: var(--text-size);
	font-family: inherit;
}

/* Footer */
.kfm-footer {
	background: var(--footer-bg, var(--background)) !important;
	color: var(--footer-text, var(--text)) !important;
	font-family: inherit !important;
}

.kfm-footer-bottom {
	border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
	padding: 20px 0 !important;
	background: inherit !important;
}

.kfm-footer-bottom-inner {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
}

/* Footer Layouts - Desktop */
.kfm-footer-d-space-between {
	justify-content: space-between;
	flex-direction: row;
	align-items: center;
	text-align: left;
}

.kfm-footer-d-center {
	justify-content: center;
	flex-direction: row;
	align-items: center;
	text-align: center;
}

.kfm-footer-d-column-center {
	justify-content: center;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.kfm-footer-d-column-center .kfm-legal-links {
	justify-content: center;
}

.kfm-footer-d-flex-start {
	justify-content: flex-start;
	flex-direction: row;
	align-items: center;
	text-align: left;
}

.kfm-footer-d-flex-end {
	justify-content: flex-end;
	flex-direction: row;
	align-items: center;
	text-align: right;
}

.kfm-legal-links {
	display: flex;
	gap: 15px;
}

.kfm-legal-links a {
	color: var(--footer-link, var(--text)) !important;
	text-decoration: none !important;
	transition: color 0.3s ease !important;
}

.kfm-legal-links a:hover {
	color: var(--footer-link-hover, var(--primary)) !important;
}

/* --- Viewports & Breakpoints --- */

/* Smartphone hoch (Portrait) */
@media (max-width: 767px) {

	.kfm-header-container,
	.kfm-container,
	.kfm-footer-bottom-inner {
		padding-left: 20px !important;
		padding-right: 20px !important;
	}

	/* Footer Layouts - Mobile (<768px) */
	.kfm-footer-bottom-inner.kfm-footer-m-space-between {
		justify-content: space-between;
		flex-direction: row;
		align-items: center;
		text-align: left;
	}

	.kfm-footer-bottom-inner.kfm-footer-m-center {
		justify-content: center;
		flex-direction: row;
		align-items: center;
		text-align: center;
	}

	.kfm-footer-bottom-inner.kfm-footer-m-column-center {
		justify-content: center;
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.kfm-footer-bottom-inner.kfm-footer-m-column-center .kfm-legal-links {
		justify-content: center;
	}

	.kfm-footer-bottom-inner.kfm-footer-m-flex-start {
		justify-content: flex-start;
		flex-direction: row;
		align-items: center;
		text-align: left;
	}

	.kfm-footer-bottom-inner.kfm-footer-m-flex-end {
		justify-content: flex-end;
		flex-direction: row;
		align-items: center;
		text-align: right;
	}
}

/* Smartphone quer (Landscape) */
@media (min-width: 768px) and (max-width: 880px) {

	.kfm-header-container,
	.kfm-container,
	.kfm-footer-bottom-inner {
		padding-left: 40px !important;
		padding-right: 40px !important;
	}
}

/* Tablet hoch (Portrait) */
@media (min-width: 881px) and (max-width: 1024px) {

	.kfm-header-container,
	.kfm-container,
	.kfm-footer-bottom-inner {
		padding-left: 40px !important;
		padding-right: 40px !important;
	}
}

/* Tablet All (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {

	/* Footer Layouts - Tablet */
	.kfm-footer-bottom-inner.kfm-footer-t-space-between {
		justify-content: space-between;
		flex-direction: row;
		align-items: center;
		text-align: left;
	}

	.kfm-footer-bottom-inner.kfm-footer-t-center {
		justify-content: center;
		flex-direction: row;
		align-items: center;
		text-align: center;
	}

	.kfm-footer-bottom-inner.kfm-footer-t-column-center {
		justify-content: center;
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.kfm-footer-bottom-inner.kfm-footer-t-column-center .kfm-legal-links {
		justify-content: center;
	}

	.kfm-footer-bottom-inner.kfm-footer-t-flex-start {
		justify-content: flex-start;
		flex-direction: row;
		align-items: center;
		text-align: left;
	}

	.kfm-footer-bottom-inner.kfm-footer-t-flex-end {
		justify-content: flex-end;
		flex-direction: row;
		align-items: center;
		text-align: right;
	}
}

/* Tablet quer (Landscape) */
@media (min-width: 1025px) and (max-width: 1200px) {

	.kfm-header-container,
	.kfm-container,
	.kfm-footer-bottom-inner {
		padding-left: 40px !important;
		padding-right: 40px !important;
	}
}

/* Laptop and Desktop (>= 1366px) */
@media (min-width: 1366px) {
	.kfm-nav-desktop {
		display: block;
	}

	.kfm-cta-desktop {
		display: flex;
	}

	.kfm-burger-button {
		display: none;
	}
}

/* Fallback for centered layout on mobile */
@media (max-width: 1365px) {
	.kfm-header-container.layout-centered {
		display: flex;
		justify-content: space-between;
	}
}

/* Desktop (1140px), Laptop (1366px), Breitbild (2400px) are mostly handled by max-width: 1140px on containers, 
   but added here for reference as requested by user */
@media (min-width: 1366px) {
	/* Laptop specific styles */
}

@media (min-width: 2400px) {
	/* Breitbild specific styles */
}
