/* Nexo Formulário */

.nexo-form {
	--nexo-form-gap: 16px;
	--nexo-form-focus: #6d28d9;
	--nexo-form-error: #b91c1c;
	--nexo-form-label: #111827;
	--nexo-form-input-color: #111827;
	--nexo-form-input-bg: #ffffff;
	--nexo-form-radius: 10px;
	--nexo-form-padding: 12px 14px;
	--nexo-btn-color: #ffffff;
	--nexo-btn-bg: #6d28d9;
	--nexo-btn-hover-color: #ffffff;
	--nexo-btn-hover-bg: #5b21b6;
	--nexo-btn-radius: 10px;
	--nexo-btn-padding: 14px 28px;

	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--nexo-form-gap);
	width: 100%;
}

.nexo-form__fields {
	display: flex;
	flex-wrap: wrap;
	gap: var(--nexo-form-gap);
	margin: 0 calc(var(--nexo-form-gap) * -0.5);
}

.nexo-form__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	box-sizing: border-box;
	width: 100%;
	padding: 0 calc(var(--nexo-form-gap) * 0.5);
}

.nexo-form__field--half {
	width: 50%;
}

.nexo-form__field--third {
	width: 33.3333%;
}

.nexo-form__label,
.nexo-form__fieldset legend {
	display: block;
	margin: 0;
	padding: 0;
	font-size: .95rem;
	font-weight: 600;
	color: var(--nexo-form-label);
}

.nexo-form__required {
	margin-left: 2px;
	color: var(--nexo-form-error);
}

.nexo-form__input {
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: var(--nexo-form-padding);
	font: inherit;
	color: var(--nexo-form-input-color);
	background: var(--nexo-form-input-bg);
	border: 1px solid #d1d5db;
	border-radius: var(--nexo-form-radius);
	transition: border-color .2s ease, box-shadow .2s ease;
	appearance: none;
}

select.nexo-form__input {
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
	background-size: 5px 5px;
	background-repeat: no-repeat;
	padding-right: 36px;
}

textarea.nexo-form__input {
	min-height: 120px;
	resize: vertical;
}

.nexo-form__input::placeholder {
	color: #9ca3af;
	opacity: 1;
}

.nexo-form__input:focus {
	outline: none;
	border-color: var(--nexo-form-focus);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--nexo-form-focus) 25%, transparent);
}

/* Caixas de seleção e opções de escolha única */
.nexo-form__check {
	display: inline-flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	color: var(--nexo-form-label);
	font-size: .95rem;
}

.nexo-form__check input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	accent-color: var(--nexo-form-focus);
}

.nexo-form__fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.nexo-form__fieldset legend {
	margin-bottom: 8px;
}

.nexo-form__choices {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nexo-form__check--button {
	padding: 8px 14px;
	border: 1px solid #d1d5db;
	border-radius: var(--nexo-form-radius);
	transition: border-color .2s ease, background-color .2s ease;
}

.nexo-form__check--button:has(input:checked) {
	border-color: var(--nexo-form-focus);
	background: color-mix(in srgb, var(--nexo-form-focus) 10%, transparent);
}

.nexo-form__check--button input {
	width: 16px;
	height: 16px;
}

/* Estado de erro */
.nexo-form__field.is-invalid .nexo-form__input,
.nexo-form__field.is-invalid .nexo-form__check--button {
	border-color: var(--nexo-form-error);
}

.nexo-form__error {
	margin: 0;
	font-size: .85rem;
	color: var(--nexo-form-error);
}

/* Botão */
.nexo-form__footer {
	display: block;
}

.nexo-form--block .nexo-form__submit {
	width: 100%;
}

.nexo-form__submit {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-width: 140px;
	padding: var(--nexo-btn-padding);
	font: inherit;
	font-weight: 600;
	color: var(--nexo-btn-color);
	background: var(--nexo-btn-bg);
	border: 0;
	border-radius: var(--nexo-btn-radius);
	cursor: pointer;
	transition: background-color .2s ease, transform .15s ease, opacity .2s ease;
}

.nexo-form__submit:hover {
	color: var(--nexo-btn-hover-color);
	background: var(--nexo-btn-hover-bg);
}

.nexo-form__submit:active {
	transform: translateY(1px);
}

.nexo-form__submit:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--nexo-form-focus) 45%, transparent);
	outline-offset: 2px;
}

.nexo-form__submit:disabled {
	cursor: wait;
	opacity: .75;
}

.nexo-form__spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: nexo-form-spin .7s linear infinite;
}

.nexo-form.is-loading .nexo-form__spinner {
	display: inline-block;
}

@keyframes nexo-form-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Mensagem geral */
.nexo-form__message {
	font-size: .95rem;
	font-weight: 500;
}

.nexo-form__message:empty {
	display: none;
}

.nexo-form__message.is-success {
	padding: 12px 16px;
	color: #15803d;
	background: #dcfce7;
	border-radius: var(--nexo-form-radius);
}

.nexo-form__message.is-error {
	padding: 12px 16px;
	color: var(--nexo-form-error);
	background: #fee2e2;
	border-radius: var(--nexo-form-radius);
}

/* Campo armadilha: fora da tela para pessoas, presente para robôs */
.nexo-form__hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Telas pequenas: campos lado a lado viram uma coluna */
@media (max-width: 767px) {
	.nexo-form__field--half,
	.nexo-form__field--third {
		width: 100%;
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.nexo-form__field--third {
		width: 50%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nexo-form__submit,
	.nexo-form__input {
		transition: none;
	}

	.nexo-form__spinner {
		animation-duration: 2s;
	}
}
