/* Farben (an WP Booking System / urlaub-anbieter.com angelehnt) */
.wpbs-ctv-wrapper,
.wpbs-ctv-table {
	--wpbs-ctv-free: #9ec68b;
	--wpbs-ctv-booked: #f09a9a;
	--wpbs-ctv-empty: #f5f5f5;
}

.wpbs-ctv-wrapper {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: visible;
	scroll-margin-top: 2rem;
	font-weight: 500;
}

.wpbs-ctv-wrapper .wpbs-ctv-house-title {
	font-weight: inherit;
}

/* Jahresnavigation */
.wpbs-ctv-year-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-bottom: 1rem;
}

.wpbs-ctv-year-nav__year {
	font-size: 1.5em;
	font-weight: 500;
	min-width: 4ch;
	text-align: center;
	color: #333;
}

.wpbs-ctv-year-nav__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
	color: #333;
	text-decoration: none;
	font-size: 1.75rem;
	line-height: 1;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.wpbs-ctv-year-nav__btn:hover,
.wpbs-ctv-year-nav__btn:focus {
	background: #f0f0f0;
	border-color: #999;
	color: #111;
}

.wpbs-ctv-year-nav__btn--disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
	background: #f5f5f5;
}

/* Responsive Wrapper (Frontend) */
.belegungstabelle-responsive-wrapper {
	display: block !important;
	width: 100% !important;
	max-width: 100%;
	min-width: 0;
	margin-left: 0;
	margin-right: 0;
	overflow-x: auto !important;
	overflow-y: visible;
	scroll-behavior: smooth;
	scroll-padding-left: 0;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	text-align: left;
}

.belegungstabelle-responsive-wrapper .wpbs-ctv-table {
	border-collapse: separate;
	border-spacing: 0;
	margin-left: 0 !important;
	margin-right: auto !important;
	transform: none !important;
}

.belegungstabelle-responsive-wrapper .wpbs-ctv-col-month {
	position: sticky;
	left: 0;
	z-index: 2;
	background-color: #fff;
	box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

.belegungstabelle-responsive-wrapper thead .wpbs-ctv-col-month {
	z-index: 3;
}

@media (max-width: 767px) {
	.belegungstabelle-responsive-wrapper .wpbs-ctv-table,
	.belegungstabelle-responsive-wrapper #Belegungstabelle.wpbs-ctv-table,
	.belegungstabelle-responsive-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table {
		table-layout: auto !important;
		width: max-content !important;
		max-width: none !important;
		margin-left: 0 !important;
		margin-right: auto !important;
		transform: none !important;
	}

	.belegungstabelle-responsive-wrapper .wpbs-ctv-table th,
	.belegungstabelle-responsive-wrapper .wpbs-ctv-table td,
	.belegungstabelle-responsive-wrapper #Belegungstabelle.wpbs-ctv-table th,
	.belegungstabelle-responsive-wrapper #Belegungstabelle.wpbs-ctv-table td,
	.belegungstabelle-responsive-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table th,
	.belegungstabelle-responsive-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table td {
		min-width: 35px !important;
	}

	.belegungstabelle-responsive-wrapper .wpbs-ctv-table td,
	.belegungstabelle-responsive-wrapper #Belegungstabelle.wpbs-ctv-table td,
	.belegungstabelle-responsive-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table td {
		width: auto !important;
	}

	.belegungstabelle-responsive-wrapper #Belegungstabelle.wpbs-ctv-table td:not(.tag-leer),
	.belegungstabelle-responsive-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table td:not(.tag-leer) {
		width: auto !important;
		min-width: 35px !important;
	}
}

/* Monatsspalte — ausgeschriebene Namen ohne Umbruch */
.wpbs-ctv-table .wpbs-ctv-col-month,
#Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month,
#Belegungstabelle-preview.wpbs-ctv-table .wpbs-ctv-col-month {
	min-width: 6.5rem;
	width: 6.5rem;
	white-space: nowrap;
	text-align: left;
	padding: 0.25em 0.5em;
	box-sizing: border-box;
}

.wpbs-ctv-wrapper .wpbs-ctv-col-month .month-short,
[id^="belegungskalender-"] .wpbs-ctv-col-month .month-short,
#Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month .month-short,
.belegungstabelle-responsive-wrapper .wpbs-ctv-col-month .month-short {
	display: none !important;
}

.wpbs-ctv-wrapper .wpbs-ctv-col-month .month-full,
[id^="belegungskalender-"] .wpbs-ctv-col-month .month-full,
#Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month .month-full,
.belegungstabelle-responsive-wrapper .wpbs-ctv-col-month .month-full {
	display: inline !important;
}

@media (max-width: 768px) {
	.wpbs-ctv-wrapper .wpbs-ctv-col-month .month-full,
	[id^="belegungskalender-"] .wpbs-ctv-col-month .month-full,
	#Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month .month-full,
	.belegungstabelle-responsive-wrapper .wpbs-ctv-col-month .month-full {
		display: none !important;
	}

	.wpbs-ctv-wrapper .wpbs-ctv-col-month .month-short,
	[id^="belegungskalender-"] .wpbs-ctv-col-month .month-short,
	#Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month .month-short,
	.belegungstabelle-responsive-wrapper .wpbs-ctv-col-month .month-short {
		display: inline !important;
	}

	.wpbs-ctv-table .wpbs-ctv-col-month,
	#Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month,
	.belegungstabelle-responsive-wrapper .wpbs-ctv-col-month {
		min-width: 3rem;
		width: 3rem;
	}
}

.wpbs-ctv-table,
#Belegungstabelle.wpbs-ctv-table,
#Belegungstabelle-preview.wpbs-ctv-table {
	border-collapse: collapse;
	table-layout: fixed;
	width: 100%;
	max-width: 100%;
}

.wpbs-ctv-table th,
.wpbs-ctv-table td,
#Belegungstabelle.wpbs-ctv-table th,
#Belegungstabelle.wpbs-ctv-table td,
#Belegungstabelle-preview.wpbs-ctv-table th,
#Belegungstabelle-preview.wpbs-ctv-table td {
	border: 1px solid #ccc;
	text-align: center;
	padding: 0;
	vertical-align: middle;
	font-weight: 500;
}

.wpbs-ctv-table thead tr th,
#Belegungstabelle.wpbs-ctv-table thead tr th,
#Belegungstabelle-preview.wpbs-ctv-table thead tr th,
.belegungstabelle-responsive-wrapper [id^="Belegungstabelle"].wpbs-ctv-table thead tr th {
	background-color: #ffffff;
}

.wpbs-ctv-table td,
#Belegungstabelle.wpbs-ctv-table td,
#Belegungstabelle-preview.wpbs-ctv-table td {
	width: 1.8em;
	height: 1.8em;
	aspect-ratio: 1;
	position: relative;
}

/* Tageszahl in der Zelle (Basis) */
.wpbs-ctv-day-num {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	color: #ffffff;
	font-weight: 500;
	line-height: 1;
	text-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
}

/*
 * Frontend (#Belegungstabelle): feste Schriftgröße, 2px Abstand zum Zellrand.
 */
#Belegungstabelle.wpbs-ctv-table td:not(.tag-leer) {
	width: 2rem;
	height: 2rem;
	min-width: 2rem;
	padding: 2px;
	box-sizing: border-box;
}

#Belegungstabelle.wpbs-ctv-table th {
	color: #333;
}

/* Frontend: Kopfzeile (Tageszahlen) und Monatsspalte */
.wpbs-ctv-wrapper #Belegungstabelle.wpbs-ctv-table thead tr th,
.wpbs-ctv-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table thead tr th,
[id^="belegungskalender-"] #Belegungstabelle.wpbs-ctv-table thead tr th,
[id^="belegungskalender-"] [id^="Belegungstabelle-"].wpbs-ctv-table thead tr th {
	font-size: 1rem;
}

.wpbs-ctv-wrapper #Belegungstabelle.wpbs-ctv-table .wpbs-ctv-col-month,
.wpbs-ctv-wrapper [id^="Belegungstabelle-"].wpbs-ctv-table .wpbs-ctv-col-month,
[id^="belegungskalender-"] .wpbs-ctv-col-month {
	font-size: 1rem;
}

#Belegungstabelle .wpbs-ctv-day-num {
	font-size: 1rem;
	line-height: 1;
	padding: 0;
	text-shadow: none;
}

/* Vollständig frei */
.wpbs-ctv-table .tag-frei,
#Belegungstabelle .tag-frei,
#Belegungstabelle-preview .tag-frei {
	background-color: var(--wpbs-ctv-free);
}

/* Vollständig belegt */
.wpbs-ctv-table .tag-belegt,
#Belegungstabelle .tag-belegt,
#Belegungstabelle-preview .tag-belegt {
	background-color: var(--wpbs-ctv-booked);
}

/* Ungültiger Tag (z. B. 31. Februar) — transparente Auffüllzellen */
.wpbs-ctv-table .tag-leer,
#Belegungstabelle .tag-leer,
#Belegungstabelle-preview .tag-leer,
.belegungstabelle-responsive-wrapper .tag-leer {
	background-color: transparent;
}

/*
 * Anreisetag: oben/links frei, unten/rechts belegt
 */
.wpbs-ctv-table .tag-anreise,
#Belegungstabelle .tag-anreise,
#Belegungstabelle-preview .tag-anreise {
	background: linear-gradient(135deg, var(--wpbs-ctv-free) 50%, var(--wpbs-ctv-booked) 50%);
}

/*
 * Abreisetag: oben/links belegt, unten/rechts frei
 */
.wpbs-ctv-table .tag-abreise,
#Belegungstabelle .tag-abreise,
#Belegungstabelle-preview .tag-abreise {
	background: linear-gradient(135deg, var(--wpbs-ctv-booked) 50%, var(--wpbs-ctv-free) 50%);
}

/* Touch-Tooltips für Kalendertage (Frontend) */
.calendar-day {
	position: relative;
}

@media (hover: none), (pointer: coarse) {
	.calendar-day[data-tooltip] {
		-webkit-tap-highlight-color: transparent;
	}

	.calendar-day.calendar-day--tooltip-visible::after {
		content: attr(data-tooltip);
		position: absolute;
		left: 50%;
		bottom: calc(100% + 16px);
		transform: translateX(-50%);
		z-index: 20;
		padding: 0.45rem 0.65rem;
		background: rgba(29, 35, 39, 0.92);
		color: #ffffff;
		font-size: 0.75rem;
		font-weight: 500;
		line-height: 1.3;
		white-space: nowrap;
		border-radius: 4px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
		pointer-events: none;
	}

	.calendar-day.calendar-day--tooltip-visible::before {
		content: '';
		position: absolute;
		left: 50%;
		bottom: calc(100% + 4px);
		transform: translateX(-50%);
		z-index: 20;
		border: 6px solid transparent;
		border-top-color: rgba(29, 35, 39, 0.92);
		pointer-events: none;
	}
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
