/* WT Schulkalender — Detail-CSS.
 * Die Grundwerte (Rahmen, Wochenleiste, ausgegraute Tage) entsprechen exakt
 * den Einstellungen der abgeloesten JetEngine-Kalender-Widgets.
 * Akzentfarben kommen ueber Elementor-Controls (Kit-Globals) bzw. aus den
 * Term-Farben der Taxonomie wt_event-kategorie (inline). */

.wt-cal {
	--wt-cal-border: #50637917;
	--wt-cal-week-bg: #5063791C;
	--wt-cal-disabled: #4B4B4A40;
	--wt-cal-today-bg: #3C4A5A;
	--wt-cal-tab-bg: #5063791C;
}

/* --- Schuljahr-Tabs ----------------------------------------------------- */

.wt-cal__tabs {
	display: flex;
	gap: 10px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.wt-cal__tab {
	flex: 1 1 0;
	min-width: 140px;
	border: 0;
	cursor: pointer;
	padding: 10px 16px;
	text-align: center;
	font-size: 15px;
	line-height: 1.4;
	background-color: var(--wt-cal-tab-bg);
	color: inherit;
	border-radius: 4px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wt-cal__tab.is-active {
	background-color: var(--wt-cal-today-bg);
	color: #fff;
}

.wt-cal__tab:not(.is-active):hover {
	background-color: #50637933;
}

.wt-cal__tab:focus-visible {
	outline: 2px solid var(--wt-cal-today-bg);
	outline-offset: 2px;
}

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

.wt-cal__legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 8px 18px;
	margin-bottom: 16px;
	font-size: 13px;
}

.wt-cal__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	line-height: 1.6;
	white-space: nowrap;
}

/* Swatch in der Form der Kalender-Balken */
.wt-cal__legend-swatch {
	display: inline-block;
	width: 24px;
	height: 8px;
	border-radius: 50px;
	flex: 0 0 auto;
}

/* --- Monatsraster ------------------------------------------------------- */

.wt-cal__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px 32px;
}

.wt-cal__month-title {
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
}

.wt-cal__table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	font-size: 14px;
}

.wt-cal__table th {
	background-color: var(--wt-cal-week-bg);
	font-weight: 400;
	font-size: 13px;
	padding: 3px 0;
	text-align: center;
	border: none;
}

.wt-cal__day {
	border: 1px solid var(--wt-cal-border);
	padding: 0;
	text-align: center;
	vertical-align: top;
	height: 38px;
}

.wt-cal__num {
	display: block;
	font-size: 14px;
	line-height: 22px;
	margin: 0 auto;
}

.wt-cal__day.is-today .wt-cal__num {
	background-color: var(--wt-cal-today-bg);
	color: #fff;
}

.wt-cal__day.is-other .wt-cal__num {
	color: var(--wt-cal-disabled);
}

/* --- Event-Pillen ------------------------------------------------------- */

.wt-cal__evts {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 0 2px 3px;
}

.wt-cal__evt {
	position: relative;
	display: block;
	height: 8px;
	border-radius: 50px;
	background-color: #50637933; /* Fallback ohne Kategorie-Farbe */
	cursor: pointer;
}

.wt-cal__evt:focus-visible {
	outline: 2px solid var(--wt-cal-today-bg);
	outline-offset: 1px;
}

/* Nachbarmonatstage: Events laufen gefadet weiter, bei Hover/Fokus voll. */
.wt-cal__day.is-other .wt-cal__evt {
	opacity: 0.35;
	transition: opacity 0.15s ease;
}

.wt-cal__day.is-other .wt-cal__evt:hover,
.wt-cal__day.is-other .wt-cal__evt:focus,
.wt-cal__day.is-other .wt-cal__evt:focus-visible {
	opacity: 1;
}

/* --- Tooltip ------------------------------------------------------------ */

.wt-cal__tip {
	position: absolute;
	bottom: calc(100% + 9px);
	left: 50%;
	transform: translateX(-50%) translateY(2px);
	background-color: #3C4A5A;
	color: #fff;
	font-size: 13px;
	line-height: 1.35;
	padding: 7px 11px;
	border-radius: 4px;
	white-space: normal;
	width: max-content;
	max-width: 190px;
	text-align: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 30;
	pointer-events: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.wt-cal__tip small {
	display: block;
	font-size: 11px;
	opacity: 0.85;
	margin-top: 2px;
}

.wt-cal__tip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: #3C4A5A;
}

.wt-cal__evt:hover .wt-cal__tip,
.wt-cal__evt:focus-visible .wt-cal__tip,
.wt-cal__evt:focus .wt-cal__tip {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

/* Tooltip-Ueberlauf an den Tabellenraendern verhindern */
.wt-cal__table td:first-child .wt-cal__tip {
	left: 0;
	transform: translateX(0) translateY(2px);
}

.wt-cal__table td:first-child .wt-cal__evt:hover .wt-cal__tip,
.wt-cal__table td:first-child .wt-cal__evt:focus .wt-cal__tip,
.wt-cal__table td:first-child .wt-cal__evt:focus-visible .wt-cal__tip {
	transform: translateX(0) translateY(0);
}

.wt-cal__table td:first-child .wt-cal__tip::after {
	left: 12px;
	transform: none;
}

.wt-cal__table td:last-child .wt-cal__tip {
	left: auto;
	right: 0;
	transform: translateX(0) translateY(2px);
}

.wt-cal__table td:last-child .wt-cal__evt:hover .wt-cal__tip,
.wt-cal__table td:last-child .wt-cal__evt:focus .wt-cal__tip,
.wt-cal__table td:last-child .wt-cal__evt:focus-visible .wt-cal__tip {
	transform: translateX(0) translateY(0);
}

.wt-cal__table td:last-child .wt-cal__tip::after {
	left: auto;
	right: 12px;
	transform: none;
}

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

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

@media (max-width: 767px) {
	.wt-cal__grid {
		grid-template-columns: 1fr;
		gap: 22px;
	}

	.wt-cal__tab {
		min-width: 100px;
		padding: 8px 10px;
		font-size: 14px;
	}

	.wt-cal__legend {
		justify-content: flex-start;
	}
}
