/* AI Sales Agent - Widget de chat (front-end) e utilitários de admin */

.ai-agent-chat-root {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Estado inicial (antes dos 3s): widget totalmente oculto e deslocado para baixo. */
.ai-agent-root-hidden {
	opacity: 0;
	transform: translateY(40px);
	pointer-events: none;
}

/* Disparado via JS após 3s: sobe suavemente até a posição final. */
.ai-agent-root-enter {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
	transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-agent-launcher-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.ai-agent-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, #6d28d9, #4f46e5);
	color: #fff;
	font-size: 26px;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
	transition: transform 0.15s ease;
}

.ai-agent-launcher:hover {
	transform: scale(1.06);
}

/* Balão de texto (tooltip) acima da bolinha de chat. */
.ai-agent-tooltip {
	position: absolute;
	bottom: 74px;
	right: 0;
	max-width: 220px;
	background: #ffffff;
	color: #1f2937;
	font-size: 13px;
	line-height: 1.4;
	padding: 10px 14px;
	border-radius: 14px;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
	cursor: pointer;
	opacity: 0;
	transform: translateY(8px) scale(0.96);
	transition: opacity 0.3s ease, transform 0.3s ease;
	white-space: normal;
}

.ai-agent-tooltip::after {
	content: "";
	position: absolute;
	bottom: -6px;
	right: 22px;
	width: 12px;
	height: 12px;
	background: #ffffff;
	transform: rotate(45deg);
	box-shadow: 3px 3px 6px rgba(15, 23, 42, 0.06);
}

.ai-agent-tooltip-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* Efeito sutil de "pulse" no botão, disparado a cada 12s via JS para chamar atenção. */
.ai-agent-pulse {
	animation: ai-agent-pulse-anim 0.9s ease-in-out;
}

@keyframes ai-agent-pulse-anim {
	0% { transform: scale(1); box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35); }
	30% { transform: scale(1.12) rotate(-4deg); }
	50% { transform: scale(0.97) rotate(3deg); }
	70% { transform: scale(1.06) rotate(-2deg); }
	100% { transform: scale(1) rotate(0); box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35); }
}

.ai-agent-panel {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 340px;
	max-width: 92vw;
	height: 480px;
	max-height: 75vh;
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.ai-agent-hidden {
	display: none !important;
}

.ai-agent-header {
	background: linear-gradient(135deg, #6d28d9, #4f46e5);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-weight: 600;
}

.ai-agent-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.ai-agent-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f8f7ff;
}

.ai-agent-message {
	max-width: 82%;
	padding: 10px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.ai-agent-message-bot {
	align-self: flex-start;
	background: #ffffff;
	border: 1px solid #ece9fe;
	color: #1f2937;
	border-bottom-left-radius: 4px;
}

.ai-agent-message-bot a {
	color: #4f46e5;
	text-decoration: underline;
	word-break: break-all;
}

.ai-agent-message-bot a:hover {
	color: #3730a3;
}

.ai-agent-message-user {
	align-self: flex-end;
	background: #4f46e5;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.ai-agent-email-capture {
	background: #ffffff;
	border: 1px solid #ece9fe;
	border-radius: 14px;
	padding: 12px;
	font-size: 13px;
}

.ai-agent-email-capture p {
	margin: 0 0 8px 0;
	color: #374151;
}

.ai-agent-email-input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid #d1d5db;
	font-size: 13px;
	margin-bottom: 8px;
}

.ai-agent-input-error {
	border-color: #dc2626 !important;
}

.ai-agent-email-actions {
	display: flex;
	gap: 8px;
}

.ai-agent-email-confirm,
.ai-agent-email-skip {
	flex: 1;
	padding: 8px 10px;
	border-radius: 8px;
	border: none;
	font-size: 12px;
	cursor: pointer;
}

.ai-agent-email-confirm {
	background: #4f46e5;
	color: #fff;
}

.ai-agent-email-skip {
	background: #e5e7eb;
	color: #374151;
}

.ai-agent-typing {
	padding: 0 16px 8px;
	display: flex;
	gap: 4px;
}

.ai-agent-typing.ai-agent-hidden {
	display: none;
}

.ai-agent-typing span {
	width: 6px;
	height: 6px;
	background: #a5a1ff;
	border-radius: 50%;
	display: inline-block;
	animation: ai-agent-bounce 1.2s infinite ease-in-out;
}

.ai-agent-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.ai-agent-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes ai-agent-bounce {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
	40% { transform: translateY(-4px); opacity: 1; }
}

.ai-agent-footer {
	display: flex;
	border-top: 1px solid #ece9fe;
	padding: 10px;
	gap: 8px;
	background: #fff;
}

.ai-agent-input {
	flex: 1;
	padding: 10px 12px;
	border-radius: 20px;
	border: 1px solid #d1d5db;
	font-size: 14px;
}

.ai-agent-send {
	padding: 0 16px;
	border-radius: 20px;
	border: none;
	background: #4f46e5;
	color: #fff;
	font-size: 13px;
	cursor: pointer;
}

.ai-agent-send:disabled {
	opacity: 0.6;
	cursor: default;
}

@media (max-width: 480px) {
	.ai-agent-panel {
		width: 92vw;
		right: 4vw;
	}
}

/* ---------------- Admin ---------------- */

.ai-agent-wrap .ai-agent-autocomplete-results {
	position: relative;
	max-width: 400px;
	border: 1px solid #ccd0d4;
	background: #fff;
	display: none;
}

.ai-agent-wrap .ai-agent-autocomplete-results.active {
	display: block;
}

.ai-agent-wrap .ai-agent-autocomplete-item {
	padding: 8px 10px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f1;
}

.ai-agent-wrap .ai-agent-autocomplete-item:hover {
	background: #f0f0f1;
}
