/*
 * FitNest Booker front-end styles.
 *
 * Works on light and dark themes alike:
 *  - Lines, muted text and shading are derived from the theme's own text colour
 *    (currentColor), so they stay visible whatever the page background is.
 *  - Anything with a fixed background (buttons, badges, notices, calendar entries,
 *    the details dialog) also sets its own text colour, so it never depends on the theme.
 *
 * Themes can override the variables below on `.fnb`.
 */

.fnb {
	--fnb-accent: #1f7a5a;       /* Primary buttons, booked state (white text on it). */
	--fnb-ok-bg: #e3f3eb;
	--fnb-ok-text: #145c43;
	--fnb-err-bg: #fbe9e9;
	--fnb-err-text: #8f1f1f;
	--fnb-surface-text: #1d2327; /* Text on light, fixed backgrounds. */
	--fnb-muted-opacity: 0.75;

	/* Fallbacks for browsers without color-mix(): mid-grey reads on both black and white. */
	--fnb-border: rgba(128, 128, 128, 0.55);
	--fnb-subtle: rgba(128, 128, 128, 0.14);
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	.fnb {
		--fnb-border: color-mix(in srgb, currentColor 35%, transparent);
		--fnb-subtle: color-mix(in srgb, currentColor 8%, transparent);
	}
}

.fnb-day {
	margin: 1.5em 0 0.5em;
}

.fnb-cards {
	display: grid;
	gap: 0.75rem;
}

.fnb-card {
	display: grid;
	grid-template-columns: 5.5rem 1fr auto;
	gap: 1rem;
	align-items: center;
	padding: 1rem;
	border: 1px solid var(--fnb-border);
	border-radius: 8px;
}

.fnb-card.is-booked {
	border-color: var(--fnb-accent);
	box-shadow: inset 4px 0 0 var(--fnb-accent);
}

.fnb-card.is-full {
	opacity: 0.7;
}

.fnb-card__time strong {
	display: block;
	font-size: 1.15em;
}

/* Muted text: fade the inherited colour instead of hard-coding a grey. */
.fnb-card__time span,
.fnb-card__meta,
.fnb-card__spots,
.fnb-booking__when,
.fnb-booking__meta,
.fnb-booking__hint,
.fnb-empty,
.fnb-cal-times span {
	opacity: var(--fnb-muted-opacity);
}

.fnb-card__time span,
.fnb-card__meta,
.fnb-card__spots,
.fnb-booking__when,
.fnb-booking__meta {
	font-size: 0.9em;
}

.fnb-card__title {
	margin: 0 0 0.25em;
	color: inherit;
}

.fnb-card__body p {
	margin: 0.15em 0;
}

.fnb-btn {
	cursor: pointer;
	padding: 0.5em 1.1em;
	border: 1px solid var(--fnb-border);
	border-radius: 6px;
	background: transparent;
	color: inherit; /* Buttons don't inherit text colour by default. */
	font: inherit;
}

.fnb-btn:hover:not(:disabled) {
	background: var(--fnb-subtle);
}

.fnb-btn--primary,
.fnb-btn--primary:hover:not(:disabled) {
	background: var(--fnb-accent);
	border-color: var(--fnb-accent);
	color: #fff;
}

.fnb-btn--primary:hover:not(:disabled) {
	filter: brightness(1.12);
}

.fnb-btn:focus-visible,
.fnb-room-chip:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.fnb-btn:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

.fnb-btn.is-loading {
	opacity: 0.6;
}

.fnb-badge {
	display: inline-block;
	padding: 0.2em 0.65em;
	border: 1px solid var(--fnb-border);
	border-radius: 999px;
	font-size: 0.85em;
	background: var(--fnb-subtle);
	color: inherit;
}

.fnb-badge--ok,
.fnb-badge--booked,
.fnb-badge--checked_in {
	border-color: transparent;
	background: var(--fnb-ok-bg);
	color: var(--fnb-ok-text);
}

.fnb-notice {
	margin: 0 0 1em;
	padding: 0.75em 1em;
	border-radius: 6px;
}

.fnb-notice--success {
	background: var(--fnb-ok-bg);
	color: var(--fnb-ok-text);
}

.fnb-notice--error {
	background: var(--fnb-err-bg);
	color: var(--fnb-err-text);
}

.fnb-login a {
	color: inherit;
	text-decoration: underline;
}

.fnb-bookings {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fnb-booking {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--fnb-border);
}

.fnb-booking.status-cancelled .fnb-booking__info {
	opacity: 0.6;
}

.fnb-booking__info > * {
	display: block;
}

.fnb-booking__hint {
	font-size: 0.85em;
	font-style: italic;
}

.fnb-booking__actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.fnb-push {
	margin-top: 2em;
}

.fnb-push label {
	display: flex;
	gap: 0.5em;
	align-items: center;
	margin-bottom: 0.5em;
}

.fnb-push input[type="text"] {
	padding: 0.4em 0.6em;
	border: 1px solid var(--fnb-border);
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
}

@media (max-width: 600px) {
	.fnb-card {
		grid-template-columns: 1fr;
	}
}

.fnb-card__deadline {
	font-size: 0.85em;
	font-style: italic;
	opacity: var(--fnb-muted-opacity);
}
