/**
 * Booking Slot field: the booking card from Figma homepage v8, section
 * 09 "Book a call" (node 4184:33304), plus the Calendar Event field.
 *
 * Defaults are In Motion's colors (DESIGN.md ev4 tokens). Any site can
 * restyle the card by setting these variables on .gcal-booking, for
 * example in Elementor custom CSS:
 *
 *   .gcal-booking { --gcal-accent: #0f766e; --gcal-card-radius: 12px; }
 *
 * Type inherits the site font.
 *
 * @since 1.9.0
 */

.gcal-booking {
	--gcal-accent: #1a5fd6;          /* ev4/primary/primary */
	--gcal-accent-soft: rgba(26, 95, 214, 0.1);
	--gcal-accent-hover: rgba(26, 95, 214, 0.18);
	--gcal-on-accent: #ffffff;
	--gcal-ink: #0e1116;             /* card title */
	--gcal-heading: #232a33;         /* ev4/neutral/neutral-d-2 */
	--gcal-muted: #5b6472;           /* ev4/neutral/neutral */
	--gcal-meta: #4a5874;
	--gcal-icon: #1f2937;
	--gcal-line: #e3e8ee;            /* ev4/neutral/neutral-l-3 */
	--gcal-card: #ffffff;
	--gcal-card-radius: 24px;
	--gcal-panel-radius: 16px;

	container-type: inline-size;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 12px 12px 16px;
	background: var(--gcal-card);
	border-radius: var(--gcal-card-radius);
	color: var(--gcal-ink);
	text-align: left;
}

/* The card shows the field label as its title. */
.gfield--type-in_motion_booking_slot > .gfield_label,
.gfield--type-in_motion_booking_slot > legend.gfield_label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.gcal-booking p {
	margin: 0;
}

/* Header: title, step and progress. */
.gcal-booking__header {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 12px 12px 0;
}

.gcal-booking__title-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.gcal-booking__title {
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gcal-ink);
}

.gcal-booking__step {
	font-size: 14px;
	font-weight: 500;
	color: var(--gcal-muted);
	white-space: nowrap;
}

.gcal-booking__progress {
	display: flex;
	gap: 6px;
}

.gcal-booking__progress span {
	flex: 1;
	height: 4px;
	border-radius: 2px;
	background: var(--gcal-line);
}

.gcal-booking__progress span.is-done {
	background: var(--gcal-accent);
}

/* Panel: meeting, calendar, times, time zone. */
.gcal-booking__panel {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px 0;
	background: var(--gcal-card);
	border-radius: var(--gcal-panel-radius);
}

.gcal-booking__meeting {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 0 20px 16px;
	border-bottom: 1px solid var(--gcal-line);
}

.gcal-booking__meeting-name {
	font-size: 18px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--gcal-heading);
}

.gcal-booking__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	font-size: 14px;
	color: var(--gcal-meta);
}

.gcal-booking__meta-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.gcal-booking__meta-item:has(.gcal-booking__length:empty) {
	display: none;
}

.gcal-booking__icon {
	flex: none;
}

.gcal-booking__durations {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 20px;
}

.gcal-booking__picker {
	display: grid;
	grid-template-columns: minmax(0, 308px) minmax(132px, 162px);
	justify-content: space-between;
	gap: 24px;
	padding: 0 20px;
}

/* Calendar. */
.gcal-booking__calendar {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.gcal-booking__month-nav {
	display: grid;
	grid-template-columns: 44px 1fr 44px;
	align-items: center;
}

.gcal-booking__month-label {
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	color: var(--gcal-heading);
}

.gcal-booking__weekdays,
.gcal-booking__days {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	text-align: center;
}

.gcal-booking__weekday {
	height: 28px;
	line-height: 28px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	color: var(--gcal-muted);
}

.gcal-booking button.gcal-booking__nav,
.gcal-booking button.gcal-booking__day,
.gcal-booking button.gcal-booking__slot,
.gcal-booking button.gcal-booking__duration,
.gcal-booking button.gcal-booking__next-month {
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	cursor: pointer;
}

.gcal-booking button.gcal-booking__nav {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	color: var(--gcal-icon);
}

.gcal-booking button.gcal-booking__nav:not(:disabled):hover {
	background: var(--gcal-accent-soft);
}

.gcal-booking button.gcal-booking__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

.gcal-booking button.gcal-booking__day {
	display: grid;
	place-items: center;
	height: 44px;
	border-radius: 0;
}

.gcal-booking__day span {
	display: block;
	width: 36px;
	height: 36px;
	line-height: 36px;
	border-radius: 999px;
	font-size: 14px;
	color: var(--gcal-muted);
}

.gcal-booking button.gcal-booking__day[data-available] span {
	background: var(--gcal-accent-soft);
	color: var(--gcal-accent);
	font-weight: 600;
}

.gcal-booking button.gcal-booking__day[data-available]:hover span {
	background: var(--gcal-accent-hover);
}

.gcal-booking button.gcal-booking__day[aria-pressed="true"] span {
	background: var(--gcal-accent);
	color: var(--gcal-on-accent);
}

.gcal-booking button.gcal-booking__day:disabled {
	cursor: default;
}

.gcal-booking[data-state="loading"] .gcal-booking__days {
	opacity: 0.5;
}

/* Times. */
.gcal-booking__times {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.gcal-booking__times-date {
	min-height: 28px;
	line-height: 28px;
	font-size: 14px;
	font-weight: 600;
	color: var(--gcal-heading);
}

.gcal-booking__slots {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 316px;
	overflow-y: auto;
	/* Room for the selected/focus ring, which the scroll box would clip. */
	padding: 4px;
	margin: -4px;
}

.gcal-booking button.gcal-booking__more {
	grid-column: 1 / -1;
	height: 44px;
	border: 0;
	background: none;
	color: var(--gcal-accent);
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
}

.gcal-booking button.gcal-booking__slot,
.gcal-booking button.gcal-booking__duration,
.gcal-booking button.gcal-booking__next-month {
	flex: none;
	height: 44px;
	border-color: var(--gcal-accent);
	background: var(--gcal-card);
	color: var(--gcal-accent);
	font-size: 14px;
	font-weight: 600;
}

.gcal-booking button.gcal-booking__slot {
	width: 100%;
	text-transform: lowercase;
}

.gcal-booking button.gcal-booking__duration {
	height: 36px;
	padding: 0 16px;
}

.gcal-booking button.gcal-booking__next-month {
	padding: 0 16px;
}

.gcal-booking button.gcal-booking__slot:hover,
.gcal-booking button.gcal-booking__duration:hover,
.gcal-booking button.gcal-booking__next-month:hover {
	background: var(--gcal-accent-soft);
}

.gcal-booking button.gcal-booking__slot[aria-pressed="true"],
.gcal-booking button.gcal-booking__duration[aria-pressed="true"] {
	background: var(--gcal-accent);
	color: var(--gcal-on-accent);
}

.gcal-booking button:focus-visible {
	outline: 2px solid var(--gcal-accent);
	outline-offset: 2px;
}

.gcal-booking__hint,
.gcal-booking__loading,
.gcal-booking__empty,
.gcal-booking__error {
	font-size: 14px;
	line-height: 1.5;
	color: var(--gcal-muted);
}

.gcal-booking__error {
	font-weight: 600;
	color: #c62828;
}

/* Time zone: reads as one line of text, opens the full list. */
.gcal-booking__timezone {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	padding: 0 20px;
	font-size: 13px;
	color: var(--gcal-meta);
}

.gcal-booking__timezone label {
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
}

.gcal-booking select.gcal-booking__tz-select {
	appearance: none;
	-webkit-appearance: none;
	min-width: 0;
	max-width: 100%;
	height: auto;
	margin: 0;
	padding: 2px 20px 2px 0;
	border: 0;
	border-radius: 4px;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%234a5874' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E") no-repeat right center;
	box-shadow: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
	field-sizing: content;
}

.gcal-booking__note {
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	color: var(--gcal-muted);
}

/* Announced to screen readers; the pressed time already shows it. */
.gcal-booking__summary {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Phones: times move under the calendar in two columns; the step goes above the title. */
@container (max-width: 520px) {
	.gcal-booking__title-row {
		flex-direction: column-reverse;
		align-items: flex-start;
		gap: 4px;
	}

	.gcal-booking__picker {
		grid-template-columns: minmax(0, 1fr);
		gap: 8px;
	}

	.gcal-booking__slots {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		max-height: none;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.gcal-booking button,
	.gcal-booking__day span {
		transition: background-color 0.15s, border-color 0.15s, color 0.15s;
	}
}
