/* Massa Chat — botão flutuante de WhatsApp */

.massa-chat {
	--massa-chat-radius: 16px;
	position: fixed;
	bottom: calc(var(--massa-chat-y, 20px) + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	display: flex;
	flex-direction: column;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	/* Só opacidade: transform no contêiner deslocaria a janela fixa do celular. */
	animation: massa-chat-fade 0.25s ease-out;
}

.massa-chat[hidden],
.massa-chat [hidden] {
	display: none !important;
}

.massa-chat--right {
	right: var(--massa-chat-x, 20px);
	align-items: flex-end;
}

.massa-chat--left {
	left: var(--massa-chat-x, 20px);
	align-items: flex-start;
}

@media (min-width: 768px) {
	.massa-chat--no-desktop {
		display: none !important;
	}
}

@media (max-width: 767px) {
	.massa-chat--no-mobile {
		display: none !important;
	}
}

/* Botão */

.massa-chat__button,
.massa-chat-inline,
.massa-chat__start {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: var(--massa-chat-bg, #25d366);
	color: var(--massa-chat-fg, #fff) !important;
	text-decoration: none !important;
	font-weight: 600;
	border: 0;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.massa-chat__button {
	min-height: var(--massa-chat-size, 56px);
	min-width: var(--massa-chat-size, 56px);
	padding: 0 calc(var(--massa-chat-size, 56px) * 0.3);
	border-radius: calc(var(--massa-chat-size, 56px) / 2);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.massa-chat__button .massa-chat__icon {
	width: calc(var(--massa-chat-size, 56px) * 0.5);
	height: calc(var(--massa-chat-size, 56px) * 0.5);
	flex: none;
}

.massa-chat--icon .massa-chat__button {
	padding: 0;
}

.massa-chat--icon .massa-chat__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.massa-chat__button:hover,
.massa-chat-inline:hover,
.massa-chat__start:hover {
	transform: translateY(-2px);
	filter: brightness(1.05);
}

.massa-chat__button:focus-visible,
.massa-chat-inline:focus-visible,
.massa-chat__start:focus-visible,
.massa-chat__close:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 3px;
}

.massa-chat--pulse .massa-chat__button {
	animation: massa-chat-pulse 2s infinite;
}

@keyframes massa-chat-pulse {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--massa-chat-bg, #25d366) 60%, transparent), 0 6px 20px rgba(0, 0, 0, 0.2); }
	70% { box-shadow: 0 0 0 16px transparent, 0 6px 20px rgba(0, 0, 0, 0.2); }
	100% { box-shadow: 0 0 0 0 transparent, 0 6px 20px rgba(0, 0, 0, 0.2); }
}

@keyframes massa-chat-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes massa-chat-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

/* Saudação */

.massa-chat__dialog {
	width: min(360px, calc(100vw - 2 * var(--massa-chat-x, 20px)));
	max-height: calc(100vh - var(--massa-chat-size, 56px) - 2 * var(--massa-chat-y, 20px) - 24px);
	overflow: auto;
	background: #fff;
	color: #1f2328;
	border-radius: var(--massa-chat-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
	animation: massa-chat-in 0.2s ease-out;
}

/* Celular: a janela ocupa a largura da tela, acima do botão. */
@media (max-width: 480px) {
	.massa-chat__dialog {
		position: fixed;
		left: 12px;
		right: 12px;
		width: auto;
		bottom: calc(var(--massa-chat-y, 20px) + var(--massa-chat-size, 56px) + 12px + env(safe-area-inset-bottom, 0px));
		max-height: calc(100vh - var(--massa-chat-y, 20px) - var(--massa-chat-size, 56px) - 36px);
		max-height: calc(100dvh - var(--massa-chat-y, 20px) - var(--massa-chat-size, 56px) - 36px);
	}
}

.massa-chat__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	background: var(--massa-chat-head-bg, var(--massa-chat-bg, #25d366));
	color: var(--massa-chat-head-fg, var(--massa-chat-fg, #fff));
}

.massa-chat__avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
	flex: none;
}

.massa-chat__heading {
	flex: 1;
	min-width: 0;
}

.massa-chat__title,
.massa-chat__subtitle {
	margin: 0;
	color: inherit;
}

.massa-chat__title {
	font-weight: 700;
	font-size: 16px;
}

.massa-chat__subtitle {
	font-size: 13px;
	opacity: 0.9;
}

.massa-chat__close {
	display: inline-flex;
	padding: 6px;
	margin: -6px -6px -6px 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
}

.massa-chat__close svg {
	width: 20px;
	height: 20px;
}

.massa-chat__body {
	padding: 16px;
	background: #efeae2;
}

.massa-chat__bubble {
	position: relative;
	padding: 10px 12px;
	margin: 0 0 16px;
	background: #fff;
	border-radius: 0 10px 10px 10px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.massa-chat__bubble p {
	margin: 0 0 6px;
}

.massa-chat__bubble p:last-child {
	margin: 0;
}

.massa-chat__bubble a {
	color: #027eb5;
}

.massa-chat__start {
	width: 100%;
	min-height: 44px;
	padding: 10px 16px;
	border-radius: 999px;
	font-size: 15px;
}

.massa-chat__start .massa-chat__icon {
	width: 20px;
	height: 20px;
}

/* Formulário */

.massa-chat__form {
	margin: 0;
}

.massa-chat__field {
	margin: 0 0 10px;
}

.massa-chat__field label {
	display: block;
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 600;
	color: #1f2328;
}

.massa-chat__field input,
.massa-chat__field textarea {
	box-sizing: border-box;
	width: 100%;
	min-height: 40px;
	padding: 8px 10px;
	margin: 0;
	font: inherit;
	color: #1f2328;
	background: #fff;
	border: 1px solid #c9ced6;
	border-radius: 8px;
}

.massa-chat__field textarea {
	resize: vertical;
}

.massa-chat__field input:focus,
.massa-chat__field textarea:focus {
	outline: 2px solid var(--massa-chat-bg, #25d366);
	outline-offset: 0;
	border-color: transparent;
}

.massa-chat__field [aria-invalid="true"] {
	border-color: #d1242f;
}

.massa-chat__consent {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin: 4px 0 12px;
	font-size: 12px;
	color: #3d444d;
	cursor: pointer;
}

.massa-chat__consent input {
	margin: 2px 0 0;
	flex: none;
}

.massa-chat__consent a {
	color: #027eb5;
}

.massa-chat__error {
	margin: 0 0 10px;
	font-size: 13px;
	color: #d1242f;
}

.massa-chat__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Link em linha (shortcode / WooCommerce) */

.massa-chat-inline {
	min-height: 44px;
	padding: 10px 20px;
	border-radius: 999px;
	line-height: 1.2;
}

.massa-chat-inline .massa-chat__icon {
	width: 20px;
	height: 20px;
	flex: none;
}

.massa-chat-woo {
	margin: 12px 0;
}

@media (prefers-reduced-motion: reduce) {
	.massa-chat,
	.massa-chat__dialog,
	.massa-chat--pulse .massa-chat__button {
		animation: none;
	}

	.massa-chat__button,
	.massa-chat-inline,
	.massa-chat__start {
		transition: none;
	}
}

/*
 * Blindagem contra estilos do tema (ex.: Hello Elementor aplica borda, cor e
 * padding em todo button e input). O #massa-chat dá prioridade sem !important.
 */

#massa-chat .massa-chat__start,
#massa-chat .massa-chat__start:hover,
#massa-chat .massa-chat__start:focus,
#massa-chat .massa-chat__start:active {
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 10px 16px;
	background-color: var(--massa-chat-bg, #25d366);
	color: var(--massa-chat-fg, #fff);
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
}

#massa-chat .massa-chat__close,
#massa-chat .massa-chat__close:hover,
#massa-chat .massa-chat__close:focus,
#massa-chat .massa-chat__close:active {
	width: auto;
	height: auto;
	min-height: 0;
	padding: 6px;
	background-color: transparent;
	color: inherit;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	line-height: 0;
}

#massa-chat .massa-chat__close:hover {
	background-color: rgba(255, 255, 255, 0.15);
}

#massa-chat .massa-chat__field input,
#massa-chat .massa-chat__field textarea {
	width: 100%;
	height: auto;
	min-height: 40px;
	margin: 0;
	padding: 8px 10px;
	background-color: #fff;
	color: #1f2328;
	border: 1px solid #c9ced6;
	border-radius: 8px;
	box-shadow: none;
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.4;
}

#massa-chat .massa-chat__field input:focus,
#massa-chat .massa-chat__field textarea:focus {
	border-color: transparent;
	outline: 2px solid var(--massa-chat-bg, #25d366);
	outline-offset: 0;
}

#massa-chat .massa-chat__field [aria-invalid="true"] {
	border-color: #d1242f;
}

#massa-chat .massa-chat__consent input {
	width: 16px;
	height: 16px;
	min-height: 0;
	margin: 2px 0 0;
	padding: 0;
}

#massa-chat .massa-chat__title,
#massa-chat .massa-chat__subtitle,
#massa-chat .massa-chat__bubble p {
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
}
