/* ==========================================================================
   Visual Fachadas Voltagem — Chat de IA Widget Styling
   ========================================================================== */

.vf-ai-chat-widget {
	position: fixed;
	bottom: 30px;
	right: 30px;
	z-index: 99999;
	font-family: var(--wp--preset--font-family--montserrat), system-ui, -apple-system, sans-serif;
}

/* 1. Toggle Button */
.vf-ai-chat-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--wp--preset--color--electric-blue, #0066FF);
	color: #ffffff;
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 32px rgba(0, 102, 255, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vf-ai-chat-toggle:hover {
	transform: scale(1.08) rotate(5deg);
	background: var(--wp--preset--color--electric-blue-dark, #0052CC);
	box-shadow: 0 12px 40px rgba(0, 102, 255, 0.6);
}

/* 2. Chat Box */
.vf-ai-chat-box {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 380px;
	height: 520px;
	background: rgba(17, 24, 39, 0.85); /* Surface with alpha */
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(0, 102, 255, 0.2);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
	transform-origin: bottom right;
}

.vf-ai-chat-box.is-active {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* 3. Header */
.vf-ai-chat-header {
	background: linear-gradient(135deg, var(--wp--preset--color--surface-light, #1A2332), rgba(17, 24, 39, 0.9));
	padding: 15px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid rgba(0, 102, 255, 0.15);
}

.vf-ai-chat-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.vf-ai-chat-avatar {
	font-size: 24px;
	background: rgba(0, 102, 255, 0.15);
	padding: 6px;
	border-radius: 50%;
	border: 1px solid rgba(0, 102, 255, 0.3);
}

.vf-ai-chat-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
}

.vf-ai-chat-status {
	font-size: 11px;
	color: var(--wp--preset--color--whatsapp-green, #25D366);
	display: flex;
	align-items: center;
	gap: 4px;
}

.vf-ai-chat-status::before {
	content: '';
	width: 6px;
	height: 6px;
	background-color: currentColor;
	border-radius: 50%;
	display: inline-block;
	box-shadow: 0 0 8px currentColor;
}

.vf-ai-chat-close {
	background: none;
	border: none;
	color: #8899AA;
	font-size: 24px;
	cursor: pointer;
	transition: color 0.2s;
	line-height: 1;
}

.vf-ai-chat-close:hover {
	color: #ffffff;
}

/* 4. Messages Body */
.vf-ai-chat-messages {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 16px;
	background: rgba(5, 10, 20, 0.4);
}

/* Scrollbar styling */
.vf-ai-chat-messages::-webkit-scrollbar {
	width: 6px;
}
.vf-ai-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}
.vf-ai-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(0, 102, 255, 0.2);
	border-radius: 3px;
}
.vf-ai-chat-messages::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 102, 255, 0.4);
}

/* 5. Message Bubbles */
.vf-ai-chat-message {
	display: flex;
	width: 100%;
}

.vf-ai-chat-bubble {
	max-width: 80%;
	padding: 12px 16px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.5;
}

.vf-ai-chat-bubble p {
	margin: 0 0 8px 0;
}
.vf-ai-chat-bubble p:last-child {
	margin: 0;
}
.vf-ai-chat-bubble ul {
	margin: 5px 0;
	padding-left: 20px;
}
.vf-ai-chat-bubble li {
	margin-bottom: 4px;
}

.vf-ai-chat-message.is-user {
	justify-content: flex-end;
}

.vf-ai-chat-message.is-user .vf-ai-chat-bubble {
	background: var(--wp--preset--color--electric-blue, #0066FF);
	color: #ffffff;
	border-bottom-right-radius: 2px;
	box-shadow: 0 4px 15px rgba(0, 102, 255, 0.25);
}

.vf-ai-chat-message.is-model .vf-ai-chat-bubble {
	background: var(--wp--preset--color--surface-light, #1A2332);
	color: var(--wp--preset--color--chrome-silver, #C8C8C8);
	border: 1px solid rgba(0, 102, 255, 0.1);
	border-bottom-left-radius: 2px;
}

.vf-ai-chat-message.is-model strong {
	color: #ffffff;
}

.vf-ai-chat-message.is-model a {
	color: var(--wp--preset--color--amber, #FFAA00);
	text-decoration: underline;
}

/* Typing Indicator Animation */
.vf-ai-chat-dots {
	display: flex;
	align-items: center;
	gap: 4px;
	height: 15px;
}

.vf-ai-chat-dots span {
	width: 6px;
	height: 6px;
	background: #8899AA;
	border-radius: 50%;
	animation: vfDotPulse 1.4s infinite ease-in-out both;
}

.vf-ai-chat-dots span:nth-child(1) { animation-delay: -0.32s; }
.vf-ai-chat-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes vfDotPulse {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* 6. Input Area */
.vf-ai-chat-input-area {
	padding: 15px 20px;
	background: rgba(26, 35, 50, 0.9);
	border-top: 1px solid rgba(0, 102, 255, 0.15);
	display: flex;
	align-items: flex-end;
	gap: 12px;
}

.vf-ai-chat-input {
	flex: 1;
	background: rgba(5, 10, 20, 0.6);
	border: 1px solid rgba(0, 102, 255, 0.25);
	border-radius: 8px;
	color: #ffffff;
	padding: 10px 14px;
	font-size: 13.5px;
	resize: none;
	outline: none;
	max-height: 120px;
	min-height: 38px;
	line-height: 1.4;
	transition: border-color 0.2s;
}

.vf-ai-chat-input:focus {
	border-color: var(--wp--preset--color--electric-blue, #0066FF);
}

.vf-ai-chat-send {
	background: var(--wp--preset--color--electric-blue, #0066FF);
	color: #ffffff;
	border: none;
	width: 38px;
	height: 38px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s, transform 0.2s;
	flex-shrink: 0;
}

.vf-ai-chat-send:hover {
	background: var(--wp--preset--color--electric-blue-dark, #0052CC);
	transform: scale(1.05);
}

/* 7. Responsiveness */
@media (max-width: 480px) {
	.vf-ai-chat-widget {
		bottom: 20px;
		right: 20px;
	}
	.vf-ai-chat-box {
		width: calc(100vw - 40px);
		height: calc(100vh - 120px);
		max-height: 600px;
		bottom: 75px;
	}
}

/* 8. Smart Microphone */
.vf-ai-chat-mic {
	background: transparent;
	border: none;
	color: #8899AA;
	width: 38px;
	height: 38px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s, color 0.2s, transform 0.2s;
	flex-shrink: 0;
	border: 1px solid rgba(0, 102, 255, 0.15);
}

.vf-ai-chat-mic:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.05);
}

.vf-ai-chat-mic.is-listening {
	color: #EF4444;
	border-color: rgba(239, 68, 68, 0.4);
	background: rgba(239, 68, 68, 0.1);
	animation: vfMicPulse 1.2s infinite ease-in-out;
}

.vf-ai-chat-mic.is-processing {
	color: #3B82F6;
	border-color: rgba(59, 130, 246, 0.4);
	background: rgba(59, 130, 246, 0.1);
	animation: vfMicSpin 1s linear infinite;
}

@keyframes vfMicPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.08); }
	100% { transform: scale(1); }
}

@keyframes vfMicSpin {
	to { transform: rotate(360deg); }
}
