/* =========================================================
   HelpWP WhatsApp — Botão Flutuante (Front-end)
   ========================================================= */

/* ---------------------------------------------------------
   Container principal
   --------------------------------------------------------- */
.hwp-wa-btn {
	position: fixed;
	bottom: 24px;
	z-index: 9999;

	/*
	 * Entrada via CSS puro: animation-fill-mode:both mantém o estado "from"
	 * durante o delay e o estado "to" após o fim — sem depender de JS.
	 */
	animation: hwp-entrance 380ms cubic-bezier(.34, 1.56, .64, 1) 900ms both;
}

@keyframes hwp-entrance {
	from { opacity: 0; transform: scale(0.4); }
	to   { opacity: 1; transform: scale(1);   }
}

/* ---------------------------------------------------------
   Posicionamento horizontal
   --------------------------------------------------------- */
.hwp-wa-right { right: 24px; }
.hwp-wa-left  { left: 24px;  }

/* ---------------------------------------------------------
   Link / círculo do botão
   --------------------------------------------------------- */
.hwp-wa-btn a {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;  /* necessário para o ::before do pulso */
	width: 70px;
	height: 70px;
	background-color: #25D366;
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .22), 0 2px 6px rgba(37, 211, 102, .35);
	text-decoration: none;
	transition: transform 200ms ease, box-shadow 200ms ease, background-color 200ms ease, width 200ms ease, height 200ms ease;
}

.hwp-wa-btn a:hover,
.hwp-wa-btn a:focus-visible {
	background-color: #1ebe5d;
	transform: scale(1.12);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22), 0 4px 12px rgba(37, 211, 102, .5);
	outline: none;
}

.hwp-wa-btn a:active {
	transform: scale(1.04);
}

/* Anel de foco acessível */
.hwp-wa-btn a:focus-visible {
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px #25D366;
}

/* ---------------------------------------------------------
   SVG do ícone
   --------------------------------------------------------- */
.hwp-wa-btn svg {
	display: block;
	flex-shrink: 0;
	pointer-events: none;
	transition: width 200ms ease, height 200ms ease;
}

/* ---------------------------------------------------------
   Animação de pulso (anel expansivo via box-shadow)
   --------------------------------------------------------- */
.hwp-wa-btn.hwp-wa-pulse a {
	animation: hwp-ring-pulse 2.8s ease-out infinite;
}

@keyframes hwp-ring-pulse {
	0%   { box-shadow: 0 4px 14px rgba(0,0,0,.22), 0 2px 6px rgba(37,211,102,.35), 0 0 0 0   rgba(37,211,102,.65); }
	70%  { box-shadow: 0 4px 14px rgba(0,0,0,.22), 0 2px 6px rgba(37,211,102,.35), 0 0 0 20px rgba(37,211,102,0);  }
	100% { box-shadow: 0 4px 14px rgba(0,0,0,.22), 0 2px 6px rgba(37,211,102,.35), 0 0 0 0   rgba(37,211,102,0);  }
}

/* ---------------------------------------------------------
   Animação de entrada — Slide da direita
   Especificidade dupla garante que sobrepõe o animation base do .hwp-wa-btn
   --------------------------------------------------------- */
@keyframes hwp-slide-in {
	from { transform: translateX(90px); opacity: 0; }
	to   { transform: translateX(0);    opacity: 1; }
}

@keyframes hwp-slide-in-left {
	from { transform: translateX(-90px); opacity: 0; }
	to   { transform: translateX(0);     opacity: 1; }
}

.hwp-anim-entrada-slide {
	animation: hwp-slide-in 0.5s ease forwards;
}

.hwp-wa-left.hwp-anim-entrada-slide {
	animation: hwp-slide-in-left 0.5s ease forwards;
}

/* ---------------------------------------------------------
   Animação de pulso contínuo de destaque (escala)
   Aplicada no <a> (não no container) para que o tooltip
   não seja arrastado junto pela transformação.
   --------------------------------------------------------- */
@keyframes hwp-pulse {
	0%, 100% { transform: scale(1); }
	50%      { transform: scale(1.15); }
}

.hwp-anim-atencao-pulse {
	animation: hwp-pulse 2s ease-in-out infinite;
}

/* ---------------------------------------------------------
   Animações Pro — Entrada
   --------------------------------------------------------- */
@keyframes hwp-fade-in {
	from { transform: scale(0.85); opacity: 0; }
	to   { transform: scale(1);    opacity: 1; }
}

.hwp-anim-entrada-fade {
	animation: hwp-fade-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes hwp-bounce-in {
	0%   { transform: scale(0.3);  opacity: 0; }
	50%  { transform: scale(1.12); opacity: 1; }
	70%  { transform: scale(0.92); }
	100% { transform: scale(1); }
}

.hwp-anim-entrada-bounce {
	animation: hwp-bounce-in 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

/* ---------------------------------------------------------
   Animações Pro — Atenção
   --------------------------------------------------------- */
@keyframes hwp-shake {
	0%,100% { transform: rotate(0deg);   }
	15%     { transform: rotate(-12deg); }
	30%     { transform: rotate(12deg);  }
	45%     { transform: rotate(-8deg);  }
	60%     { transform: rotate(8deg);   }
	75%     { transform: rotate(-4deg);  }
	90%     { transform: rotate(4deg);   }
}

.hwp-anim-atencao-shake {
	animation: hwp-shake 0.8s ease-in-out infinite;
}

@keyframes hwp-ring {
	0%, 55%, 100% { transform: rotate(0deg); }
	5%   { transform: rotate(-20deg); }
	10%  { transform: rotate(20deg); }
	15%  { transform: rotate(-18deg); }
	20%  { transform: rotate(18deg); }
	25%  { transform: rotate(-14deg); }
	30%  { transform: rotate(14deg); }
	35%  { transform: rotate(-8deg); }
	40%  { transform: rotate(8deg); }
	45%  { transform: rotate(-3deg); }
	50%  { transform: rotate(3deg); }
}

.hwp-anim-atencao-ring {
	animation: hwp-ring 2.5s ease-in-out infinite;
	transform-origin: top center;
}

/* ---------------------------------------------------------
   Zoom In — Pro
   --------------------------------------------------------- */
@keyframes hwp-zoom-in {
	from { transform: scale(0);   opacity: 0; }
	to   { transform: scale(1);   opacity: 1; }
}

.hwp-anim-entrada-zoom {
	animation: hwp-zoom-in 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ---------------------------------------------------------
   Flip — Pro
   --------------------------------------------------------- */
@keyframes hwp-flip-in {
	from { transform: perspective(400px) rotateY(-90deg); opacity: 0; }
	to   { transform: perspective(400px) rotateY(0deg);   opacity: 1; }
}

.hwp-anim-entrada-flip {
	animation: hwp-flip-in 0.5s ease-out forwards;
}

/* ---------------------------------------------------------
   Shockwave — Pro
   Aplicado no <a> (que já tem position: relative).
   --------------------------------------------------------- */
.hwp-anim-atencao-shockwave::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: rgba(37, 211, 102, 0.5);
	pointer-events: none;
	animation: hwp-shockwave 2s ease-out infinite;
}

@keyframes hwp-shockwave {
	0%   { transform: scale(1);   opacity: 0.6; }
	100% { transform: scale(2.2); opacity: 0; }
}

/* ---------------------------------------------------------
   Blink — Pro
   --------------------------------------------------------- */
@keyframes hwp-blink {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.3; }
}

.hwp-anim-atencao-blink {
	animation: hwp-blink 1.2s ease-in-out infinite;
}

/* ---------------------------------------------------------
   Estado fechado — botão 40% menor
   --------------------------------------------------------- */
.hwp-wa-btn.hwp-wa-closed a {
	width: 42px;
	height: 42px;
}

.hwp-wa-btn.hwp-wa-closed svg {
	width: 24px;
	height: 24px;
}

/* ---------------------------------------------------------
   Responsivo — telas pequenas
   --------------------------------------------------------- */
@media (max-width: 480px) {
	.hwp-wa-btn {
		bottom: 16px;
	}

	.hwp-wa-right { right: 16px; }
	.hwp-wa-left  { left: 16px;  }

	.hwp-wa-btn a {
		width: 50px;
		height: 50px;
	}

	.hwp-wa-btn svg {
		width: 26px;
		height: 26px;
	}

	.hwp-wa-btn.hwp-wa-closed a {
		width: 30px;
		height: 30px;
	}

	.hwp-wa-btn.hwp-wa-closed svg {
		width: 18px;
		height: 18px;
	}
}

/* ---------------------------------------------------------
   Balão / Toast de horário fechado
   --------------------------------------------------------- */
.hwp-wa-toast {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: max-content;
	max-width: 220px;
	padding: 9px 13px;
	background: rgba(33, 33, 33, .92);
	color: #fff;
	font-size: 13px;
	font-family: inherit;
	line-height: 1.45;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
	pointer-events: none;
	white-space: normal;
	word-break: break-word;
	z-index: 10000;
	opacity: 0;
}

/* Botão na direita: toast aparece à esquerda, seta aponta → */
.hwp-wa-right .hwp-wa-toast {
	right: calc(100% + 12px);
}
.hwp-wa-right .hwp-wa-toast::after {
	content: '';
	position: absolute;
	left: 100%;
	top: 50%;
	transform: translateY(-50%);
	border: 6px solid transparent;
	border-left-color: rgba(33, 33, 33, .92);
}

/* Botão na esquerda: toast aparece à direita, seta aponta ← */
.hwp-wa-left .hwp-wa-toast {
	left: calc(100% + 12px);
}
.hwp-wa-left .hwp-wa-toast::after {
	content: '';
	position: absolute;
	right: 100%;
	top: 50%;
	transform: translateY(-50%);
	border: 6px solid transparent;
	border-right-color: rgba(33, 33, 33, .92);
}

.hwp-wa-toast--visible {
	opacity: 1;
}

/* ---------------------------------------------------------
   Menu de atendentes (Pro)
   Posicionado acima do botão (70px altura + 24px margem + 16px gap = 110px)
   --------------------------------------------------------- */
.hwp-agents-menu {
	position: fixed;
	bottom: 110px;
	right: 24px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
	padding: 0;
	overflow: hidden;
	z-index: 10000;
	min-width: 200px;
	max-width: 280px;
}

/* Seta apontando para o botão de WhatsApp */
.hwp-agents-menu::after {
	content: '';
	position: absolute;
	bottom: -8px;
	border: 8px solid transparent;
	border-bottom: none;
	border-top-color: #fff;
}

#hwp-whatsapp-btn.hwp-wa-right ~ .hwp-agents-menu::after {
	right: 13px;
}

#hwp-whatsapp-btn.hwp-wa-left ~ .hwp-agents-menu::after {
	left: 13px;
}

/* Botão fechado (fora do horário): 42px altura + 24px margem + 16px gap = 82px */
#hwp-whatsapp-btn.hwp-wa-closed ~ .hwp-agents-menu {
	bottom: 82px;
}

#hwp-whatsapp-btn.hwp-wa-left ~ .hwp-agents-menu {
	right: auto;
	left: 24px;
}

.hwp-agents-menu[aria-hidden='true'] {
	display: none;
}

.hwp-agents-header {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #25D366;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	padding: 14px 16px;
	border-radius: 12px 12px 0 0;
}

.hwp-agents-header svg {
	flex-shrink: 0;
}

.hwp-agents-menu ul {
	list-style: none;
	margin: 0;
	padding: 12px 16px 4px;
}

.hwp-agents-menu li {
	margin: 0;
}

.hwp-agents-menu li a {
	display: flex;
	align-items: center;
	padding: 10px 12px;
	border-radius: 8px;
	color: #333;
	text-decoration: none;
	font-size: 14px;
	font-family: inherit;
	transition: background 150ms ease, color 150ms ease;
	margin: 5px 0;
	border: solid 1px rgba(37, 211, 102, .5);
}

.hwp-agent-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	flex-shrink: 0;
	margin-right: 10px;
}

.hwp-agent-dot--online  { background: #22c55e; }
.hwp-agent-dot--offline { background: #9ca3af; }

.hwp-agents-menu li a:hover,
.hwp-agents-menu li a:focus-visible {
	background: #f0fdf4;
	color: #15803d;
	outline: none;
}

.hwp-agents-close {
	position: absolute;
	top: 10px;
	right: 10px;
	background: none;
	border: none;
	cursor: pointer;
	color: rgba(255, 255, 255, 0.85);
	font-size: 16px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 4px;
	transition: background 150ms ease;
}

.hwp-agents-close:hover,
.hwp-agents-close:focus-visible {
	background: rgba(0, 0, 0, 0.15);
	outline: none;
}

.hwp-agents-footer {
	text-align: center;
	padding: 8px 16px 10px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.hwp-agents-footer a {
	font-size: 11px;
	color: rgba(0, 0, 0, 0.35);
	text-decoration: none;
	font-family: inherit;
}

.hwp-agents-footer a:hover {
	color: rgba(0, 0, 0, 0.55);
}

@media (max-width: 480px) {
	.hwp-agents-menu {
		bottom: 82px; /* 16px margem + 50px botão + 16px gap */
		right: 16px;
		max-width: calc(100vw - 32px);
	}

	#hwp-whatsapp-btn.hwp-wa-left ~ .hwp-agents-menu {
		right: auto;
		left: 16px;
	}

	/* Botão fechado no mobile: 30px altura + 16px margem + 16px gap = 62px */
	#hwp-whatsapp-btn.hwp-wa-closed ~ .hwp-agents-menu {
		bottom: 62px;
	}
}

/* ---------------------------------------------------------
   Respeita preferência de movimento reduzido
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.hwp-wa-btn {
		animation: none;   /* cancela a entrada animada */
		opacity: 1;        /* garante visibilidade imediata */
		transform: scale(1);
	}

	.hwp-wa-btn a {
		transition: none;
	}

	.hwp-wa-btn.hwp-wa-pulse a,
	.hwp-anim-atencao-pulse {
		animation: none;
	}

	.hwp-anim-entrada-slide,
	.hwp-wa-left.hwp-anim-entrada-slide,
	.hwp-anim-entrada-fade,
	.hwp-anim-entrada-bounce,
	.hwp-anim-entrada-zoom,
	.hwp-anim-entrada-flip {
		animation: none;
	}

	.hwp-anim-atencao-shake,
	.hwp-anim-atencao-ring,
	.hwp-anim-atencao-blink {
		animation: none;
	}

	.hwp-anim-atencao-shockwave::after {
		animation: none;
	}
}
