/**
 * Compact floating labels for calculator inputs (when placeholders would vanish).
 * Modern skin only — Classic/legacy, Plain, and Card keep their native labels.
 */

.calorie_calculator_old .calcal-float-field__label,
.calorie_calculator_old .calcal-float-field__legend,
.calorie_calculator_plain .calcal-float-field__label,
.calorie_calculator_plain .calcal-float-field__legend,
.calorie_calculator_bootstrap .calcal-float-field__label,
.calorie_calculator_bootstrap .calcal-float-field__legend {
	display: none !important;
}

.calcal-float-field {
	--calcal-float-accent: var(--calcal-primary, #4db8a6);
	--calcal-float-accent-dark: var(--calcal-primary-dark, #1f6f64);
	--calcal-float-muted: #6b7f7a;
	position: relative !important;
}

/*
 * Floated labels sit half above the field border. The default 0.5em row gap
 * is only ~8px, so the chip collides with the row above and looks overlapping.
 * Give float rows enough air for the legend/label chip.
 */
/* Note: plugin CSS uses ".calcal_tab form" (class + element), not ".calcal_tabform". */
.calorie_calculator_general .calcal_tab form > div.calcal-float-field,
.calorie_calculator_general .calcal_tab form > div:has(> .calcal-float-field),
.calorie_calculator_general .calcal_tab form > .height_feet_inch.full_width,
.calorie_calculator_general .calcal_tab form > .name_field_container.full_width,
.calorie_calculator_bootstrap .calcal_tab form > div.calcal-float-field,
.calorie_calculator_bootstrap .calcal_tab form > div:has(> .calcal-float-field),
.calorie_calculator_bootstrap .calcal_tab form > .height_feet_inch.full_width,
.calorie_calculator_bootstrap .calcal_tab form > .name_field_container.full_width {
	margin-top: 1.15em !important;
	margin-bottom: 1.15em !important;
}

.calcal-float-field__label {
	position: absolute;
	z-index: 3;
	left: 0.7em;
	top: 50%;
	max-width: calc(100% - 1.4em);
	margin: 0;
	padding: 0 0.3em;
	border-radius: 4px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 0.92em;
	font-weight: 500;
	line-height: 1.2;
	color: var(--calcal-float-muted);
	background: transparent;
	transform: translateY(-50%);
	transform-origin: left center;
	pointer-events: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition:
		top 0.18s ease,
		transform 0.18s ease,
		color 0.18s ease,
		background-color 0.18s ease,
		font-size 0.18s ease,
		font-weight 0.18s ease;
}

.calcal-float-field.is-focused .calcal-float-field__label,
.calcal-float-field.is-filled .calcal-float-field__label {
	top: 0;
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--calcal-float-accent-dark);
	background: #fff;
	transform: translateY(-50%);
}

.calcal-float-field.is-focused .calcal-float-field__label {
	color: var(--calcal-float-accent-dark);
	box-shadow: 0 0 0 3px rgba(77, 184, 166, 0.08);
}

.calcal-float-field > input,
.calcal-float-field > select,
.calcal-float-field .calcalpro-custom-select-trigger {
	transition: padding 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.calcal-float-field.is-focused > input,
.calcal-float-field.is-filled > input,
.calcal-float-field.is-focused > select,
.calcal-float-field.is-filled > select {
	padding-top: 1.15em !important;
	padding-bottom: 0.4em !important;
}

.calcal-float-field > input::placeholder {
	color: transparent !important;
	opacity: 0 !important;
}

/* Split height (feet / inches) */
.calcal-float-field--split {
	flex: 1 1 calc(50% - 0.35em);
	min-width: 0;
	height: 100%;
}

/*
 * Joined flush split fields looked fine with native labels, but floated
 * chips collide with the shared vertical edge. Keep a small gutter and
 * restore both side borders on the inputs.
 */
.height_feet_inch.full_width,
.name_field_container.full_width {
	gap: 0.7em;
}

.height_feet_inch.full_width > .calcal-float-field--split > input,
.name_field_container.full_width > .calcal-float-field--split > input,
.name_field_container.full_width > .calcal-float-field > input {
	width: 100% !important;
	border-left-width: 1px !important;
	border-right-width: 1px !important;
}

.calorie_calculator_general .calcal_tab form .height_feet_inch.full_width > .calcal-float-field--split > input.calorie_calculator_height_feet,
.calorie_calculator_general .calcal_tab form .name_field_container.full_width > .calcal-float-field > input.last_name,
.calorie_calculator_general .calcal_tab form .name_field_container.full_width > .calcal-float-field--split > input.last_name {
	border-right: 1px solid RGBA(77, 184, 166, 1) !important;
	border-left: 1px solid RGBA(77, 184, 166, 1) !important;
}

/* Gender / choice groups: persistent legend chip */
.calcal-float-field--choice {
	display: flex !important;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.55em 0.85em;
	/* Match filled text-field air above the control (legend sits on the border). */
	padding-top: 1.15em !important;
	padding-bottom: 0.65em !important;
	height: auto !important;
	min-height: 52px !important;
	max-height: none !important;
	box-sizing: border-box !important;
}

/*
 * .full_width { height: 50px } would clip Gender in the editor/canvas.
 * Beat that rule with equal/higher specificity + !important.
 */
.calorie_calculator_general .calcal_tab form .full_width.calcal-float-field--choice,
.calorie_calculator_general .calcal_tab form .gender_field_wrapper.calcal-float-field--choice,
.calorie_calculator_general .gender_field_wrapper.full_width.calcal-float-field {
	height: auto !important;
	min-height: 52px !important;
	max-height: none !important;
	align-items: center !important;
}

.calcal-float-field__legend {
	position: absolute;
	z-index: 3;
	left: 0.7em;
	top: 0;
	margin: 0;
	padding: 0 0.3em;
	border-radius: 4px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.2;
	color: var(--calcal-float-accent-dark);
	background: #fff;
	transform: translateY(-50%);
}

/* Custom select trigger needs room for the floated label */
.calcal-float-field .calcalpro-custom-select {
	width: 100%;
}

/*
 * Match filled float inputs’ airy vertical rhythm.
 * Default trigger used line-height: 28px + height:auto, so Activity
 * looked shorter/tighter than Age/Weight even at the same padding.
 */
.calcal-float-field.is-filled .calcalpro-custom-select-trigger,
.calcal-float-field.is-focused .calcalpro-custom-select-trigger {
	padding-top: 1.15em !important;
	padding-bottom: 0.55em !important;
	height: 52px !important;
	min-height: 52px !important;
	line-height: 1.25 !important;
	align-items: flex-end;
	box-sizing: border-box !important;
}

.calorie_calculator_general .calcal_tab form .full_width.calcal-float-field:has(.calcalpro-custom-select) {
	height: 52px;
	align-items: stretch;
}

/* Keep the chevron centred on the control, not on the text baseline. */
.calcal-float-field .calcalpro-custom-select-trigger:after {
	top: 50%;
	margin-top: -3px;
}

@media (prefers-reduced-motion: reduce) {
	.calcal-float-field__label,
	.calcal-float-field > input,
	.calcal-float-field > select,
	.calcal-float-field .calcalpro-custom-select-trigger {
		transition: none !important;
	}
}
