/* FlovacRangePicker — time-range modal behind the #time-selector pill.
   Skin copied from the old customised daterangepicker: dark #424242 panel,
   #8d8989 borders, #009688 accent; text colour inherits from the app theme,
   the *_light themes only swap the panel background to white. */

/* Transparent click-catcher: the panel drops up from the trigger like the
   old daterangepicker did, so the page stays visible behind it. */
.flv-rp-overlay {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1000000; /* above #footer-time (999999) */
}

.flv-rp-overlay[hidden] {
	display: none;
}

.flv-rp-overlay,
.flv-rp-overlay * {
	box-sizing: border-box;
}

.flv-rp-panel {
	position: absolute;
	color: inherit;
	background: #424242;
	border: 1px solid #8d8989;
	border-radius: 4px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
	width: min(860px, calc(100vw - 16px));
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-size: 13px;
}

/* Quick drop-up on pill click: same two columns as the modal sidebar, but
   everything applies directly; the Custom button opens the full modal. */
.flv-rp-quick-panel {
	position: absolute;
	color: inherit;
	background: #424242;
	border: 1px solid #8d8989;
	border-radius: 4px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
	display: flex;
	max-height: 330px;
	overflow: hidden;
}

.app_theme_smartmc_light .flv-rp-panel,
.app_theme_flovac_light .flv-rp-panel,
.app_theme_vacuview_light .flv-rp-panel,
.app_theme_smartmc_light .flv-rp-quick-panel,
.app_theme_flovac_light .flv-rp-quick-panel,
.app_theme_vacuview_light .flv-rp-quick-panel {
	background: #fff;
}

/* Fixed height: the calendars are always 6 rows, and the preset/history
   columns scroll internally instead of growing the modal. */
.flv-rp-body {
	display: flex;
	overflow: hidden;
	flex: 1;
	height: 330px;
}

.flv-rp-sidebar {
	display: flex;
	border-right: 1px solid #8d8989;
}

/* Single-row date + time editors in the footer, next to the buttons. They
   read as plain text; clicking a part makes that part editable. The wrapper
   is layout-invisible on desktop and becomes its own row on mobile. */
.flv-rp-footer-times {
	display: contents;
}

.flv-rp-side {
	display: flex;
	align-items: center;
}

/* Same size as the day numbers in the picker, a bit bolder. */
.flv-rp-times-separator,
.flv-rp-datetime-separator {
	color: #999;
	font-size: 12px;
	font-weight: 600;
}

.flv-rp-times-separator {
	margin: 0 6px;
}

.flv-rp-datetime-separator {
	margin: 0 3px;
}

/* Fixed widths, snug to the content: 10 chars for the date, 5 for the time.
   Font matches the quick select / history lists. */
.flv-rp-date-input,
.flv-rp-side .flv-rp-time-input {
	background: transparent;
	border: none;
	color: inherit;
	font-family: inherit;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: center;
	padding: 2px 3px;
	border-radius: 2px;
	box-sizing: content-box;
}

.flv-rp-date-input {
	width: 10ch;
}

.flv-rp-side .flv-rp-time-input {
	width: 5ch;
}

.flv-rp-date-input:hover,
.flv-rp-side .flv-rp-time-input:hover {
	background: rgba(141, 137, 137, 0.25);
}

.flv-rp-date-input:focus,
.flv-rp-side .flv-rp-time-input:focus {
	outline: none;
	background: #fff;
	color: #000;
}

.flv-rp-list {
	padding: 12px 8px;
	width: 150px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow-y: auto;
}

.flv-rp-list + .flv-rp-list {
	border-left: 1px solid #8d8989;
	width: 170px;
}

.flv-rp-list-title {
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #999;
	padding: 0 8px 6px;
}

.flv-rp-item {
	display: block;
	width: 100%;
	text-align: left;
	background: none;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	padding: 5px 8px;
	font-size: 12px;
	color: inherit;
}

.flv-rp-item:hover {
	background: #eee;
	color: #424242;
}

.flv-rp-item-active,
.flv-rp-item-active:hover {
	background: #009688;
	color: #fff;
}

.flv-rp-preset-items,
.flv-rp-history-items,
.flv-rp-quick-presets,
.flv-rp-quick-history {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

/* History entry: from-block (date over time) aligned left, to-block aligned
   right, vertically centered. */
.flv-rp-history-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 8px;
}

.flv-rp-history-side {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	text-align: left;
	white-space: nowrap;
}

.flv-rp-history-side + .flv-rp-history-side {
	align-items: flex-end;
	text-align: right;
}

.flv-rp-history-date {
	font-variant-numeric: tabular-nums;
}

.flv-rp-history-time {
	font-size: 11px;
	color: #999;
	font-variant-numeric: tabular-nums;
}

/* A 'now' end — footer editor, history entries in both panels. Declared
   after the history styles so it wins the order tie. */
.flv-rp-now,
.flv-rp-side .flv-rp-time-input.flv-rp-now {
	font-style: italic;
	color: #009688;
}

.flv-rp-history-empty {
	padding: 5px 8px;
	color: #999;
}

.flv-rp-calendars {
	flex: 1;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	padding: 16px 20px;
}

.flv-rp-cal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.flv-rp-cal-month {
	font-weight: 500;
	text-align: center;
}

.flv-rp-nav {
	background: none;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 4px 10px;
	color: inherit;
}

.flv-rp-nav:hover {
	background: #eee;
	color: #424242;
}

.flv-rp-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
}

/* Always 6 rows of 30px so the panel height is identical for every month. */
.flv-rp-days {
	grid-template-rows: repeat(6, 30px);
}

.flv-rp-weekday {
	text-align: center;
	font-size: 11px;
	font-weight: bold;
	padding: 3px 0;
}

.flv-rp-day {
	background: none;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	height: 30px;
	font-size: 12px;
	color: inherit;
	font-variant-numeric: tabular-nums;
}

.flv-rp-day:hover {
	background: #eee;
	color: #424242;
}

/* Days between start and end get a soft tint; only the start and end days
   get the full accent colour. */
.flv-rp-day-inrange {
	background: rgba(0, 150, 136, 0.3);
	color: inherit;
}

.flv-rp-day-selected,
.flv-rp-day-selected:hover {
	background: #009688;
	color: #fff;
	font-weight: 600;
}

.flv-rp-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 16px;
	border-top: 1px solid #8d8989;
}


@media (max-width: 760px) {
	.flv-rp-panel {
		max-height: 92vh;
		max-height: 92dvh;
	}

	/* Stacked layout: the fixed desktop height doesn't apply; the body
	   scrolls as a whole instead. */
	.flv-rp-body {
		flex-direction: column;
		height: auto;
		min-height: 0;
		overflow-y: auto;
	}

	.flv-rp-sidebar {
		border-right: none;
		border-bottom: 1px solid #8d8989;
		flex: none;
	}

	/* Columns show at full height on mobile — the body scrolls as a whole. */
	.flv-rp-list {
		flex: 1;
		width: auto;
		min-width: 0;
		overflow-y: visible;
	}

	.flv-rp-calendars {
		grid-template-columns: 1fr;
	}

	.flv-rp-days {
		grid-template-rows: repeat(6, 38px);
	}

	.flv-rp-day {
		height: 38px;
	}

	/* Date/time editors get their own centered row above the buttons, with
	   the divider running the full panel width (past the footer padding). */
	.flv-rp-footer-times {
		display: flex;
		width: calc(100% + 32px);
		margin: 0 -16px;
		align-items: center;
		justify-content: center;
		gap: 8px;
		border-bottom: 1px solid #8d8989;
		padding-bottom: 8px;
	}

	.flv-rp-quick-panel {
		width: calc(100vw - 16px);
		max-height: 70vh;
		max-height: 70dvh;
	}

	/* The quick panel is height-capped, so its columns scroll internally,
	   sharing the screen width evenly. */
	.flv-rp-quick-panel .flv-rp-list {
		flex: 1;
		max-width: none;
		overflow-y: auto;
	}
}
