.fpb-belegungsplan {
	--fpb-border: #e0e0e0;
	--fpb-bg: #fafafa;
	--fpb-text-muted: #666;
	--fpb-accent: #2c7a3f;
	margin: 1.5em 0;
	font-size: 15px;
}

.fpb-belegungsplan * {
	box-sizing: border-box;
}

.fpb-platz-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 1em;
	border-bottom: 2px solid var(--fpb-border);
}

.fpb-platz-tab {
	cursor: pointer;
	background: none;
	border: none;
	padding: 8px 14px;
	font-size: 0.9em;
	font-weight: 600;
	color: var(--fpb-text-muted);
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	white-space: nowrap;
}

.fpb-platz-tab:hover {
	color: var(--fpb-accent);
}

.fpb-platz-tab.is-active {
	color: var(--fpb-accent);
	border-bottom-color: var(--fpb-accent);
}

.fpb-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 1.25em;
}

.fpb-filter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--fpb-text-muted);
}

.fpb-filter select {
	font-size: 1em;
	padding: 6px 10px;
	min-width: 180px;
}

/* Wochenplan: Navigation */
.fpb-week-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-bottom: 1em;
	flex-wrap: wrap;
}

.fpb-week-nav-btn {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--fpb-border);
	border-radius: 4px;
	text-decoration: none;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--fpb-accent);
	background: #fff;
	white-space: nowrap;
}

.fpb-week-nav-btn:hover {
	background: var(--fpb-bg);
}

.fpb-week-label {
	font-weight: 700;
	font-size: 0.95em;
	min-width: 140px;
	text-align: center;
}

/* Wochenplan als Zeitraster (Kalendertage x Uhrzeit) */
.fpb-timegrid-scroll {
	overflow-x: auto;
	padding-bottom: 4px;
}

/*
 * Trägt die Mindestbreite für das gesamte Raster (Kopfzeile + Ganztagszeile +
 * Stundenraster gemeinsam), damit alle drei beim horizontalen Scrollen exakt
 * synchron bleiben. Der innere Scroll-Container darunter (body-scroll) bekommt
 * bewusst KEINE eigene Mindestbreite/kein eigenes overflow-x, sonst würde der
 * Browser dort zusätzlich zur äußeren eine zweite, unabhängige horizontale
 * Scrollleiste erzeugen (CSS-Spezifikation: overflow-x:visible zusammen mit
 * overflow-y:auto auf derselben Box wird automatisch zu overflow-x:auto).
 */
.fpb-timegrid-inner {
	/* 42px Stundenspalte + 7 x min. 84px Tagesspalten + 7 x 4px Spaltenabstand. */
	min-width: 658px;
}

.fpb-timegrid-headerrow,
.fpb-timegrid-alldayrow,
.fpb-timegrid-grid {
	display: grid;
	grid-template-columns: 42px repeat(7, minmax(84px, 1fr));
	column-gap: 4px;
}

/* Nur das Stundenraster scrollt vertikal – Kopfzeile und Ganztagszeile bleiben sichtbar. */
.fpb-timegrid-body-scroll {
	max-height: 60vh;
	overflow-y: auto;
	overflow-x: hidden;
}

.fpb-daycol-header {
	padding: 4px 0 8px;
	text-align: center;
	font-size: 0.85em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--fpb-text-muted);
	border-bottom: 2px solid var(--fpb-border);
}

.fpb-timegrid-alldayrow {
	margin-bottom: 4px;
}

.fpb-allday-cell {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.fpb-allday-bar {
	background: #fdecea;
	border: 1px solid #e5b4ac;
	border-left: 4px solid #c0392b;
	border-radius: 4px;
	padding: 3px 6px;
	font-size: 0.75em;
	font-weight: 600;
	color: #7a2418;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.fpb-allday-bar.fpb-hidden {
	display: none;
}

.fpb-timegrid-hourgutter {
	position: relative;
}

.fpb-hour-label {
	position: absolute;
	right: 6px;
	transform: translateY(-50%);
	font-size: 0.75em;
	color: var(--fpb-text-muted);
	white-space: nowrap;
}

.fpb-daycol-body {
	position: relative;
	background-image: linear-gradient(to bottom, var(--fpb-border) 1px, transparent 1px);
	background-size: 100% var(--fpb-hour-height, 90px);
	background-position: top left;
	background-repeat: repeat-y;
	border-left: 1px solid var(--fpb-border);
}

.fpb-entry {
	position: absolute;
	background: #fff;
	border: 1px solid var(--fpb-border);
	border-left: 4px solid var(--fpb-accent);
	border-radius: 4px;
	padding: 3px 6px;
	display: flex;
	flex-direction: column;
	gap: 1px;
	font-size: 0.72em;
	line-height: 1.25;
	overflow: hidden;
	cursor: pointer;
}

.fpb-entry:hover,
.fpb-allday-bar:hover {
	filter: brightness(0.97);
}

.fpb-entry:focus-visible,
.fpb-allday-bar:focus-visible {
	outline: 2px solid var(--fpb-accent);
	outline-offset: 1px;
}

.fpb-entry--sperre {
	background: #fdecea;
}

.fpb-entry--spiel {
	background: #eef6ff;
}

.fpb-entry.fpb-hidden {
	display: none;
}

.fpb-entry-zeit {
	font-weight: 700;
	white-space: nowrap;
}

.fpb-entry-team {
	font-weight: 600;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.fpb-entry-platz,
.fpb-entry-hinweis {
	color: var(--fpb-text-muted);
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.fpb-empty {
	color: var(--fpb-text-muted);
	font-size: 0.9em;
	text-align: center;
	padding: 16px 0;
}

.fpb-no-results {
	color: var(--fpb-text-muted);
	font-style: italic;
	padding: 12px 0;
}

/* Detail-Pop-up für Termine (v. a. relevant bei schmalen, überlappenden Kacheln) */
.fpb-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 100000;
}

/*
 * Ohne diese Regel gewinnt "display: flex" oben gegenüber dem impliziten
 * "[hidden] { display: none }" der Browser, weil beide dieselbe Spezifität
 * haben und Autoren-CSS das UA-Stylesheet schlägt – das Pop-up ließ sich dann
 * nicht mehr schließen.
 */
.fpb-modal-overlay[hidden] {
	display: none;
}

.fpb-modal {
	position: relative;
	background: #fff;
	border-radius: 8px;
	padding: 24px 22px 20px;
	max-width: 360px;
	width: 100%;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	font-size: 15px;
}

.fpb-modal-close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	color: var(--fpb-text-muted, #666);
	cursor: pointer;
	padding: 4px;
}

.fpb-modal-close:hover {
	color: #222;
}

.fpb-modal-typ {
	display: inline-block;
	margin-bottom: 10px;
	padding: 2px 10px;
	border-radius: 12px;
	background: var(--fpb-bg, #fafafa);
	color: var(--fpb-accent, #2c7a3f);
	font-size: 0.8em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.fpb-modal-row {
	margin-bottom: 8px;
	line-height: 1.4;
}

.fpb-modal-row strong {
	color: var(--fpb-text-muted, #666);
	font-weight: 600;
}

/* Hover-Vorschau (nur auf Geräten mit echtem Mauszeiger) */
.fpb-tooltip {
	position: absolute;
	z-index: 100001;
	background: #fff;
	border: 1px solid var(--fpb-border, #e0e0e0);
	border-radius: 6px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
	padding: 10px 12px;
	max-width: 260px;
	font-size: 13px;
	pointer-events: none;
}

.fpb-tooltip-typ {
	display: inline-block;
	margin-bottom: 6px;
	padding: 1px 8px;
	border-radius: 10px;
	background: var(--fpb-bg, #fafafa);
	color: var(--fpb-accent, #2c7a3f);
	font-size: 0.8em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.fpb-tooltip-row {
	margin-bottom: 4px;
	line-height: 1.35;
}

.fpb-tooltip-row:last-child {
	margin-bottom: 0;
}

.fpb-tooltip-row strong {
	color: var(--fpb-text-muted, #666);
	font-weight: 600;
}

/* Kompaktere Darstellung auf schmalen Bildschirmen (Smartphones) */
@media (max-width: 600px) {
	.fpb-belegungsplan {
		font-size: 13px;
	}

	.fpb-week-nav {
		gap: 8px;
	}

	.fpb-week-nav-btn {
		padding: 5px 9px;
		font-size: 0.8em;
	}

	.fpb-week-label {
		min-width: 100%;
		order: -1;
		margin-bottom: 4px;
	}

	.fpb-timegrid-body-scroll {
		max-height: 50vh;
	}

	.fpb-entry {
		font-size: 0.68em;
		padding: 2px 4px;
	}

	.fpb-tooltip {
		max-width: 200px;
		font-size: 12px;
	}
}

/* Bei wenig Höhe (z. B. Smartphone quer) noch etwas weniger Scroll-Fläche reservieren */
@media (max-height: 500px) {
	.fpb-timegrid-body-scroll {
		max-height: 45vh;
	}
}
