/**
 * Bootstrap component stand-ins -- loaded in "grid" asset mode only.
 *
 * In grid mode the plugin loads bootstrap-grid.min.css (grid + flex + spacing
 * utilities, no Reboot) instead of the full Bootstrap stylesheet, so Bootstrap's
 * global element resets can't leak out of the calculator and restyle the
 * Elementor header, footer or typography on the page.
 *
 * bootstrap-grid.css does NOT ship buttons, badges, forms, alerts, modals or the
 * text-align/width utilities the client markup uses, so they are provided here,
 * scoped to the calculator (.tfo-pricing-app) and to the program-info modal
 * (#ppi, which Bootstrap's JS relocates to <body>).
 *
 * Switch to "full" mode in Settings -> TFO Pricing if you would rather load the
 * complete Bootstrap 5.0.2 stylesheet.
 */

/* --- Utilities missing from bootstrap-grid ------------------------------- */

.tfo-pricing-app .text-center,
.tfo-pricing-modal .text-center {
	text-align: center !important;
}

.tfo-pricing-modal .float-end {
	float: right !important;
}

.tfo-pricing-app .text-end {
	text-align: right !important;
}

.tfo-pricing-app .text-start {
	text-align: left !important;
}

.tfo-pricing-app .w-100 {
	width: 100% !important;
}

.tfo-pricing-app .w-25 {
	width: 25% !important;
}

.tfo-pricing-app .mx-auto {
	margin-left: auto !important;
	margin-right: auto !important;
}

/* --- Buttons ------------------------------------------------------------- */

.tfo-pricing-app .btn,
.tfo-pricing-modal .btn,
#ppi .btn {
	display: inline-block;
	font-weight: 600;
	line-height: 1.5;
	text-align: center;
	text-decoration: none;
	vertical-align: middle;
	cursor: pointer;
	user-select: none;
	background-color: transparent;
	border: 1px solid transparent;
	padding: 10px 20px;
	font-size: 1rem;
	border-radius: 4px;
	transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.tfo-pricing-app .btn-light,
.tfo-pricing-modal .btn-light,
#ppi .btn-light {
	color: #212529;
	background-color: #f8f9fa;
	border-color: #f8f9fa;
}

.tfo-pricing-app .btn-primary,
.tfo-pricing-modal .btn-primary,
#ppi .btn-primary {
	color: #f7f3ee;
	background-color: var(--e-global-color-accent, #ff7d03);
	border-color: var(--e-global-color-accent, #ff7d03);
}

.tfo-pricing-app .btn-primary:hover,
.tfo-pricing-modal .btn-primary:hover,
#ppi .btn-primary:hover {
	color: #fff;
	background-color: var(--e-global-color-primary, #21004a);
	border-color: var(--e-global-color-primary, #21004a);
}

.tfo-pricing-modal .btn-close,
#ppi .btn-close {
	box-sizing: content-box;
	width: 1em;
	height: 1em;
	padding: 0.25em;
	background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
	border: 0;
	border-radius: 4px;
	opacity: 0.5;
	cursor: pointer;
}

/*
 * The factsheet modal's close button carries an inline <svg> instead, because
 * Elementor's lazy-load experiment blanks background images inside containers
 * it hasn't marked .e-lazyloaded. Drop the background so the two can't double
 * up, and size the icon.
 */
.tfo-pricing-modal .btn-close:has(svg) {
	background-image: none;
}

.tfo-pricing-modal .btn-close svg {
	display: block;
	width: 1em;
	height: 1em;
}

.tfo-pricing-modal .btn-close:hover,
#ppi .btn-close:hover {
	opacity: 0.85;
}

/* --- Badges -------------------------------------------------------------- */

.tfo-pricing-app .badge {
	display: inline-block;
	padding: 0.35em 0.65em;
	font-size: 0.75em;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	text-align: center;
	white-space: nowrap;
	vertical-align: baseline;
	border-radius: 4px;
}

.tfo-pricing-app .rounded-pill {
	border-radius: 50rem !important;
}

/* --- Forms --------------------------------------------------------------- */

.tfo-pricing-app .form-control,
.tfo-pricing-modal .form-control {
	display: block;
	width: 100%;
	padding: 0.5rem 0.75rem;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.5;
	color: #212529;
	background-color: #fff;
	background-clip: padding-box;
	border: 1px solid #ced4da;
	border-radius: 4px;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.tfo-pricing-app .form-control:focus,
.tfo-pricing-modal .form-control:focus,
.tfo-pricing-modal .form-select:focus {
	border-color: var(--e-global-color-secondary, #cba7ff);
	outline: 0;
	box-shadow: 0 0 0 0.25rem rgba(203, 167, 255, 0.35);
}

/*
 * .form-select is Bootstrap's styled <select>, used by the fleet-size dropdown
 * on the enquiry form. bootstrap-grid.css ships no form components at all, so
 * without this the dropdown renders as the browser's default control and sits
 * at a different height from the inputs beside it.
 *
 * The chevron is a background-image, which Elementor's lazy-load experiment can
 * blank (see .btn-close above). That is survivable here -- `appearance: none`
 * is what hides the browser's own arrow, so it is left ON for a select, and the
 * native arrow simply comes back if the chevron is stripped.
 */
.tfo-pricing-modal .form-select {
	display: block;
	width: 100%;
	padding: 0.5rem 2.25rem 0.5rem 0.75rem;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.5;
	color: #212529;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 16px 12px;
	border: 1px solid #ced4da;
	border-radius: 4px;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.tfo-pricing-app .input-group {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
}

.tfo-pricing-app .input-group > .form-control {
	position: relative;
	flex: 1 1 auto;
	width: 1%;
	min-width: 0;
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.tfo-pricing-app .input-group-text {
	display: flex;
	align-items: center;
	padding: 0.5rem 0.75rem;
	font-size: 1rem;
	color: #212529;
	background-color: #e9ecef;
	border: 1px solid #ced4da;
	border-left: 0;
	border-radius: 0 4px 4px 0;
}

.tfo-pricing-app .invalid-feedback,
.tfo-pricing-modal .invalid-feedback {
	width: 100%;
	margin-top: 0.25rem;
	font-size: 0.875em;
	color: #dc3545;
}

/* --- Alerts -------------------------------------------------------------- */

.tfo-pricing-app .alert,
.tfo-pricing-modal .alert {
	position: relative;
	padding: 1rem;
	margin-bottom: 1rem;
	border: 1px solid transparent;
	border-radius: 4px;
}

.tfo-pricing-app .alert-danger,
.tfo-pricing-modal .alert-danger {
	color: #842029;
	background-color: #f8d7da;
	border-color: #f5c2c7;
}

.tfo-pricing-app .alert-success,
.tfo-pricing-modal .alert-success {
	color: #0f5132;
	background-color: #d1e7dd;
	border-color: #badbcc;
}

.tfo-pricing-app .alert-info {
	color: #055160;
	background-color: #cff4fc;
	border-color: #b6effb;
}

/* --- Modal box model ----------------------------------------------------
 * bootstrap-grid.css ships no Reboot, so nothing sets box-sizing: border-box.
 * Without it the client's `width: 100%` form controls overflow the dialog and
 * their heights grow by the padding. Scoped to the modal so it cannot change
 * how the surrounding theme lays anything out.
 * ----------------------------------------------------------------------- */

.tfo-pricing-modal,
.tfo-pricing-modal *,
.tfo-pricing-modal *::before,
.tfo-pricing-modal *::after {
	box-sizing: border-box;
}

/* --- Floating labels ----------------------------------------------------
 * The factsheet form uses Bootstrap's .form-floating, which bootstrap-grid.css
 * does not ship -- without it the <label> renders below its input instead of
 * over it.
 * ----------------------------------------------------------------------- */

.tfo-pricing-modal .form-floating {
	position: relative;
}

.tfo-pricing-modal .form-floating > .form-control,
.tfo-pricing-modal .form-floating > .form-select {
	height: calc(3.5rem + 2px);
	line-height: 1.25;
	padding: 1rem 0.75rem;
}

.tfo-pricing-modal .form-floating > .form-select {
	padding-right: 2.25rem;
	padding-top: 1.625rem;
	padding-bottom: 0.625rem;
}

/*
 * A <textarea> has no single-line height to grow from, so it keeps the room its
 * rows attribute asks for and just makes space for the label at the top.
 */
.tfo-pricing-modal .form-floating > textarea.form-control {
	height: auto;
	min-height: calc(5.5rem + 2px);
	padding-top: 1.625rem;
	padding-bottom: 0.625rem;
	resize: vertical;
}

.tfo-pricing-modal .form-floating > label {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	padding: 1rem 0.75rem;
	pointer-events: none;
	border: 1px solid transparent;
	transform-origin: 0 0;
	transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
	margin: 0;
	color: inherit;
}

.tfo-pricing-modal .form-floating > .form-control::placeholder {
	color: transparent;
}

.tfo-pricing-modal .form-floating > .form-control:focus,
.tfo-pricing-modal .form-floating > .form-control:not(:placeholder-shown) {
	padding-top: 1.625rem;
	padding-bottom: 0.625rem;
}

.tfo-pricing-modal .form-floating > .form-control:focus ~ label,
.tfo-pricing-modal .form-floating > .form-control:not(:placeholder-shown) ~ label,
/*
 * A <select> is never :placeholder-shown, so its label has nowhere to sit but
 * the raised position -- which is right, because a select always shows either
 * a choice or the "Please choose..." prompt.
 */
.tfo-pricing-modal .form-floating > .form-select ~ label {
	opacity: 0.65;
	transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* --- Modals --------------------------------------------------------------
 * Class names and transition hooks match what Bootstrap's modal JS toggles
 * (display, .show, .modal-backdrop, body.modal-open) so the client's inline
 * show.bs.modal handlers keep working untouched.
 *
 * Two modals use these: #ppi, the calculator's program-info popup, and #dltfs,
 * the hardware factsheet download form. The rules are deliberately NOT scoped
 * to a single id -- `display: none` on .modal is what keeps a modal hidden
 * until it is opened, so a modal these rules miss renders inline on the page.
 * ----------------------------------------------------------------------- */

.tfo-pricing-modal.modal,
#ppi.modal {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1055;
	display: none;
	width: 100%;
	height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	outline: 0;
}

.tfo-pricing-modal.fade,
#ppi.fade {
	transition: opacity 0.15s linear;
}

.tfo-pricing-modal.fade:not(.show),
#ppi.fade:not(.show) {
	opacity: 0;
}

.tfo-pricing-modal .modal-dialog,
#ppi .modal-dialog {
	position: relative;
	width: auto;
	margin: 0.5rem;
	pointer-events: none;
}

.tfo-pricing-modal.fade .modal-dialog,
#ppi.fade .modal-dialog {
	transition: transform 0.3s ease-out;
	transform: translate(0, -50px);
}

.tfo-pricing-modal.show .modal-dialog,
#ppi.show .modal-dialog {
	transform: none;
}

.tfo-pricing-modal .modal-content,
#ppi .modal-content {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	pointer-events: auto;
	background-color: #fff;
	background-clip: padding-box;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 10px;
	outline: 0;
}

.tfo-pricing-modal .modal-header,
#ppi .modal-header {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	border-bottom: 1px solid #dee2e6;
	border-radius: 10px 10px 0 0;
}

.tfo-pricing-modal .modal-header .modal-title,
#ppi .modal-header .modal-title {
	margin: 0;
	line-height: 1.5;
}

.tfo-pricing-modal .modal-body,
#ppi .modal-body {
	position: relative;
	flex: 1 1 auto;
	padding: 1rem;
	line-height: 1.7;
}

.tfo-pricing-modal .modal-footer,
#ppi .modal-footer {
	display: flex;
	flex-wrap: wrap;
	flex-shrink: 0;
	align-items: center;
	justify-content: flex-end;
	padding: 0.75rem;
	border-top: 1px solid #dee2e6;
	border-radius: 0 0 10px 10px;
}

/* --- Vertically centred dialogs ------------------------------------------
 * Bootstrap's .modal-dialog-centered, which bootstrap-grid.css does not ship.
 * Both plugin modals use it -- the factsheet form sat against the top of the
 * window until 1.6.0.
 *
 * The `min-height` is what does the centring: .modal is a full-height scroll
 * container, so a dialog stretched to that height and using flex centring sits
 * in the middle, and a dialog taller than the window simply overflows and
 * scrolls as normal instead of having its top cut off.
 * ----------------------------------------------------------------------- */

.tfo-pricing-modal .modal-dialog-centered,
#ppi .modal-dialog-centered {
	display: flex;
	align-items: center;
	min-height: calc(100% - 1rem);
}

.tfo-pricing-modal .modal-dialog-centered > .modal-content,
#ppi .modal-dialog-centered > .modal-content {
	width: 100%;
}

@media (min-width: 576px) {
	.tfo-pricing-modal .modal-dialog,
	#ppi .modal-dialog {
		max-width: 500px;
		margin: 1.75rem auto;
	}

	.tfo-pricing-modal .modal-dialog-centered,
	#ppi .modal-dialog-centered {
		min-height: calc(100% - 3.5rem);
	}
}

/*
 * The rest of the enquiry form's own styling -- the wider dialog, the button
 * row, the terms line -- is in tfo-pricing.css rather than here, because that
 * stylesheet loads in every Bootstrap mode and none of it is a Bootstrap
 * stand-in.
 */

.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1050;
	width: 100vw;
	height: 100vh;
	background-color: #000;
}

.modal-backdrop.fade {
	opacity: 0;
	transition: opacity 0.15s linear;
}

.modal-backdrop.show {
	opacity: 0.5;
}

body.modal-open {
	overflow: hidden;
}
