/**
 * Booking Calendar display type — intentionally its OWN stylesheet,
 * separate from the --cm-* variable system frontend-core.css uses for
 * every other display type. Per spec ("exactamente este calendario"),
 * this design stays as its own fixed, self-contained look rather than
 * being re-themeable through the builder's Styles tab.
 *
 * All selectors are scoped under .cm-booking (the one wrapper
 * Booking_Renderer prints) instead of a page-wide #id, so more than one
 * booking form can sit on the same page without colliding.
 */

/**
 * Form_Renderer::wrap() always prints the generic .cm-form-wrapper box
 * (max-width: 650px, its own padding/background/border/shadow) around
 * EVERY display type, booking included. .cm-booking already brings its
 * own complete box styling below, so without this override a booking
 * form would get boxed-in twice — the outer wrapper's 650px cap and
 * padding squeezing it, on top of its own card. This neutralizes the
 * outer box down to a plain, unconstrained container so .cm-booking is
 * the only thing visually "boxed", and is free to fill 100% of whatever
 * column/section it's actually placed in (spec: responsive, not capped
 * like the old client-side-only widget happened to end up looking here).
 */
.cm-form-wrapper.cm-display-booking {
	max-width: none;
	width: 100%;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
}

.cm-booking {
	--bk-primary: #005dff;
	--bk-primary-hover: #0047c4;
	--bk-text: #17233b;
	--bk-muted: #6b7a99;
	--bk-border: #e3e8f2;
	--bk-bg-soft: #f4f7fd;
	--bk-success: #17b978;
	--bk-error: #e5485d;

	position: relative;
	width: 100%;
	background: #ffffff;
	border: 1px solid var(--bk-border);
	border-radius: 20px;
	box-shadow: 0 14px 40px rgba(23, 35, 59, 0.08);
	padding: 28px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	color: var(--bk-text);
	box-sizing: border-box;
}

.cm-booking *,
.cm-booking *::before,
.cm-booking *::after {
	box-sizing: border-box;
}

.cm-booking .booking-intro {
	text-align: center;
	margin-bottom: 18px;
}

.cm-booking .booking-intro.hidden {
	display: none;
}

.cm-booking .booking-main-title {
	margin: 0;
	font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
	font-size: 21px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--bk-text);
}

/* Progress indicator — 4 equal segments, filled up to the current step. */
.cm-booking .booking-progress {
	display: flex;
	gap: 6px;
	margin-bottom: 22px;
}

.cm-booking .progress-line {
	flex: 1 1 0;
	height: 4px;
	border-radius: 4px;
	background: var(--bk-border);
	transition: background-color 0.25s ease;
}

.cm-booking .progress-line.active {
	background: var(--bk-primary);
}

/* Steps — only the active one is shown. */
.cm-booking .booking-step {
	display: none;
}

.cm-booking .booking-step.active {
	display: block;
	animation: cmBookingFadeIn 0.2s ease;
}

@keyframes cmBookingFadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.cm-booking .back-button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	padding: 0;
	margin-bottom: 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--bk-muted);
	cursor: pointer;
}

.cm-booking .back-button:hover {
	color: var(--bk-primary);
}

/* Step 1 — date picker */
.cm-booking .month-navigation {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.cm-booking .month-nav-btn {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 1px solid var(--bk-border);
	background: #ffffff;
	color: var(--bk-text);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cm-booking .month-nav-btn:hover:not(:disabled) {
	background: var(--bk-bg-soft);
	border-color: var(--bk-primary);
}

.cm-booking .month-nav-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.cm-booking .month-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--bk-text);
}

.cm-booking .calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

.cm-booking .calendar-weekday {
	text-align: center;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--bk-muted);
	padding-bottom: 6px;
}

.cm-booking .calendar-day {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid transparent;
	border-radius: 10px;
	background: none;
	font-size: 13px;
	font-weight: 600;
	color: var(--bk-text);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cm-booking .calendar-day.empty {
	visibility: hidden;
	cursor: default;
}

.cm-booking .calendar-day:hover:not(:disabled):not(.empty) {
	background: var(--bk-bg-soft);
	border-color: var(--bk-primary);
}

.cm-booking .calendar-day.today {
	border-color: var(--bk-primary);
	color: var(--bk-primary);
}

.cm-booking .calendar-day.selected {
	background: var(--bk-primary);
	border-color: var(--bk-primary);
	color: #ffffff;
}

.cm-booking .calendar-day:disabled {
	color: #c3cce0;
	cursor: not-allowed;
}

/* Step 2 — time picker */
.cm-booking .step-description {
	font-size: 14px;
	font-weight: 600;
	color: var(--bk-text);
	margin: 0 0 14px;
}

.cm-booking .time-grid {
	display: grid;
	/* Fills whatever width the parent container gives .cm-booking (no
	   fixed column count) — a narrow sidebar column gets 2 per row, a
	   wide section gets 4-5, without any extra breakpoint needed. */
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 8px;
}

.cm-booking .time-button {
	padding: 11px 8px;
	border: 1px solid var(--bk-border);
	border-radius: 10px;
	background: #ffffff;
	font-size: 13px;
	font-weight: 600;
	color: var(--bk-text);
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cm-booking .time-button:hover {
	border-color: var(--bk-primary);
	color: var(--bk-primary);
}

.cm-booking .time-button.selected {
	background: var(--bk-primary);
	border-color: var(--bk-primary);
	color: #ffffff;
}

.cm-booking .no-times {
	text-align: center;
	padding: 4px 12px 0;
	font-size: 13px;
	color: var(--bk-muted);
}

.cm-booking .no-times:first-child {
	padding-top: 24px;
}

/* Step 3 — contact form */
.cm-booking .appointment-summary {
	background: var(--bk-bg-soft);
	border-radius: 12px;
	padding: 14px 16px;
	margin-bottom: 16px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--bk-text);
}

.cm-booking .appointment-summary strong {
	color: var(--bk-primary);
}

#custom-booking-form .cm-field {
	margin-bottom: 14px;
}

#custom-booking-form .cm-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--bk-text);
	margin-bottom: 6px;
}

#custom-booking-form .cm-required {
	color: var(--bk-error);
}

#custom-booking-form .cm-input {
	width: 100%;
	height: 46px;
	padding: 0 14px;
	border: 1px solid var(--bk-border);
	border-radius: 10px;
	font-size: 14px;
	font-family: inherit;
	color: var(--bk-text);
	background: #ffffff;
	transition: border-color 0.15s ease;
}

#custom-booking-form .cm-input:focus {
	outline: none;
	border-color: var(--bk-primary);
}

#custom-booking-form .cm-field-error {
	font-size: 12px;
	color: var(--bk-error);
	margin-top: 4px;
	min-height: 0;
}

#custom-booking-form .cm-field-invalid .cm-input {
	border-color: var(--bk-error);
}

.cm-booking .submit-button {
	width: 100%;
	height: 48px;
	border: none;
	border-radius: 10px;
	background: var(--bk-primary);
	color: #ffffff;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.cm-booking .submit-button:hover {
	background: var(--bk-primary-hover);
}

.cm-booking .submit-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.cm-booking .form-message {
	margin-top: 10px;
	font-size: 13px;
	text-align: center;
	min-height: 0;
}

.cm-booking .form-message.is-error {
	color: var(--bk-error);
}

.cm-booking .form-message.is-info {
	color: var(--bk-muted);
}

/* Step 4 — success */
.cm-booking.success-mode .booking-intro,
.cm-booking.success-mode .booking-progress {
	display: none;
}

.cm-booking .success-content {
	text-align: center;
	padding: 20px 4px 4px;
}

.cm-booking .success-icon {
	width: 56px;
	height: 56px;
	line-height: 56px;
	margin: 0 auto 16px;
	border-radius: 50%;
	background: var(--bk-success);
	color: #ffffff;
	font-size: 26px;
	animation: cmBookingPulse 1.4s ease-in-out infinite;
}

@keyframes cmBookingPulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(23, 185, 120, 0.35); }
	50%      { box-shadow: 0 0 0 10px rgba(23, 185, 120, 0); }
}

.cm-booking .step-title {
	margin: 0 0 8px;
	font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
	font-size: 19px;
	font-weight: 700;
	color: var(--bk-text);
}

.cm-booking .success-content .step-description {
	font-size: 14px;
	font-weight: 400;
	color: var(--bk-muted);
	margin-bottom: 16px;
}

@media (max-width: 480px) {
	.cm-booking {
		padding: 20px;
		border-radius: 16px;
	}
}
