/* Ecobrisa WhatsApp Lead — botão flutuante e janela de conversa. */

.ebwl {
	--ebwl-green: #55CB6B;
	--ebwl-green-dark: #3DBA55;
	--ebwl-chat-bg: #F1F9F3;
	--ebwl-bubble: #FFFFFF;
	--ebwl-bubble-out: #DCF8C6;
	--ebwl-text: #2E3A33;
	--ebwl-muted: #6B7A72;
	--ebwl-bottom: 24px;
	--ebwl-side: 24px;
	--ebwl-panel-w: 360px;

	position: fixed;
	bottom: var(--ebwl-bottom);
	z-index: 99990;
	font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.45;
}

.ebwl--right { right: var(--ebwl-side); }
.ebwl--left  { left: var(--ebwl-side); }

.ebwl *,
.ebwl *::before,
.ebwl *::after { box-sizing: border-box; }

.ebwl__sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

/* ---------- botão flutuante ---------- */

.ebwl__launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px; height: 60px;
	margin: 0; padding: 0;
	border: 0; border-radius: 50%;
	background: var(--ebwl-green);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
	transition: transform .18s ease, background-color .18s ease;
}

.ebwl__launcher:hover { background: var(--ebwl-green-dark); transform: scale(1.05); }
.ebwl__launcher:focus-visible { outline: 3px solid #0177A7; outline-offset: 3px; }

.ebwl__launcher svg { width: 34px; height: 34px; display: block; }
.ebwl__launcher-close svg { width: 26px; height: 26px; }

.ebwl__launcher-icon,
.ebwl__launcher-close {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity .2s ease, transform .2s ease;
}

.ebwl__launcher-close {
	position: absolute;
	inset: 0;
	opacity: 0;
	transform: rotate(-90deg);
}

.ebwl.is-open .ebwl__launcher-icon { opacity: 0; transform: rotate(90deg); }
.ebwl.is-open .ebwl__launcher-close { opacity: 1; transform: rotate(0); }

/* anel pulsante, só enquanto a janela está fechada */
.ebwl__launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--ebwl-green);
	opacity: .55;
	z-index: -1;
	animation: ebwl-pulse 2.4s ease-out infinite;
}

.ebwl.is-open .ebwl__launcher::after { animation: none; opacity: 0; }

@keyframes ebwl-pulse {
	0%   { transform: scale(1);   opacity: .5; }
	70%  { transform: scale(1.6); opacity: 0; }
	100% { transform: scale(1.6); opacity: 0; }
}

.ebwl__badge {
	position: absolute;
	top: -2px; right: -2px;
	min-width: 20px; height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #EC671C;
	color: #fff;
	font-size: 12px; font-weight: 700; line-height: 20px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.ebwl.is-open .ebwl__badge,
.ebwl.is-done .ebwl__badge { display: none; }

/* ---------- janela ---------- */

.ebwl__panel {
	position: absolute;
	bottom: calc(100% + 14px);
	width: var(--ebwl-panel-w);
	max-width: calc(100vw - 32px);
	max-height: min(72vh, 580px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 20px;
	background: var(--ebwl-chat-bg);
	box-shadow: 0 16px 48px rgba(0, 0, 0, .26);
	transform-origin: bottom right;
	animation: ebwl-in .22s ease-out;
}

.ebwl--right .ebwl__panel { right: 0; }
.ebwl--left  .ebwl__panel { left: 0; transform-origin: bottom left; }

.ebwl__panel[hidden] { display: none; }

@keyframes ebwl-in {
	from { opacity: 0; transform: translateY(14px) scale(.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- topo ---------- */

.ebwl__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 16px 18px;
	background: var(--ebwl-green);
	color: #fff;
	flex: 0 0 auto;
}

.ebwl__avatar svg { width: 34px; height: 34px; display: block; }

.ebwl__titles {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
}

.ebwl__title {
	font-size: 19px;
	font-weight: 700;
	letter-spacing: .2px;
	color: #fff;
}

.ebwl__subtitle {
	font-size: 12px;
	color: rgba(255, 255, 255, .88);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ebwl__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px; height: 36px;
	flex: 0 0 auto;
	margin: 0; padding: 0;
	border: 0; border-radius: 50%;
	background: rgba(0, 0, 0, .18);
	color: #fff;
	cursor: pointer;
	transition: background-color .18s ease;
}

.ebwl__close:hover { background: rgba(0, 0, 0, .3); }
.ebwl__close svg { width: 20px; height: 20px; }

/* ---------- conversa ---------- */

.ebwl__chat {
	flex: 1 1 auto;
	min-height: 120px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 18px 16px 6px;
}

.ebwl__msg {
	position: relative;
	max-width: 84%;
	padding: 10px 15px;
	border-radius: 18px;
	font-size: 15px;
	color: var(--ebwl-text);
	background: var(--ebwl-bubble);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
	animation: ebwl-bubble .22s ease-out;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.ebwl__msg p { margin: 0; }
.ebwl__msg p + p { margin-top: 6px; }
.ebwl__msg strong { font-weight: 700; }

.ebwl__msg--in {
	align-self: flex-start;
	border-top-left-radius: 6px;
}

.ebwl__msg--in::before {
	content: "";
	position: absolute;
	top: 0; left: -7px;
	border: 7px solid transparent;
	border-top-color: var(--ebwl-bubble);
	border-right: 0;
}

.ebwl__msg--out {
	align-self: flex-end;
	background: var(--ebwl-bubble-out);
	border-top-right-radius: 6px;
}

.ebwl__msg--out::before {
	content: "";
	position: absolute;
	top: 0; right: -7px;
	border: 7px solid transparent;
	border-top-color: var(--ebwl-bubble-out);
	border-left: 0;
}

.ebwl__msg--erro {
	align-self: center;
	max-width: 92%;
	background: #FDEDE4;
	color: #A23C0C;
	font-size: 13px;
	box-shadow: none;
	text-align: center;
}

.ebwl__msg--erro::before { display: none; }

@keyframes ebwl-bubble {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* três pontinhos */
.ebwl__typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 13px 16px;
	border-radius: 18px;
	border-top-left-radius: 6px;
	background: var(--ebwl-bubble);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

.ebwl__typing span {
	width: 7px; height: 7px;
	border-radius: 50%;
	background: #9AA8A0;
	animation: ebwl-dot 1.2s infinite ease-in-out;
}

.ebwl__typing span:nth-child(2) { animation-delay: .18s; }
.ebwl__typing span:nth-child(3) { animation-delay: .36s; }

@keyframes ebwl-dot {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---------- rodapé e botões ---------- */

.ebwl__footer {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	padding: 10px 16px 18px;
}

.ebwl__footer:empty { display: none; }

.ebwl__cta {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	margin: 0;
	padding: 14px 22px;
	border: 0; border-radius: 999px;
	background: var(--ebwl-green);
	color: #fff;
	font-family: inherit;
	font-size: 17px; font-weight: 700;
	line-height: 1.2;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
	transition: background-color .18s ease, transform .18s ease;
}

.ebwl__cta:hover,
.ebwl__cta:focus { background: var(--ebwl-green-dark); color: #fff; transform: translateY(-1px); }
.ebwl__cta:focus-visible { outline: 3px solid #0177A7; outline-offset: 3px; }
.ebwl__cta svg { width: 26px; height: 26px; flex: 0 0 auto; }

.ebwl__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	width: 100%;
	font-size: 12px;
	color: var(--ebwl-muted);
	text-align: left;
}

.ebwl__consent input {
	margin: 2px 0 0;
	width: 16px; height: 16px;
	accent-color: var(--ebwl-green);
	flex: 0 0 auto;
}

.ebwl__consent a { color: #0177A7; }
.ebwl__consent.is-missing { color: #A23C0C; }

/* ---------- campo de resposta ---------- */

.ebwl__form {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid rgba(0, 0, 0, .07);
}

.ebwl__form[hidden] { display: none; }

.ebwl__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid #DCE5DF;
	border-radius: 999px;
	background: #F6F8F7;
	color: var(--ebwl-text);
	font-family: inherit;
	font-size: 16px; /* 16px evita o zoom automático no iOS */
	line-height: 44px;
}

.ebwl__input:focus {
	outline: 0;
	border-color: var(--ebwl-green);
	background: #fff;
}

.ebwl__send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px; height: 44px;
	flex: 0 0 auto;
	margin: 0; padding: 0;
	border: 0; border-radius: 50%;
	background: var(--ebwl-green);
	color: #fff;
	cursor: pointer;
	transition: background-color .18s ease;
}

.ebwl__send:hover { background: var(--ebwl-green-dark); }
.ebwl__send svg { width: 22px; height: 22px; }

.ebwl__hp {
	position: absolute !important;
	left: -9999px;
	width: 1px; height: 1px;
	opacity: 0;
}

/* ---------- celular ---------- */

@media (max-width: 560px) {
	.ebwl { --ebwl-side: 16px; --ebwl-bottom: 16px; }

	.ebwl__launcher { width: 56px; height: 56px; }
	.ebwl__launcher svg { width: 31px; height: 31px; }

	.ebwl__panel {
		position: fixed;
		left: 12px; right: 12px;
		bottom: calc(var(--ebwl-bottom) + 70px);
		width: auto;
		max-width: none;
		max-height: calc(100vh - var(--ebwl-bottom) - 110px);
		max-height: calc(100dvh - var(--ebwl-bottom) - 110px);
	}

	.ebwl__title { font-size: 17px; }
	.ebwl__msg { font-size: 14.5px; max-width: 90%; }
	.ebwl__cta { font-size: 16px; padding: 13px 20px; width: 100%; justify-content: center; }
	.ebwl__footer { align-items: stretch; }
}

@media (max-width: 380px) {
	.ebwl__subtitle { display: none; }
}

/* teclado aberto no celular: a janela encolhe em vez de sumir */
@media (max-width: 560px) and (max-height: 520px) {
	.ebwl__panel { max-height: calc(100dvh - var(--ebwl-bottom) - 80px); }
	.ebwl__chat { padding-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.ebwl *,
	.ebwl *::after,
	.ebwl *::before {
		animation: none !important;
		transition: none !important;
	}
}

/* ---------- blindagem contra o tema ----------
   Temas estilizam button e a com regras largas, às vezes mais específicas que
   as daqui. Estas poucas declarações garantem que os elementos clicáveis do
   widget não herdem a cara do tema. O var() vai com valor reserva, para o caso
   de a variável não chegar (CSS crítico adiado, otimizador agressivo). */

.ebwl .ebwl__launcher,
.ebwl .ebwl__close,
.ebwl .ebwl__send,
.ebwl .ebwl__cta {
	font-family: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	text-decoration: none !important;
	min-width: 0 !important;
	min-height: 0 !important;
	outline-offset: 3px;
}

.ebwl .ebwl__launcher,
.ebwl .ebwl__close,
.ebwl .ebwl__send {
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	color: #fff !important;
	background: #55CB6B;
	background: var(--ebwl-green, #55CB6B) !important;
}

.ebwl .ebwl__launcher {
	width: 60px !important;
	height: 60px !important;
	box-shadow: 0 6px 22px rgba(0, 0, 0, .22) !important;
}

.ebwl .ebwl__close {
	width: 36px !important;
	height: 36px !important;
	background: rgba(0, 0, 0, .18) !important;
	box-shadow: none !important;
}

.ebwl .ebwl__send {
	width: 44px !important;
	height: 44px !important;
	box-shadow: none !important;
}

.ebwl .ebwl__cta {
	padding: 14px 22px !important;
	border: 0 !important;
	border-radius: 999px !important;
	color: #fff !important;
	background: #55CB6B;
	background: var(--ebwl-green, #55CB6B) !important;
}

.ebwl .ebwl__input {
	width: auto !important;
	height: 44px !important;
	margin: 0 !important;
	border-radius: 999px !important;
	font-family: inherit !important;
	box-shadow: none !important;
}

.ebwl .ebwl__msg,
.ebwl .ebwl__header,
.ebwl .ebwl__chat { font-family: inherit !important; }

.ebwl .ebwl__header { background: #55CB6B; background: var(--ebwl-green, #55CB6B) !important; }
.ebwl .ebwl__chat { background: var(--ebwl-chat-bg, #F1F9F3) !important; }
.ebwl .ebwl__msg--in { background: #fff !important; }
.ebwl .ebwl__msg--out { background: var(--ebwl-bubble-out, #DCF8C6) !important; }
.ebwl .ebwl__title { color: #fff !important; }

@media (max-width: 560px) {
	.ebwl .ebwl__launcher { width: 56px !important; height: 56px !important; }
	.ebwl .ebwl__cta { padding: 13px 20px !important; }
}
