/**
 * WhatsApp - Estilos Front-end (Botão Flutuante, Tooltip, Animações e Responsividade)
 *
 * @package Elsefy_WhatsApp
 */

.ewa-widget {
	--ewa-bg: #25D366;
	--ewa-hover: #1EBE5D;
	--ewa-icon: #FFFFFF;
	--ewa-tooltip-bg: #FFFFFF;
	--ewa-tooltip-text: #0F172A;
	--ewa-size: 56px;
	--ewa-pill-h: 48px;
	--ewa-svg-size: 28px;
	--ewa-radius: 9999px;
	--ewa-z: 99999;
	--ewa-dx: 24px;
	--ewa-dy: 24px;
	--ewa-mx: 16px;
	--ewa-my: 16px;

	position: fixed;
	z-index: var(--ewa-z);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	line-height: 1;
	pointer-events: none;
}

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

.ewa-widget-inner {
	position: relative;
	display: inline-flex;
	align-items: center;
	pointer-events: auto;
}

/* Posicionamento Desktop */
.ewa-pos-bottom-right {
	right: var(--ewa-dx);
	bottom: var(--ewa-dy);
}

.ewa-pos-bottom-left {
	left: var(--ewa-dx);
	bottom: var(--ewa-dy);
}

.ewa-pos-middle-right {
	right: var(--ewa-dx);
	top: 50%;
	transform: translateY(-50%);
}

.ewa-pos-middle-left {
	left: var(--ewa-dx);
	top: 50%;
	transform: translateY(-50%);
}

/* Visibilidade por Dispositivo */
@media (max-width: 768px) {
	.ewa-vis-desktop {
		display: none !important;
	}

	.ewa-pos-bottom-right {
		right: var(--ewa-mx);
		bottom: var(--ewa-my);
	}

	.ewa-pos-bottom-left {
		left: var(--ewa-mx);
		bottom: var(--ewa-my);
	}

	.ewa-pos-middle-right {
		right: var(--ewa-mx);
	}

	.ewa-pos-middle-left {
		left: var(--ewa-mx);
	}
}

@media (min-width: 769px) {
	.ewa-vis-mobile {
		display: none !important;
	}
}

/* Botão Principal */
.ewa-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border-radius: var(--ewa-radius);
	background-color: var(--ewa-bg);
	color: var(--ewa-icon) !important;
	text-decoration: none !important;
	border: none;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}

.ewa-btn:hover,
.ewa-btn:focus-visible {
	background-color: var(--ewa-hover);
	color: var(--ewa-icon) !important;
	text-decoration: none !important;
}

.ewa-btn:focus-visible {
	outline: 2px solid var(--ewa-hover);
	outline-offset: 3px;
}

.ewa-style-icon .ewa-btn {
	width: var(--ewa-size);
	height: var(--ewa-size);
	padding: 0;
}

.ewa-style-pill .ewa-btn {
	min-height: var(--ewa-pill-h);
	padding: 10px 18px;
}

.ewa-has-shadow .ewa-btn {
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.12);
}

.ewa-has-shadow .ewa-btn:hover {
	box-shadow: 0 12px 28px rgba(15, 23, 42, 0.26), 0 4px 10px rgba(15, 23, 42, 0.14);
}

.ewa-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	position: relative;
	z-index: 2;
}

.ewa-wa-svg {
	width: var(--ewa-svg-size);
	height: var(--ewa-svg-size);
	display: block;
}

.ewa-style-pill .ewa-wa-svg {
	width: calc(var(--ewa-svg-size) * 0.84);
	height: calc(var(--ewa-svg-size) * 0.84);
}

.ewa-btn-label {
	position: relative;
	z-index: 2;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	letter-spacing: -0.01em;
}

/* Bolinha de Notificação (Badge) */
.ewa-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background-color: #EF4444;
	color: #FFFFFF;
	border: 2px solid #FFFFFF;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
	pointer-events: none;
}

/* Tooltip / Balão CTA */
.ewa-tooltip {
	position: absolute;
	z-index: 2;
	padding: 9px 14px;
	border-radius: 8px;
	background-color: var(--ewa-tooltip-bg);
	color: var(--ewa-tooltip-text);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.35;
	max-width: 230px;
	width: max-content;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14), 0 1px 3px rgba(15, 23, 42, 0.08);
	border: 1px solid rgba(15, 23, 42, 0.08);
	pointer-events: auto;
}

.ewa-tooltip::after {
	content: "";
	position: absolute;
	width: 10px;
	height: 10px;
	background-color: var(--ewa-tooltip-bg);
	border: 1px solid rgba(15, 23, 42, 0.08);
	transform: rotate(45deg);
}

/* Tooltip ao lado no modo Ícone */
.ewa-style-icon.ewa-pos-bottom-right .ewa-tooltip,
.ewa-style-icon.ewa-pos-middle-right .ewa-tooltip {
	right: calc(100% + 12px);
	top: 50%;
	transform: translateY(-50%);
}

.ewa-style-icon.ewa-pos-bottom-right .ewa-tooltip::after,
.ewa-style-icon.ewa-pos-middle-right .ewa-tooltip::after {
	right: -6px;
	top: 50%;
	margin-top: -5px;
	border-left: none;
	border-bottom: none;
}

.ewa-style-icon.ewa-pos-bottom-left .ewa-tooltip,
.ewa-style-icon.ewa-pos-middle-left .ewa-tooltip {
	left: calc(100% + 12px);
	top: 50%;
	transform: translateY(-50%);
}

.ewa-style-icon.ewa-pos-bottom-left .ewa-tooltip::after,
.ewa-style-icon.ewa-pos-middle-left .ewa-tooltip::after {
	left: -6px;
	top: 50%;
	margin-top: -5px;
	border-right: none;
	border-top: none;
}

/* Tooltip acima no modo Pílula para evitar excesso de largura */
.ewa-style-pill .ewa-tooltip {
	bottom: calc(100% + 12px);
	max-width: 240px;
}

.ewa-style-pill.ewa-pos-bottom-right .ewa-tooltip,
.ewa-style-pill.ewa-pos-middle-right .ewa-tooltip {
	right: 0;
}

.ewa-style-pill.ewa-pos-bottom-right .ewa-tooltip::after,
.ewa-style-pill.ewa-pos-middle-right .ewa-tooltip::after {
	bottom: -6px;
	right: 18px;
	border-top: none;
	border-left: none;
}

.ewa-style-pill.ewa-pos-bottom-left .ewa-tooltip,
.ewa-style-pill.ewa-pos-middle-left .ewa-tooltip {
	left: 0;
}

.ewa-style-pill.ewa-pos-bottom-left .ewa-tooltip::after,
.ewa-style-pill.ewa-pos-middle-left .ewa-tooltip::after {
	bottom: -6px;
	left: 18px;
	border-top: none;
	border-left: none;
}

@media (max-width: 480px) {
	.ewa-tooltip {
		max-width: 175px;
		padding: 8px 11px;
		font-size: 12px;
	}
}

/* Animações */
.ewa-anim-pulse .ewa-pulse-ring {
	position: absolute;
	inset: 0;
	border-radius: var(--ewa-radius);
	background-color: var(--ewa-bg);
	opacity: 0.55;
	z-index: 1;
	pointer-events: none;
	animation: ewaPulseRipple 2.2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes ewaPulseRipple {
	0% {
		transform: scale(1);
		opacity: 0.52;
	}
	70% {
		transform: scale(1.42);
		opacity: 0;
	}
	100% {
		transform: scale(1.42);
		opacity: 0;
	}
}

.ewa-anim-hover-scale .ewa-btn:hover,
.ewa-anim-hover-scale .ewa-btn:focus-visible {
	transform: scale(1.08);
}

.ewa-anim-smooth-entry .ewa-widget-inner {
	animation: ewaSmoothEntry 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ewaSmoothEntry {
	0% {
		opacity: 0;
		transform: translateY(14px) scale(0.94);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ewa-anim-pulse .ewa-pulse-ring,
	.ewa-anim-smooth-entry .ewa-widget-inner {
		animation: none !important;
	}

	.ewa-btn {
		transition: none !important;
	}
}
