/**
 * FSV 63 – Floating UI
 * Patch 239: ruhiger Nach-oben-Button + Abstand zum Consent-Button.
 */

:root {
	--fsv63-floating-edge: clamp(14px, 2.2vw, 26px);
	--fsv63-floating-bottom: max(18px, env(safe-area-inset-bottom));
	--fsv63-floating-consent-offset: 0px;
}

html {
	scroll-behavior: smooth;
}

body .fsv63-back-to-top {
	position: fixed;
	right: var(--fsv63-floating-edge);
	bottom: calc(var(--fsv63-floating-bottom) + var(--fsv63-floating-consent-offset));
	z-index: 99930;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid rgba(255, 220, 17, 0.45);
	border-radius: 999px;
	background:
		linear-gradient(135deg, rgba(255, 220, 17, 0.95), rgba(239, 191, 22, 0.95));
	color: #07131f;
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(255, 220, 17, 0.10);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translate3d(0, 14px, 0) scale(0.94);
	transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease, bottom 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, width 180ms ease;
}

body .fsv63-back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate3d(0, 0, 0) scale(1);
}

body .fsv63-back-to-top:hover,
body .fsv63-back-to-top:focus-visible {
	background: #ffdc11;
	border-color: rgba(255, 255, 255, 0.55);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42), 0 0 0 7px rgba(255, 220, 17, 0.16);
	outline: none;
	transform: translate3d(0, -2px, 0) scale(1);
}

body .fsv63-back-to-top svg {
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	stroke-width: 2.6;
}

body .fsv63-back-to-top__label {
	display: none;
	font-size: 12px;
	font-weight: 900;
	line-height: 1;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
}

/*
 * Alte/Plugin-Scrollbuttons ausblenden, damit nur noch eine saubere Loesung sichtbar ist.
 * Der eigene Button ist bewusst ausgenommen.
 */
body .back-to-top:not(.fsv63-back-to-top),
body #back-to-top,
body .scroll-to-top,
body .scrollup,
body #scrollUp,
body .site-scroll-top,
body .return-to-top,
body .btn-back-to-top,
body .cd-top,
body .qodef-back-to-top,
body .mkdf-back-to-top,
body .td-scroll-up,
body .elementor-scroll-up,
body .et_pb_scroll_top,
body .avia_scrolltop,
body .fsv63-native-backtop-hidden {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

/* Complianz/Consent-Manager nicht mehr mit dem Nach-oben-Button kollidieren lassen. */
body .cmplz-manage-consent,
body #cmplz-manage-consent,
body .cc-revoke,
body .cky-btn-revisit-wrapper,
body .moove-gdpr-infobar-reject-btn,
body #moove_gdpr_save_popup_settings_button {
	z-index: 99920 !important;
}

body .cmplz-manage-consent,
body #cmplz-manage-consent {
	left: var(--fsv63-floating-edge) !important;
	right: auto !important;
	bottom: max(18px, env(safe-area-inset-bottom)) !important;
	max-width: min(320px, calc(100vw - 96px)) !important;
	border: 1px solid rgba(255, 255, 255, 0.16) !important;
	border-radius: 14px !important;
	background: rgba(7, 19, 31, 0.92) !important;
	color: rgba(255, 255, 255, 0.88) !important;
	box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34) !important;
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
}

body .cmplz-manage-consent:hover,
body .cmplz-manage-consent:focus-visible,
body #cmplz-manage-consent:hover,
body #cmplz-manage-consent:focus-visible {
	background: rgba(12, 33, 55, 0.96) !important;
	border-color: rgba(255, 220, 17, 0.38) !important;
	color: #ffffff !important;
}

body .cmplz-cookiebanner,
body .cky-consent-container,
body .cc-window {
	z-index: 99910 !important;
}

@media (min-width: 900px) {
	body .fsv63-back-to-top:hover,
	body .fsv63-back-to-top:focus-visible {
		width: 128px;
		gap: 9px;
	}

	body .fsv63-back-to-top:hover .fsv63-back-to-top__label,
	body .fsv63-back-to-top:focus-visible .fsv63-back-to-top__label {
		display: inline-block;
	}
}

@media (max-width: 767px) {
	:root {
		--fsv63-floating-edge: 14px;
		--fsv63-floating-bottom: max(14px, env(safe-area-inset-bottom));
	}

	body .fsv63-back-to-top {
		width: 43px;
		height: 43px;
	}

	body .cmplz-manage-consent,
	body #cmplz-manage-consent {
		max-width: calc(100vw - 78px) !important;
		font-size: 12px !important;
		line-height: 1.25 !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	body .fsv63-back-to-top {
		transition: none;
	}
}
