/* Forza Zap — estilos do front-end */

#fzap-widget {
	--fzap-color: #25D366;
	--fzap-bottom: 20px;
	--fzap-side: 20px;
	--fzap-size: 60px;
	position: fixed !important;
	display: flex;
	flex-direction: column;
	bottom: var(--fzap-bottom);
	/* Força o widget à frente de tudo (cabeçalhos fixos, banners de cookie, outros chats). */
	z-index: 2147483647 !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.4;
	box-sizing: border-box;
}

#fzap-widget *,
#fzap-widget *::before,
#fzap-widget *::after {
	box-sizing: border-box;
}

#fzap-widget.fzap-pos-right { right: var(--fzap-side); align-items: flex-end; }
#fzap-widget.fzap-pos-left  { left: var(--fzap-side); align-items: flex-start; }

/* ---------- Botão flutuante ---------- */
.fzap-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: var(--fzap-size);
	height: var(--fzap-size);
	padding: 0;
	border: none;
	border-radius: 50px;
	background: var(--fzap-color);
	color: #fff !important;
	text-decoration: none !important;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.fzap-button:hover { transform: scale(1.06); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34); }
/* Indicador de foco de dupla cor: contorno branco (contraste sobre o verde) + anel escuro (contraste sobre fundos claros/escuros). */
.fzap-button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.55); }

.fzap-button .fzap-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--fzap-size);
	height: var(--fzap-size);
	flex: 0 0 var(--fzap-size);
}

.fzap-button .fzap-icon svg { width: 30px; height: 30px; }

.fzap-icon-close {
	position: absolute;
	top: 0;
	left: 0;
	font-size: 30px;
	line-height: 1;
	opacity: 0;
	transform: scale(0.4) rotate(-90deg);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.fzap-icon-wa { transition: opacity 0.18s ease, transform 0.18s ease; }

/* Estado aberto: troca ícone do WhatsApp pelo "X" */
#fzap-widget.fzap-open .fzap-icon-wa { opacity: 0; transform: scale(0.4) rotate(90deg); }
#fzap-widget.fzap-open .fzap-icon-close { opacity: 1; transform: scale(1) rotate(0); }

.fzap-button-label {
	padding-right: 20px;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
}
#fzap-widget.fzap-pos-left .fzap-button-label { padding-right: 0; padding-left: 20px; order: -1; }

/* Pulso ao redor do botão */
.fzap-button::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: var(--fzap-size);
	height: var(--fzap-size);
	border-radius: 50%;
	background: var(--fzap-color);
	z-index: -1;
	animation: fzap-pulse 2.4s ease-out infinite;
}
#fzap-widget.fzap-pos-right .fzap-button::after { left: auto; right: 0; }
#fzap-widget.fzap-open .fzap-button::after { animation: none; opacity: 0; }

@keyframes fzap-pulse {
	0%   { transform: scale(1); opacity: 0.55; }
	70%  { transform: scale(1.7); opacity: 0; }
	100% { transform: scale(1.7); opacity: 0; }
}

/* ---------- Balão de saudação ---------- */
.fzap-greeting {
	position: relative;
	max-width: min(260px, calc(100vw - var(--fzap-side) - 16px));
	margin-bottom: 12px;
	padding: 12px 34px 12px 14px;
	background: #fff;
	color: #1f2d3d;
	font-size: 14px;
	border-radius: 14px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
	opacity: 0;
	transform: translateY(10px);
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
#fzap-widget.fzap-greeting-visible .fzap-greeting { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s; }
/* Em posição esquerda, espelha o padding e o botão de fechar para acompanhar a seta. */
#fzap-widget.fzap-pos-left .fzap-greeting { padding: 12px 14px 12px 34px; }

.fzap-greeting::after {
	content: "";
	position: absolute;
	bottom: -7px;
	width: 14px;
	height: 14px;
	background: #fff;
	transform: rotate(45deg);
	box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.08);
}
#fzap-widget.fzap-pos-right .fzap-greeting::after { right: 22px; }
#fzap-widget.fzap-pos-left .fzap-greeting::after { left: 22px; }

.fzap-greeting-close {
	position: absolute;
	top: 4px;
	right: 6px;
	border: none;
	background: transparent;
	font-size: 18px;
	line-height: 1;
	color: #9aa5b1;
	cursor: pointer;
	padding: 2px 4px;
}
.fzap-greeting-close:hover { color: #52606d; }
.fzap-greeting-close:focus-visible { outline: 2px solid var(--fzap-color); outline-offset: 2px; border-radius: 4px; }
#fzap-widget.fzap-pos-left .fzap-greeting-close { right: auto; left: 6px; }

/* ---------- Janela de pré-atendimento ---------- */
.fzap-popup {
	display: flex;
	flex-direction: column;
	width: 320px;
	max-width: calc(100vw - var(--fzap-side) - 16px);
	max-height: calc(100vh - var(--fzap-bottom) - var(--fzap-size) - 28px);
	margin-bottom: 14px;
	background: #efe7de;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	transform-origin: bottom right;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}
#fzap-widget.fzap-pos-left .fzap-popup { transform-origin: bottom left; }
/* Fechado: visibility:hidden remove os controles internos da ordem de tabulação. */
#fzap-widget.fzap-open .fzap-popup { opacity: 1; transform: translateY(0) scale(1); visibility: visible; pointer-events: auto; transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s; }

.fzap-popup-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	background: var(--fzap-color);
	color: #fff;
	flex: 0 0 auto;
}

.fzap-avatar {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 46px;
	background: rgba(255, 255, 255, 0.2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}
.fzap-avatar-fallback svg { width: 26px; height: 26px; }

.fzap-header-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fzap-name { font-weight: 700; font-size: 15px; }
.fzap-subtitle { font-size: 12px; opacity: 0.92; display: inline-flex; align-items: center; gap: 6px; }
.fzap-dot { width: 8px; height: 8px; border-radius: 50%; background: #a6f7c1; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }

.fzap-close {
	margin-left: auto;
	border: none;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
	opacity: 0.9;
	align-self: flex-start;
}
.fzap-close:hover { opacity: 1; }
.fzap-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; opacity: 1; }

.fzap-popup-body {
	padding: 22px 16px;
	background-color: #efe7de;
	background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='1.4' fill='%23000' opacity='0.04'/%3E%3C/svg%3E");
	min-height: 96px;
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.fzap-msg {
	position: relative;
	max-width: 85%;
	padding: 10px 12px;
	background: #fff;
	border-radius: 0 10px 10px 10px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
	animation: fzap-msg-in 0.4s ease both;
}
.fzap-msg-name { display: block; font-size: 12px; color: var(--fzap-color); margin-bottom: 2px; }
.fzap-msg p { margin: 0; font-size: 14px; color: #1f2d3d; word-wrap: break-word; }

@keyframes fzap-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Formulário de pré-atendimento ---------- */
.fzap-form { margin-top: 16px; }
.fzap-field { margin-top: 14px; }
.fzap-field:first-child { margin-top: 0; }

.fzap-form-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #2b3a45;
	margin-bottom: 8px;
}

.fzap-segments { display: flex; flex-wrap: wrap; gap: 8px; }
.fzap-segment {
	padding: 8px 14px;
	border: 1.5px solid #cfd8d3;
	border-radius: 20px;
	background: #fff;
	color: #1f2d3d;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.fzap-segment:hover { border-color: var(--fzap-color); }
/* Selecionado: tom claro + texto escuro + negrito (contraste AA, não depende só da cor).
   Fallback fixo para navegadores sem color-mix. */
.fzap-segment[aria-pressed="true"] {
	background: #e9f9f0;
	background: color-mix(in srgb, var(--fzap-color) 16%, #fff);
	border-color: var(--fzap-color);
	color: #0a5c2e;
	color: color-mix(in srgb, var(--fzap-color), #000 55%);
	font-weight: 600;
}
.fzap-segment:focus-visible { outline: 2px solid var(--fzap-color); outline-offset: 2px; }

.fzap-input {
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid #cfd8d3;
	border-radius: 10px;
	background: #fff;
	color: #1f2d3d;
	font-size: 14px;
	line-height: 1.3;
}
.fzap-input::placeholder { color: #9aa5b1; }
.fzap-input:focus {
	outline: none;
	border-color: var(--fzap-color);
	box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}

/* ---------- Prévia da mensagem (analisar antes de enviar) ---------- */
.fzap-preview { margin-top: 16px; }
.fzap-preview-label { display: block; font-size: 11px; color: #52606d; margin-bottom: 5px; }
.fzap-preview-text {
	max-width: 92%;
	margin: 0 0 0 auto;
	padding: 10px 12px;
	background: #dcf8c6;
	border-radius: 10px 0 10px 10px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
	font-size: 13px;
	color: #1f2d3d;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.fzap-popup-footer { padding: 12px 16px 16px; background: #efe7de; flex: 0 0 auto; }
.fzap-start {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px;
	border-radius: 30px;
	background: var(--fzap-color);
	color: #fff !important;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	transition: filter 0.15s ease;
}
.fzap-start:hover { filter: brightness(0.94); }
.fzap-start:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.45); }
.fzap-start svg { width: 22px; height: 22px; }

/* ---------- Responsivo ---------- */
@media (max-width: 480px) {
	#fzap-widget { --fzap-size: 56px; }
	.fzap-popup { width: calc(100vw - var(--fzap-side) - 16px); }
	.fzap-button-label { display: none; }
}

/* Exibição por dispositivo (largura como proxy de mobile/desktop) */
@media (max-width: 768px) {
	#fzap-widget.fzap-hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
	#fzap-widget.fzap-hide-desktop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
	.fzap-button::after { animation: none; }
	.fzap-popup,
	.fzap-greeting,
	.fzap-msg,
	.fzap-button,
	#fzap-widget.fzap-open .fzap-popup,
	#fzap-widget.fzap-greeting-visible .fzap-greeting { transition: none; animation: none; }
}
