/* Copyright (c) 2025, Synergyflow and Contributors */
/* License: MIT. See LICENSE */

/* Widget flotante de chat IA - SynergyFlow Blue Edition */

.ai-chat-widget {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Botón flotante */
.ai-chat-button {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: rgb(82, 146, 247) !important;
	background-image: none !important;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: all 0.3s ease;
	border: none;
}

.ai-chat-button:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(27, 102, 255, 0.3);
}

.ai-chat-button:active {
	transform: scale(0.95);
}

/* Panel de chat */
.ai-chat-panel {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 400px;
	height: 600px;
	max-height: calc(100vh - 100px);
	background: white;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: slideUp 0.3s ease;
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Header */
.ai-chat-header {
	background: rgb(82, 146, 247) !important;
	background-image: none !important;
	color: white;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 16px;
}

.ai-chat-title svg {
	flex-shrink: 0;
}

.ai-chat-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ai-chat-close,
.ai-chat-clear {
	background: transparent;
	border: none;
	color: white;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background 0.2s;
}

.ai-chat-close:hover,
.ai-chat-clear:hover {
	background: rgba(255, 255, 255, 0.1);
}

/* Mensajes */
.ai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f8f9fa;
}

.ai-chat-message {
	display: flex;
	animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

.ai-chat-message-bot {
	justify-content: flex-start;
}

.ai-chat-message-content {
	max-width: 75%;
	padding: 12px 16px;
	border-radius: 18px;
	word-wrap: break-word;
	line-height: 1.5;
	font-size: 14px;
}

.ai-chat-message-user .ai-chat-message-content {
	background: rgb(82, 146, 247) !important;
	background-image: none !important;
	color: white;
	border-bottom-right-radius: 4px;
}

.ai-chat-message-bot .ai-chat-message-content {
	background: white;
	color: #333;
	border: 1px solid #e0e0e0;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chat-message-error .ai-chat-message-content {
	background: #fee;
	color: #c33;
	border-color: #fcc;
}

/* Loading indicator */
.ai-chat-loading {
	padding: 12px 20px;
	display: flex;
	justify-content: center;
	background: #f8f9fa;
}

.ai-chat-loading-dots {
	display: flex;
	gap: 6px;
}

.ai-chat-loading-dots span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgb(82, 146, 247) !important;
	animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

	0%,
	80%,
	100% {
		transform: scale(0);
		opacity: 0.5;
	}

	40% {
		transform: scale(1);
		opacity: 1;
	}
}

/* Input container */
.ai-chat-input-container {
	padding: 16px 20px;
	background: white;
	border-top: 1px solid #e0e0e0;
	display: flex;
	gap: 12px;
	align-items: center;
}

.ai-chat-input {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid #e0e0e0;
	border-radius: 24px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
}

.ai-chat-input:focus {
	border-color: rgb(82, 146, 247) !important;
}

.ai-chat-send {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgb(82, 146, 247) !important;
	background-image: none !important;
	color: white;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
}

.ai-chat-send:hover {
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(27, 102, 255, 0.4);
}

.ai-chat-send:active {
	transform: scale(0.95);
}

.ai-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Scrollbar personalizado */
.ai-chat-messages::-webkit-scrollbar {
	width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* Responsive */
@media (max-width: 480px) {
	.ai-chat-panel {
		width: calc(100vw - 40px);
		height: calc(100vh - 100px);
		right: -20px;
		bottom: 80px;
	}
}