/* Ferienhaus-Kalender – calendar styles.
 * Colors come from CSS custom properties set inline on .fhk-calendar
 * (see backend settings). They can also be overridden in the theme. */

.fhk-calendar {
	--fhk-free: #4caf50;
	--fhk-provisional: #ff9800;
	--fhk-booked: #e53935;
	--fhk-past: #e0e0e0;
	--fhk-text: #fff;
	--fhk-text-past: #9e9e9e;
	--fhk-radius: 4px;
	--fhk-gap: 3px;
	box-sizing: border-box;
	width: 100%;
	font-size: 0.95rem;
	line-height: 1.2;
}

.fhk-calendar *,
.fhk-calendar *::before,
.fhk-calendar *::after {
	box-sizing: border-box;
}

.fhk-calendar__status--error {
	padding: 1rem;
	border: 1px solid #e53935;
	border-radius: var(--fhk-radius);
	background: #fdecea;
	color: #611a15;
	opacity: 1;
}

/* Navigation */
.fhk-calendar__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
}

.fhk-calendar__range {
	font-weight: 600;
	text-align: center;
	flex: 1;
}

.fhk-calendar__btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid currentColor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.8;
}

.fhk-calendar__btn:hover:not(:disabled),
.fhk-calendar__btn:focus-visible {
	opacity: 1;
}

.fhk-calendar__btn:disabled {
	opacity: 0.25;
	cursor: default;
}

/* Months */
.fhk-calendar__months {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 1.5rem;
}

.fhk-calendar__status {
	grid-column: 1 / -1;
	margin: 0;
	padding: 2rem 0;
	text-align: center;
	opacity: 0.7;
}

.fhk-month__title {
	margin-bottom: 0.5rem;
	font-weight: 600;
	text-align: center;
}

.fhk-month__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: var(--fhk-gap);
}

.fhk-wd {
	padding: 0.25rem 0;
	font-size: 0.8em;
	text-align: center;
	opacity: 0.7;
}

/* Days: top-left triangle = night before (am), bottom-right = night of the day (pm) */
.fhk-day {
	--fhk-am: var(--fhk-free);
	--fhk-pm: var(--fhk-free);
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	border-radius: var(--fhk-radius);
	background: linear-gradient(to bottom right, var(--fhk-am) 50%, var(--fhk-pm) 50%);
	color: var(--fhk-text);
	font-size: 0.85em;
	font-weight: 600;
	text-shadow: 0 0 2px rgba(0, 0, 0, 0.45);
	user-select: none;
}

.fhk-day--empty {
	background: none;
}

.fhk-am-provisional { --fhk-am: var(--fhk-provisional); }
.fhk-am-booked      { --fhk-am: var(--fhk-booked); }
.fhk-pm-provisional { --fhk-pm: var(--fhk-provisional); }
.fhk-pm-booked      { --fhk-pm: var(--fhk-booked); }

/* Past days (frontend): greyed out, occupancy hidden */
.fhk-calendar:not(.fhk-calendar--admin) .fhk-day--past {
	--fhk-am: var(--fhk-past);
	--fhk-pm: var(--fhk-past);
	color: var(--fhk-text-past);
	text-shadow: none;
}

/* Past days (admin): occupancy still visible, but dimmed */
.fhk-calendar--admin .fhk-day--past {
	opacity: 0.45;
}

.fhk-day--today {
	outline: 2px solid #333;
	outline-offset: 1px;
}

.fhk-day--clickable {
	cursor: pointer;
}

.fhk-day--clickable:hover {
	filter: brightness(0.9);
}

/* Legend */
.fhk-calendar__legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.5rem;
	margin: 1.25rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

.fhk-calendar__legend li {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
}

.fhk-swatch {
	display: inline-block;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 3px;
}

.fhk-swatch--free        { background: var(--fhk-free); }
.fhk-swatch--provisional { background: var(--fhk-provisional); }
.fhk-swatch--booked      { background: var(--fhk-booked); }
.fhk-swatch--half        { background: linear-gradient(to bottom right, var(--fhk-free) 50%, var(--fhk-booked) 50%); }
