/**
 * FS Tarifaushang – Frontend Styles
 * Alle Farben laufen über CSS-Variablen und sind im Elementor-Style-Tab steuerbar.
 */

/*
 * Fallback-Kette: Widget-Einstellung → globale Elementor-Farbe der Website → neutraler Wert.
 * Dadurch übernimmt das Widget automatisch das Design des Themes, auch wenn im
 * Style-Tab nichts eingestellt wurde.
 */
.fs-ta {
	--fs-accent: var(--e-global-color-accent, #c8102e);
	--fs-accent-contrast: #ffffff;
	--fs-thead-bg: var(--e-global-color-primary, #1f2937);
	--fs-thead-color: #ffffff;
	--fs-group-bg: #f3f4f6;
	--fs-group-color: var(--e-global-color-secondary, #111827);
	--fs-row-bg: #ffffff;
	--fs-row-bg-alt: #f9fafb;
	--fs-row-bg-hover: color-mix(in srgb, var(--fs-accent) 7%, #ffffff);
	--fs-row-bg-highlight: color-mix(in srgb, var(--fs-accent) 12%, #ffffff);
	--fs-row-color: var(--e-global-color-text, #374151);
	--fs-border: #e5e7eb;
	--fs-card-bg: #ffffff;
	--fs-card-title-bg: #f3f4f6;
	--fs-card-title-color: var(--e-global-color-secondary, #111827);
	--fs-badge-e-bg: color-mix(in srgb, var(--fs-accent) 14%, #ffffff);
	--fs-badge-e-color: var(--fs-accent);
	--fs-badge-a-bg: #eef2f7;
	--fs-badge-a-color: var(--e-global-color-secondary, #374151);

	/* Abstand von oben für Sticky (z. B. Höhe eines fixierten Website-Headers). */
	--fs-sticky-offset: 0px;
	/* Wird per JS auf die tatsächliche Höhe der Kopfzeile gesetzt. */
	--fs-thead-h: 0px;

	color: var(--fs-row-color);
}

/* Fallback für Browser ohne color-mix() (Safari < 16.2). */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.fs-ta {
		--fs-row-bg-hover: #f4f6f8;
		--fs-row-bg-highlight: #fff7ed;
		--fs-badge-e-bg: #f1f3f6;
	}
}

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

.fs-ta__header {
	margin-bottom: 1.25em;
}

.fs-ta__title {
	margin: 0 0 0.3em;
	line-height: 1.2;
}

.fs-ta__subtitle {
	margin: 0;
	opacity: 0.85;
	line-height: 1.5;
}

.fs-ta__tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 1em;
}

.fs-ta__search {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 260px;
}

.fs-ta__search-input {
	width: 100%;
	max-width: 420px;
	padding: 10px 14px;
	border: 1px solid var(--fs-border);
	border-radius: 6px;
	font: inherit;
	line-height: 1.3;
	background: #fff;
	color: inherit;
}

.fs-ta__search-input:focus {
	outline: 2px solid var(--fs-accent);
	outline-offset: 1px;
	border-color: var(--fs-accent);
}

.fs-ta__search-count {
	font-size: 0.85em;
	opacity: 0.7;
	white-space: nowrap;
}

.fs-ta__print {
	padding: 10px 18px;
	border: 0;
	border-radius: 6px;
	background: var(--fs-accent);
	color: var(--fs-accent-contrast);
	font: inherit;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.fs-ta__print:hover {
	filter: brightness(1.1);
}

/* ---------------------------------------------------------------- Tabelle */

/*
 * WICHTIG: Dieser Container darf KEIN overflow (auto/hidden/scroll) bekommen –
 * sonst wird er zum Scroll-Container und `position: sticky` der Kopfzeile
 * bezieht sich auf ihn statt auf das Fenster. Die Tabelle bleibt stattdessen
 * durch Umbruch in den breiten Spalten schmal genug.
 */
.fs-ta__table-wrap {
	position: relative;
	width: 100%;
	overflow: visible;
}

/*
 * border-collapse: separate ist Absicht. Bei "collapse" werden Rahmen und
 * Hintergründe von sticky-Zellen in mehreren Browsern fehlerhaft gezeichnet
 * (Rahmen verschwinden, Zellen wirken durchsichtig).
 */
.fs-ta__table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	table-layout: auto;
	margin: 0;
	background: var(--fs-row-bg);
}

.fs-ta__table th,
.fs-ta__table td {
	padding: 10px 14px;
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid var(--fs-border);
}

.fs-ta__table thead th {
	background: var(--fs-thead-bg);
	color: var(--fs-thead-color);
	font-weight: 600;
	white-space: nowrap;
	border-bottom: 0;
}

/* Sticky Spaltenbeschriftung */
/*
 * Nur Zellen im <thead> werden fixiert. Sticky-Tabellenzellen werden vom
 * Browser an der TABELLE verankert, nicht am <tbody> – deshalb dürfen die
 * Gruppenzeilen im Tabellenkörper nicht sticky sein, sie würden sich sonst
 * alle an derselben Stelle stapeln und überlagern.
 */
.fs-ta-sticky-yes .fs-ta__table thead .fs-ta__thead-cols th {
	position: -webkit-sticky;
	position: sticky;
	top: var(--fs-sticky-offset);
	z-index: 6;
	background-color: var(--fs-thead-bg);
	background-clip: padding-box;
}

/* Zweite Kopfzeile: zeigt die Gruppe, in der man sich gerade befindet. */
.fs-ta__thead-group th {
	background-color: var(--fs-group-bg);
	background-clip: padding-box;
	color: var(--fs-group-color);
	text-align: left;
	font-weight: 700;
	font-size: 0.8em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-bottom: 2px solid var(--fs-accent);
	padding-top: 6px;
	padding-bottom: 6px;
}

.fs-ta-sticky-yes .fs-ta__table thead .fs-ta__thead-group th {
	position: -webkit-sticky;
	position: sticky;
	top: calc( var(--fs-sticky-offset) + var(--fs-thead-h) );
	z-index: 5;
}

/* Ohne Sticky ist die Anzeige überflüssig – die Gruppenzeilen stehen ja im Fluss. */
.fs-ta:not(.fs-ta-sticky-yes) .fs-ta__thead-group,
.fs-ta__thead-group.is-empty {
	display: none;
}

.fs-ta__th--kosten,
.fs-ta__td--kosten,
.fs-ta__th--kurs,
.fs-ta__td--kurs,
.fs-ta__th--fl,
.fs-ta__td--fl,
.fs-ta__th--tp,
.fs-ta__td--tp,
.fs-ta__th--pp,
.fs-ta__td--pp,
.fs-ta__th--art,
.fs-ta__td--art {
	text-align: center;
	white-space: nowrap;
}

.fs-ta__th--kosten,
.fs-ta__td--kosten {
	text-align: right;
}

.fs-ta__td--klasse {
	min-width: 180px;
}

.fs-ta__td--aufteilung {
	font-size: 0.92em;
	opacity: 0.9;
	min-width: 180px;
}

.fs-ta__row--base {
	background: var(--fs-row-bg);
}

.fs-ta__row--alt {
	background: var(--fs-row-bg-alt);
}

.fs-ta__row--highlight {
	background: var(--fs-row-bg-highlight);
	box-shadow: inset 3px 0 0 0 var(--fs-accent);
}

.fs-ta__table tbody tr:hover {
	background: var(--fs-row-bg-hover);
}

/* Deckender Hintergrund – sonst scheinen die Zeilen beim Scrollen durch. */
.fs-ta__group th {
	background-color: var(--fs-group-bg);
	background-clip: padding-box;
	color: var(--fs-group-color);
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	font-size: 0.85em;
	border-bottom: 2px solid var(--fs-accent);
}

.fs-ta__group-label {
	display: block;
}

/* Bewusst NICHT sticky – siehe Kommentar bei .fs-ta__thead-cols. */
.fs-ta__group th {
	position: static;
}

.fs-ta__price {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.fs-ta__empty {
	opacity: 0.35;
}

.fs-ta__badge {
	display: inline-block;
	min-width: 1.8em;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.78em;
	font-weight: 700;
	line-height: 1.6;
	text-align: center;
}

.fs-ta__badge--e {
	background: var(--fs-badge-e-bg);
	color: var(--fs-badge-e-color);
}

.fs-ta__badge--a {
	background: var(--fs-badge-a-bg);
	color: var(--fs-badge-a-color);
}

.fs-ta__noresult {
	margin: 1em 0 0;
	padding: 1em;
	text-align: center;
	background: var(--fs-row-bg-alt);
	border-radius: 6px;
}

.fs-ta__row.is-hidden,
.fs-ta__group.is-hidden {
	display: none !important;
}

/* ---------------------------------------------------------------- Teilen */

.fs-ta {
	position: relative;
}

/*
 * Kleine Box, die beim Überfahren einer Zeile erscheint. Keine eigene Spalte,
 * kein Button in der Tabelle – die Box schwebt über dem Inhalt.
 */
.fs-ta__sharebox {
	position: absolute;
	z-index: 30;
	padding: 12px 20px;
	white-space: nowrap;
	border: 1px solid var(--fs-border);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
	font-size: 0.9em;
	line-height: 1.55;
	color: var(--fs-row-color);
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.14s ease, transform 0.14s ease;
	pointer-events: none;
}

.fs-ta__sharebox[hidden] {
	display: none;
}

.fs-ta__sharebox.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}




.fs-ta__sharebox-options[hidden],
.fs-ta__sharebox-link[hidden] {
	display: none;
}

.fs-ta__sharebox-sep {
	margin: 0 8px;
	opacity: 0.4;
}

.fs-ta__sharebox-link,
.fs-ta__sharebox-option {
	color: var(--fs-accent);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.fs-ta__sharebox-link:hover,
.fs-ta__sharebox-option:hover,
.fs-ta__sharebox-link:focus-visible,
.fs-ta__sharebox-option:focus-visible {
	text-decoration: none;
	color: var(--fs-accent);
}


/* Zeile dezent hervorheben, solange die Box zu ihr gehört. */
.fs-ta__row.is-share-active {
	background: var(--fs-row-bg-hover) !important;
}

/* Touch-Geräte: kein Hover – die Box öffnet sich per Tippen auf die Zeile. */
@media (hover: none) {
	.fs-ta__sharebox {
		max-width: calc(100vw - 32px);
	}
}

/* --------------------------------------------------------- Zusatzblöcke  */

.fs-ta__extras {
	--fs-extras-cols: 3;
	display: grid;
	grid-template-columns: repeat(var(--fs-extras-cols), minmax(0, 1fr));
	gap: 20px;
	margin-top: 2em;
}

.fs-ta__card {
	background: var(--fs-card-bg);
	border: 1px solid var(--fs-border);
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.fs-ta__card-title {
	margin: 0;
	padding: 12px 16px;
	background: var(--fs-card-title-bg);
	color: var(--fs-card-title-color);
	font-size: 0.95em;
	font-weight: 700;
	line-height: 1.35;
	border-bottom: 2px solid var(--fs-accent);
}

.fs-ta__card-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fs-ta__card-list li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 16px;
	border-bottom: 1px solid var(--fs-border);
}

.fs-ta__card-list li:last-child {
	border-bottom: 0;
}

.fs-ta__card-label {
	display: block;
}

.fs-ta__card-note {
	display: block;
	font-size: 0.82em;
	opacity: 0.7;
}

.fs-ta__card-value {
	font-weight: 700;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- Legende  */

.fs-ta__legend {
	margin-top: 1.5em;
	font-size: 0.88em;
	line-height: 1.6;
}

.fs-ta__legend-title {
	font-weight: 700;
	margin-right: 0.5em;
}

.fs-ta__legend-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	list-style: none;
	margin: 0.4em 0 0;
	padding: 0;
}

.fs-ta__legend-list li {
	display: flex;
	align-items: baseline;
	gap: 6px;
	margin: 0;
}

.fs-ta__legend-key {
	font-weight: 700;
	text-decoration: none;
	border: 0;
	color: var(--fs-accent);
}

.fs-ta__legend-key::after {
	content: " =";
}

/* ------------------------------------------------------------ Responsive */

@media (max-width: 1024px) {
	.fs-ta__extras {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	/* Kompakter, damit die Tabelle ohne horizontales Scrollen passt
	   und die Kopfzeile sticky bleiben kann. */
	.fs-ta__table {
		font-size: 0.92em;
	}

	.fs-ta__table th,
	.fs-ta__table td {
		padding-left: 8px;
		padding-right: 8px;
	}

	.fs-ta__td--klasse,
	.fs-ta__td--aufteilung {
		min-width: 0;
	}
}

@media (max-width: 767px) {
	.fs-ta__extras {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Tabelle wird zur Kartenliste */
	.fs-ta__table,
	.fs-ta__table tbody,
	.fs-ta__table tr,
	.fs-ta__table td {
		display: block;
		width: 100%;
	}

	.fs-ta__table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.fs-ta__table tr.fs-ta__group {
		display: block;
	}

	.fs-ta__group th {
		display: block;
		position: static;
		border-radius: 6px;
		margin: 1.2em 0 0.6em;
	}

	.fs-ta__row {
		border: 1px solid var(--fs-border);
		border-radius: 8px;
		margin-bottom: 12px;
		padding: 4px 0;
		background: var(--fs-row-bg) !important;
	}

	.fs-ta__row--highlight {
		background: var(--fs-row-bg-highlight) !important;
	}

	.fs-ta__table td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 14px;
		text-align: right !important;
		white-space: normal;
		border-bottom: 1px dashed var(--fs-border);
	}

	.fs-ta__table td:last-child {
		border-bottom: 0;
	}

	.fs-ta__table td::before {
		content: attr(data-label);
		font-weight: 600;
		opacity: 0.65;
		text-align: left;
		flex: 0 0 auto;
	}

	.fs-ta__td--klasse {
		background: var(--fs-row-bg-alt);
		font-size: 1.05em;
	}

}

/* ---------------------------------------------------------------- Druck  */

@media print {
	.fs-ta__tools,
	.fs-ta__noresult {
		display: none !important;
	}

	.fs-ta {
		box-shadow: none !important;
	}

	.fs-ta__table {
		font-size: 10pt;
	}

	.fs-ta__row,
	.fs-ta__card {
		break-inside: avoid;
	}

	.fs-ta__table thead th {
		position: static !important;
		background: #eee !important;
		color: #000 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

/* ------------------------------------------------------------ A11y-Hilfe */

.fs-ta .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}
