/*
 * Global HubSpot form styling
 *
 * Supports both legacy HubSpot embeds and newer forms using
 * the data-hs-forms-root attribute.
 */

.hbspt-form,
[data-hs-forms-root='true'] {
	width: 100%;
	max-width: 100%;
}

.hbspt-form .hs-form,
[data-hs-forms-root='true'] .hs-form {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	width: 100%;
	margin: 0;
}

/* Fieldsets */

.hbspt-form fieldset,
[data-hs-forms-root='true'] fieldset {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
}

.hbspt-form fieldset > .hs-form-field,
[data-hs-forms-root='true'] fieldset > .hs-form-field {
	flex: 1 1 0;
	width: 100% !important;
	min-width: 0;
	margin: 0;
}

.hbspt-form fieldset.form-columns-1,
.hbspt-form fieldset.form-columns-2,
.hbspt-form fieldset.form-columns-3,
[data-hs-forms-root='true'] fieldset.form-columns-1,
[data-hs-forms-root='true'] fieldset.form-columns-2,
[data-hs-forms-root='true'] fieldset.form-columns-3 {
	flex-direction: column;
}

/* Field wrappers */

.hbspt-form .hs-form-field,
[data-hs-forms-root='true'] .hs-form-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	width: 100%;
	margin: 0;
}

/* Labels */

.hbspt-form .hs-form-field > label,
[data-hs-forms-root='true'] .hs-form-field > label {
	display: block;
	margin: 0;
	color: #535862;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.5;
}

.hbspt-form .hs-form-required,
[data-hs-forms-root='true'] .hs-form-required {
	margin-left: 0.125rem;
	color: #d92d20;
}

/* Text, email, phone, date, select and textarea fields */

.hbspt-form input.hs-input[type='text'],
.hbspt-form input.hs-input[type='email'],
.hbspt-form input.hs-input[type='tel'],
.hbspt-form input.hs-input[type='number'],
.hbspt-form input.hs-input[type='password'],
.hbspt-form input.hs-input[type='url'],
.hbspt-form input.hs-input[type='search'],
.hbspt-form input.hs-input[type='date'],
.hbspt-form input.hs-input[type='datetime-local'],
.hbspt-form input.hs-input[type='month'],
.hbspt-form input.hs-input[type='time'],
.hbspt-form input.hs-input[type='week'],
.hbspt-form input.hs-input:not([type]),
.hbspt-form select.hs-input,
.hbspt-form textarea.hs-input,
[data-hs-forms-root='true'] input.hs-input[type='text'],
[data-hs-forms-root='true'] input.hs-input[type='email'],
[data-hs-forms-root='true'] input.hs-input[type='tel'],
[data-hs-forms-root='true'] input.hs-input[type='number'],
[data-hs-forms-root='true'] input.hs-input[type='password'],
[data-hs-forms-root='true'] input.hs-input[type='url'],
[data-hs-forms-root='true'] input.hs-input[type='search'],
[data-hs-forms-root='true'] input.hs-input[type='date'],
[data-hs-forms-root='true'] input.hs-input[type='datetime-local'],
[data-hs-forms-root='true'] input.hs-input[type='month'],
[data-hs-forms-root='true'] input.hs-input[type='time'],
[data-hs-forms-root='true'] input.hs-input[type='week'],
[data-hs-forms-root='true'] input.hs-input:not([type]),
[data-hs-forms-root='true'] select.hs-input,
[data-hs-forms-root='true'] textarea.hs-input {
	width: 100% !important;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 0.625rem 0.875rem;
	border: 1px solid #d5d7da;
	border-radius: 0.5rem;
	background-color: #fff;
	color: var(--wp--preset--color--primary);
	box-shadow: 0 1px 2px rgba(10, 13, 18, 0.05);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 1rem;
	line-height: 1.25;
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s ease;
}

.hbspt-form .hs-input::placeholder,
[data-hs-forms-root='true'] .hs-input::placeholder {
	color: #717680;
	opacity: 1;
}

.hbspt-form .hs-input:hover,
[data-hs-forms-root='true'] .hs-input:hover {
	border-color: #a4a7ae;
}

.hbspt-form .hs-input:focus,
.hbspt-form .hs-input:focus-visible,
[data-hs-forms-root='true'] .hs-input:focus,
[data-hs-forms-root='true'] .hs-input:focus-visible {
	outline: none;
	border-color: var(--wp--preset--color--secondary);
	box-shadow: 0 0 0 3px rgba(40, 164, 126, 0.15);
}

.hbspt-form .hs-input:disabled,
.hbspt-form .hs-input[readonly],
[data-hs-forms-root='true'] .hs-input:disabled,
[data-hs-forms-root='true'] .hs-input[readonly] {
	cursor: not-allowed;
	background-color: #f5f5f5;
	color: #717680;
}

/* Hidden HubSpot fields */

.hbspt-form input[type='hidden'],
.hbspt-form .hs-dependent-field[hidden],
[data-hs-forms-root='true'] input[type='hidden'],
[data-hs-forms-root='true'] .hs-dependent-field[hidden] {
	display: none !important;
}

/* Select fields */

.hbspt-form .hs-fieldtype-select .input,
[data-hs-forms-root='true'] .hs-fieldtype-select .input {
	position: relative;
}

.hbspt-form select.hs-input,
[data-hs-forms-root='true'] select.hs-input {
	appearance: none;
	padding-right: 2.75rem;
	cursor: pointer;
	background-image:
		linear-gradient(45deg, transparent 50%, #535862 50%),
		linear-gradient(135deg, #535862 50%, transparent 50%);
	background-position:
		calc(100% - 1.125rem) 50%,
		calc(100% - 0.875rem) 50%;
	background-size:
		0.375rem 0.375rem,
		0.375rem 0.375rem;
	background-repeat: no-repeat;
}

.hbspt-form select[multiple].hs-input,
[data-hs-forms-root='true'] select[multiple].hs-input {
	min-height: 8rem;
	padding-right: 0.875rem;
	background-image: none;
}

/* Textareas */

.hbspt-form textarea.hs-input,
[data-hs-forms-root='true'] textarea.hs-input {
	min-height: 10rem;
	resize: vertical;
}

/* Phone fields */

.hbspt-form .hs-fieldtype-phonenumber .input,
[data-hs-forms-root='true'] .hs-fieldtype-phonenumber .input {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.hbspt-form .hs-fieldtype-phonenumber select.hs-input,
[data-hs-forms-root='true'] .hs-fieldtype-phonenumber select.hs-input {
	flex: 0 0 auto;
	width: auto !important;
	min-width: 7rem;
}

.hbspt-form .hs-fieldtype-phonenumber input.hs-input,
[data-hs-forms-root='true'] .hs-fieldtype-phonenumber input.hs-input {
	flex: 1 1 12rem;
}

/* Checkbox and radio lists */

.hbspt-form .inputs-list,
[data-hs-forms-root='true'] .inputs-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	list-style: none;
	margin: 0.25rem 0 0;
	padding: 0;
}

.hbspt-form .inputs-list li,
[data-hs-forms-root='true'] .inputs-list li {
	margin: 0;
	padding: 0;
}

.hbspt-form .hs-form-checkbox-display,
.hbspt-form .hs-form-radio-display,
.hbspt-form .hs-form-booleancheckbox-display,
[data-hs-forms-root='true'] .hs-form-checkbox-display,
[data-hs-forms-root='true'] .hs-form-radio-display,
[data-hs-forms-root='true'] .hs-form-booleancheckbox-display {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	margin: 0;
	color: #535862;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.875rem;
	line-height: 1.5;
	cursor: pointer;
}

.hbspt-form input[type='checkbox'].hs-input,
.hbspt-form input[type='radio'].hs-input,
[data-hs-forms-root='true'] input[type='checkbox'].hs-input,
[data-hs-forms-root='true'] input[type='radio'].hs-input {
	flex: 0 0 auto;
	width: 1.125rem !important;
	height: 1.125rem;
	margin: 0.125rem 0 0;
	border: 1px solid #a4a7ae;
	accent-color: var(--wp--preset--color--secondary);
	cursor: pointer;
}

/* File uploads */

.hbspt-form input[type='file'].hs-input,
[data-hs-forms-root='true'] input[type='file'].hs-input {
	width: 100% !important;
	box-sizing: border-box;
	padding: 0.625rem;
	border: 1px dashed #a4a7ae;
	border-radius: 0.5rem;
	background: #fafafa;
	color: #535862;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.875rem;
	cursor: pointer;
}

.hbspt-form input[type='file'].hs-input::file-selector-button,
[data-hs-forms-root='true']
	input[type='file'].hs-input::file-selector-button {
	margin-right: 0.75rem;
	padding: 0.5rem 0.75rem;
	border: 0;
	border-radius: 0.375rem;
	background: #ececed;
	color: var(--wp--preset--color--primary);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

/* Descriptions and consent text */

.hbspt-form .hs-field-desc,
.hbspt-form .hs-form-help-text,
[data-hs-forms-root='true'] .hs-field-desc,
[data-hs-forms-root='true'] .hs-form-help-text {
	margin: 0;
	color: #717680;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.75rem;
	line-height: 1.5;
}

.hbspt-form .legal-consent-container,
[data-hs-forms-root='true'] .legal-consent-container {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	color: #535862;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.75rem;
	line-height: 1.5;
}

.hbspt-form .legal-consent-container p,
[data-hs-forms-root='true'] .legal-consent-container p {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

.hbspt-form .legal-consent-container a,
[data-hs-forms-root='true'] .legal-consent-container a {
	color: var(--wp--preset--color--secondary);
	text-decoration: underline;
	text-underline-offset: 0.125rem;
}

/* Validation */

.hbspt-form .hs-input.invalid,
.hbspt-form .hs-input.error,
[data-hs-forms-root='true'] .hs-input.invalid,
[data-hs-forms-root='true'] .hs-input.error {
	border-color: #d92d20 !important;
}

.hbspt-form .hs-error-msgs,
[data-hs-forms-root='true'] .hs-error-msgs {
	width: 100%;
	list-style: none;
	margin: 0.25rem 0 0;
	padding: 0;
}

.hbspt-form .hs-error-msg,
.hbspt-form .hs-main-font-element,
[data-hs-forms-root='true'] .hs-error-msg,
[data-hs-forms-root='true'] .hs-main-font-element {
	color: #d92d20;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.75rem;
	line-height: 1.5;
}

.hbspt-form .hs_error_rollup,
[data-hs-forms-root='true'] .hs_error_rollup {
	padding: 0.75rem 1rem;
	border: 1px solid #fda29b;
	border-radius: 0.5rem;
	background: #fef3f2;
}

/* Submit button */

.hbspt-form .hs-submit,
[data-hs-forms-root='true'] .hs-submit {
	margin: 0;
}

.hbspt-form .hs-submit .actions,
[data-hs-forms-root='true'] .hs-submit .actions {
	display: flex;
	margin: 0;
	padding: 0;
}

.hbspt-form input[type='submit'].hs-button,
[data-hs-forms-root='true'] input[type='submit'].hs-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin: 0;
	padding: 1rem 1.5rem;
	border: 2px solid rgba(255, 255, 255, 0.12);
	border-radius: 1rem;
	background: #28a47e;
	color: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25;
	cursor: pointer;
	transition:
		background-color 0.2s ease,
		box-shadow 0.2s ease;
}

.hbspt-form input[type='submit'].hs-button:hover,
[data-hs-forms-root='true'] input[type='submit'].hs-button:hover {
	background: #239170;
}

.hbspt-form input[type='submit'].hs-button:focus-visible,
[data-hs-forms-root='true'] input[type='submit'].hs-button:focus-visible {
	outline: 3px solid rgba(40, 164, 126, 0.25);
	outline-offset: 2px;
}

.hbspt-form input[type='submit'].hs-button:disabled,
[data-hs-forms-root='true'] input[type='submit'].hs-button:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

/* Rich text and success messages */

.hbspt-form .hs-richtext,
[data-hs-forms-root='true'] .hs-richtext {
	color: #535862;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.875rem;
	line-height: 1.6;
}

.hbspt-form .hs-richtext p:first-child,
[data-hs-forms-root='true'] .hs-richtext p:first-child {
	margin-top: 0;
}

.hbspt-form .hs-richtext p:last-child,
[data-hs-forms-root='true'] .hs-richtext p:last-child {
	margin-bottom: 0;
}

.hbspt-form .hs-richtext a,
[data-hs-forms-root='true'] .hs-richtext a {
	color: var(--wp--preset--color--secondary);
}

.hbspt-form .submitted-message,
[data-hs-forms-root='true'] .submitted-message {
	color: var(--wp--preset--color--primary);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 1rem;
	line-height: 1.6;
}

/* Desktop layout */

@media (min-width: 1024px) {
	.hbspt-form fieldset,
	[data-hs-forms-root='true'] fieldset {
		flex-direction: row;
		gap: 1rem;
	}

	.hbspt-form fieldset.form-columns-1,
	[data-hs-forms-root='true'] fieldset.form-columns-1 {
		flex-direction: column;
	}

	.hbspt-form input[type='submit'].hs-button,
	[data-hs-forms-root='true'] input[type='submit'].hs-button {
		width: fit-content;
	}
}