.ap-chat-embed, .ap-floating-panel {
	--ap-primary: #25D366;
	--ap-bg: #ffffff;
	--ap-bot-bg: #f0f0f0;
	--ap-bot-text: #111111;
	--ap-user-bg: #25D366;
	--ap-user-text: #ffffff;
	--ap-header-text: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}
.ap-chat-embed *, .ap-floating-panel * { box-sizing: border-box; }

/* ---------- Contêiner principal do chat ---------- */
.ap-widget {
	display: flex;
	flex-direction: column;
	background: var(--ap-bg);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0,0,0,.14);
	max-width: 420px;
	height: 560px;
	max-height: 80vh;
	margin: 0 auto;
}

/* Quando inserido via shortcode (não como bolha flutuante), o chat ocupa
   todo o espaço da página em que foi colocado. */
.ap-chat-embed.ap-fullpage {
	width: 100%;
}
.ap-chat-embed.ap-fullpage .ap-widget {
	width: 100%;
	max-width: 100%;
	height: 100vh;
	max-height: none;
	border-radius: 0;
	box-shadow: none;
	margin: 0;
}

.ap-header {
	background: var(--ap-primary);
	color: var(--ap-header-text);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}
.ap-header-avatar {
	width: 42px; height: 42px; border-radius: 50%;
	background: rgba(255,255,255,.25);
	background-size: cover; background-position: center;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}
.ap-header-avatar svg { width: 22px; height: 22px; opacity: .9; }
.ap-header-info { flex: 1; min-width: 0; }
.ap-header-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.ap-header-status { font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 5px; }
.ap-header-status::before {
	content: ''; width: 7px; height: 7px; border-radius: 50%;
	background: #7CFF8C; display: inline-block;
}
.ap-header-close {
	background: transparent; border: none; color: var(--ap-header-text);
	opacity: .85; cursor: pointer; font-size: 20px; line-height: 1; padding: 4px;
	display: none;
}
.ap-floating-panel .ap-header-close { display: block; }

.ap-progress-track { height: 3px; background: rgba(0,0,0,.06); flex-shrink: 0; }
.ap-progress-bar { height: 100%; background: var(--ap-primary); width: 0%; transition: width .35s ease; }

/* ---------- Corpo de mensagens ---------- */
.ap-body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--ap-bg);
}
.ap-row { display: flex; align-items: flex-end; gap: 8px; max-width: 92%; animation: ap-fade-in .25s ease; }
.ap-row.ap-from-user { align-self: flex-end; flex-direction: row-reverse; }
.ap-row.ap-from-bot { align-self: flex-start; }

.ap-bubble-avatar {
	width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
	background: var(--ap-primary); background-size: cover; background-position: center;
}

.ap-bubble {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
}
.ap-from-bot .ap-bubble { background: var(--ap-bot-bg); color: var(--ap-bot-text); border-bottom-left-radius: 4px; }
.ap-from-user .ap-bubble { background: var(--ap-user-bg); color: var(--ap-user-text); border-bottom-right-radius: 4px; }

.ap-typing { display: flex; gap: 4px; padding: 12px 14px; background: var(--ap-bot-bg); border-radius: 16px; border-bottom-left-radius: 4px; width: fit-content; }
.ap-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9a9a9a; animation: ap-bounce 1.2s infinite ease-in-out; }
.ap-typing span:nth-child(2) { animation-delay: .15s; }
.ap-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes ap-bounce { 0%, 60%, 100% { transform: translateY(0); opacity:.5; } 30% { transform: translateY(-4px); opacity:1; } }
@keyframes ap-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Opções (seleção múltipla) ---------- */
.ap-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; align-self: flex-start; max-width: 100%; }
.ap-option-chip {
	border: 1.5px solid var(--ap-primary);
	color: var(--ap-primary);
	background: transparent;
	padding: 8px 14px;
	border-radius: 20px;
	font-size: 13.5px;
	cursor: pointer;
	transition: all .15s ease;
}
.ap-option-chip.ap-selected { background: var(--ap-primary); color: var(--ap-user-text); }

/* ---------- Botão "Continuar" (mensagens) ---------- */
.ap-continue-wrap { align-self: flex-start; margin-top: 2px; }
.ap-btn-primary {
	background: var(--ap-primary);
	color: var(--ap-user-text);
	border: none;
	padding: 10px 20px;
	border-radius: 22px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	box-shadow: 0 2px 8px rgba(0,0,0,.12);
	transition: transform .12s ease;
}
.ap-btn-primary:hover { transform: translateY(-1px); }
.ap-btn-primary:disabled { opacity: .6; cursor: default; transform: none; }

/* ---------- Área de resposta (input) ---------- */
.ap-footer {
	flex-shrink: 0;
	padding: 12px;
	background: var(--ap-bg);
	border-top: 1px solid rgba(0,0,0,.06);
}
.ap-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #f5f6f7;
	border: 1.5px solid transparent;
	border-radius: 26px;
	padding: 6px 6px 6px 16px;
	transition: border-color .15s ease;
}
.ap-input-row.ap-focused { border-color: var(--ap-primary); }
.ap-input-row textarea, .ap-input-row input[type="text"], .ap-input-row input[type="email"], .ap-input-row input[type="tel"] {
	flex: 1;
	border: none;
	background: transparent;
	outline: none;
	font-size: 14.5px;
	resize: none;
	max-height: 90px;
	padding: 8px 0;
	font-family: inherit;
}
.ap-send-btn {
	flex-shrink: 0;
	background: var(--ap-primary);
	border: none; color: var(--ap-user-text);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	padding: 9px 18px;
	border-radius: 20px;
	font-size: 13.5px;
	font-weight: 700;
	font-family: inherit;
	white-space: nowrap;
	transition: transform .12s ease, opacity .15s ease;
}
.ap-send-btn:hover:not(:disabled) { transform: scale(1.03); }
.ap-send-btn:disabled { opacity: .45; cursor: default; transform: none; }

.ap-error-msg {
	color: #d0342c;
	font-size: 12.5px;
	margin: 6px 2px 0 2px;
	display: none;
}
.ap-error-msg.ap-show { display: block; animation: ap-shake .3s ease; }
@keyframes ap-shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }

.ap-footer.ap-hidden { display: none; }

/* ---------- Bolha flutuante ---------- */
.ap-floating-wrap { position: fixed; bottom: 22px; z-index: 999999; }
.ap-floating-wrap.ap-pos-bottom-right { right: 22px; }
.ap-floating-wrap.ap-pos-bottom-left { left: 22px; }

.ap-launcher-btn {
	background: transparent;
	border: none;
	padding: 0;
	display: flex;
	align-items: center;
	cursor: pointer;
	font-family: inherit;
}

.ap-launcher-card {
	background: #fff;
	color: #2b2b2b;
	padding: 14px 16px;
	border-radius: 18px;
	box-shadow: 0 10px 30px rgba(0,0,0,.16);
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.35;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	max-width: 180px;
	text-align: left;
	margin-right: -20px;
	padding-right: 30px;
	position: relative;
	z-index: 1;
	transition: opacity .15s ease, transform .15s ease;
}
.ap-launcher-chat-icon { width: 16px; height: 16px; color: #b0b3b8; flex-shrink: 0; margin-bottom: 1px; }

.ap-launcher-avatar-wrap {
	position: relative;
	z-index: 2;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	flex-shrink: 0;
	box-shadow: 0 8px 22px rgba(0,0,0,.24);
}
.ap-launcher-avatar {
	width: 100%; height: 100%;
	border-radius: 50%;
	background-size: cover;
	background-position: center;
	background-color: var(--ap-primary, #25D366);
	border: 3px solid #fff;
	display: flex; align-items: center; justify-content: center;
	color: #fff;
	box-sizing: border-box;
}
.ap-launcher-avatar-default svg { width: 26px; height: 26px; }

.ap-online-dot {
	position: absolute;
	bottom: 1px; right: 1px;
	width: 15px; height: 15px;
	border-radius: 50%;
	background: #31d158;
	border: 2.5px solid #fff;
}

.ap-launcher-close-icon {
	display: none;
	position: absolute;
	inset: 0;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	background: rgba(0,0,0,.5);
	border-radius: 50%;
}

.ap-pos-bottom-left .ap-launcher-btn { flex-direction: row-reverse; }
.ap-pos-bottom-left .ap-launcher-card { margin-right: 0; margin-left: -20px; padding-right: 16px; padding-left: 30px; }

.ap-floating-wrap.ap-open .ap-launcher-card { opacity: 0; transform: scale(.9); pointer-events: none; position: absolute; }
.ap-floating-wrap.ap-open .ap-launcher-close-icon { display: flex; }

.ap-floating-panel {
	display: none;
	position: absolute;
	bottom: 76px;
	width: 380px;
}
.ap-pos-bottom-right .ap-floating-panel { right: 0; }
.ap-pos-bottom-left .ap-floating-panel { left: 0; }

.ap-floating-wrap.ap-open .ap-floating-panel { display: block; animation: ap-pop-in .22s ease; }

@keyframes ap-pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 480px) {
	.ap-floating-panel { width: calc(100vw - 32px); }
	.ap-floating-wrap.ap-pos-bottom-right, .ap-floating-wrap.ap-pos-bottom-left { left: 16px; right: 16px; bottom: 16px; }
	.ap-widget { height: 70vh; max-width: 100%; }
}
