/*
 * JBV Villa Dates — frontend.
 *
 * Status colours, the available-day background and the grid-line colour
 * come from Settings and are printed inline after this file (see
 * JBV_AV_Render::dynamic_css()). Months per row come from the
 * --jbv-av-cols* custom properties set on each calendar.
 *
 * Selectors are scoped under .jbv-av so theme table styles (Flatsome
 * pads and underlines every td/th) do not leak into the grid.
 */

.jbv-av {
	--jbv-av-gap-x: 1.25em;
	--jbv-av-gap-y: 1.5em;
	width: 100%;
	margin-bottom: 1.5em;
}

.jbv-av__title {
	text-align: center;
	margin-bottom: 0.8em;
}

.jbv-av__months {
	display: grid;
	grid-template-columns: repeat(var(--jbv-av-cols, 3), minmax(0, 1fr));
	gap: var(--jbv-av-gap-y) var(--jbv-av-gap-x);
}

@media (max-width: 849px) {
	.jbv-av__months {
		grid-template-columns: repeat(var(--jbv-av-cols-md, 3), minmax(0, 1fr));
	}
}

@media (max-width: 549px) {
	.jbv-av__months {
		grid-template-columns: repeat(var(--jbv-av-cols-sm, 2), minmax(0, 1fr));
	}
}

/* ---- One month ---------------------------------------------------- */

.jbv-av .jbv-av__month {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	border-spacing: 0;
	table-layout: fixed;
	font-size: 0.82rem;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.jbv-av .jbv-av__month caption {
	caption-side: top;
	padding: 0 0 0.35em;
	font-weight: 700;
	font-size: 1.1em;
	text-align: center;
	letter-spacing: 0.02em;
}

.jbv-av .jbv-av__month th {
	padding: 0.3em 0;
	border: 0;
	border-top: 1px solid currentColor;
	text-align: center;
	font-weight: 700;
	font-size: 0.9em;
	letter-spacing: 0;
	text-transform: uppercase;
}

.jbv-av .jbv-av__month td {
	padding: 0;
	border: 1px solid var(--jbv-av-border, #d6d6d6);
	background: var(--jbv-av-available, #fff);
	text-align: center;
	vertical-align: middle;
	height: 1.9em;
}

.jbv-av .jbv-av__month td.is-empty {
	background: transparent;
}

.jbv-av .jbv-av__month time {
	display: block;
}

/* Past dates stay visible but recede, so no-one reads a past open day as bookable. */
.jbv-av--dim-past .jbv-av__month td.is-past {
	opacity: 0.35;
}

/* ---- Legend ------------------------------------------------------- */

.jbv-av-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1.5em;
	margin: 0 0 1em;
	padding: 0;
	list-style: none;
}

.jbv-av-legend--center { justify-content: center; }
.jbv-av-legend--right  { justify-content: flex-end; }

.jbv-av-legend .jbv-av-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	margin: 0; /* themes indent list items in content (Flatsome: .col-inner ul li) */
	white-space: nowrap;
}

.jbv-av-legend__swatch {
	display: inline-block;
	width: 1.1em;
	height: 1.1em;
	border: 1px solid var(--jbv-av-border, #d6d6d6);
}

.jbv-av-legend__swatch.is-available {
	background: var(--jbv-av-available, #fff);
}

/* ---- Utilities ---------------------------------------------------- */

/* Themes normally ship this; defined here too so status text never shows by accident. */
.jbv-av .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.jbv-av-notice {
	padding: 0.75em 1em;
	border: 1px dashed #c00;
	color: #c00;
	font-size: 0.9em;
}

/* ---- Rates table -------------------------------------------------- */
/*
 * [jbv_rates]. Three-plus columns (season + dates, one per villa); the
 * dates sit under the season name so the table fits a phone without
 * scrolling. Scoped under .jbv-rates-wrap so theme table styles don't leak in.
 */

.jbv-rates-wrap {
	width: 100%;
	margin-bottom: 1.5em;
}

.jbv-rates-wrap .jbv-rates__title {
	text-align: center;
}

.jbv-rates-wrap .jbv-rates {
	width: 100%;
	border-collapse: collapse;
	margin: 1em 0 0;
}

.jbv-rates-wrap .jbv-rates caption {
	caption-side: bottom;
	padding-top: 0.8em;
	font-size: 0.85em;
	opacity: 0.7;
	text-align: center;
}

.jbv-rates-wrap .jbv-rates th,
.jbv-rates-wrap .jbv-rates td {
	padding: 1em 0.9em;
	border: 0;
	border-bottom: 1px solid var(--jbv-av-border, rgba(0, 0, 0, 0.08));
	vertical-align: middle;
	letter-spacing: normal;
	text-transform: none;
}

.jbv-rates-wrap .jbv-rates thead th {
	border-bottom-width: 2px;
	font-size: 1.15em;
	text-align: center;
}

.jbv-rates-wrap .jbv-rates thead th:first-child,
.jbv-rates-wrap .jbv-rates tbody th {
	text-align: left;
}

.jbv-rates-wrap .jbv-rates tbody th {
	font-weight: 600;
}

.jbv-rates-wrap .jbv-rates td {
	text-align: center;
	font-size: 1.25em;
	white-space: nowrap;
}

.jbv-rates-wrap .jbv-rates__unit,
.jbv-rates-wrap .jbv-rates__dates {
	display: block;
	font-size: 0.75em;
	font-weight: 400;
	opacity: 0.75;
}

.jbv-rates-wrap .jbv-rates__dates {
	font-size: 0.85em;
	white-space: nowrap;
}

@media (max-width: 549px) {
	.jbv-rates-wrap .jbv-rates th,
	.jbv-rates-wrap .jbv-rates td {
		padding: 0.8em 0.4em;
	}

	.jbv-rates-wrap .jbv-rates td {
		font-size: 1.05em;
	}
}
