/* Variables Colors and Theme */
:root {
	--emma-primary: #0d6efd;
	--emma-primary-hover: #0b5ed7;
	--emma-bg-chat: #ffffff;
	--emma-text-main: #333333;
	--emma-text-light: #666666;
	--emma-msg-bot: #f0f2f5;
	--emma-msg-user: #0d6efd;
	--emma-border: #e2e4e7;
	--emma-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	--emma-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);
	--emma-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Container */
.emma-ia-widget-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: var(--emma-font);
}

/* Bubble */
.emma-ia-bubble {
	width: 60px;
	height: 60px;
	background-color: var(--emma-primary);
	color: white;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--emma-shadow);
	cursor: pointer;
	transition: all 0.3s ease;
}

.emma-ia-bubble:hover {
	transform: scale(1.05);
	box-shadow: var(--emma-shadow-hover);
}

/* Chat Window */
.emma-ia-chat-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 350px;
	height: 500px;
	max-height: calc(100vh - 100px);
	background-color: white;
	border-radius: 12px;
	box-shadow: var(--emma-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: opacity 0.3s ease, transform 0.3s ease;
	transform-origin: bottom right;
}

.emma-ia-chat-window.emma-ia-hidden {
	opacity: 0;
	transform: scale(0.8);
	pointer-events: none;
}

/* Header */
.emma-ia-chat-header {
	background-color: var(--emma-primary);
	color: white;
	padding: 20px;
	border-radius: 12px 12px 0 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.emma-ia-header-info {
	display: flex;
	align-items: center;
}

.emma-ia-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	margin-right: 12px;
	object-fit: cover;
	background-color: white;
	border: 2px solid rgba(255,255,255,0.2);
}

.emma-ia-title h4 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: white;
}

.emma-ia-subtitle {
	font-size: 13px;
	opacity: 0.9;
	margin-bottom: 2px;
	font-weight: 400;
}

.emma-ia-close-btn {
	background: none;
	border: none;
	color: white;
	font-size: 24px;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s;
	padding: 0;
	line-height: 1;
}

.emma-ia-close-btn:hover {
	opacity: 1;
}

/* Messages Area */
.emma-ia-chat-messages {
	flex: 1;
	background-color: var(--emma-bg-chat);
	padding: 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

.emma-ia-message-wrap {
	margin-bottom: 15px;
	max-width: 85%;
	display: flex;
	flex-direction: column;
}

.emma-ia-message-wrap.user-wrap {
	align-self: flex-end;
}

.emma-ia-message-wrap.bot-wrap {
	align-self: flex-start;
}

.emma-ia-message {
	padding: 12px 16px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: none;
	word-wrap: break-word;
}

.emma-ia-message.bot {
	background-color: var(--emma-msg-bot);
	color: var(--emma-text-main);
	border-bottom-left-radius: 4px;
}

.emma-ia-message.user {
	background-color: var(--emma-msg-user);
	color: white;
	border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.emma-ia-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
	background-color: var(--emma-msg-bot);
	border-radius: 12px;
	border-bottom-left-radius: 4px;
	width: fit-content;
}

.emma-ia-typing span {
	width: 6px;
	height: 6px;
	background-color: #aaa;
	border-radius: 50%;
	animation: emma-bounce 1.4s infinite ease-in-out both;
}

.emma-ia-typing span:nth-child(1) { animation-delay: -0.32s; }
.emma-ia-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes emma-bounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* Input Area */
.emma-ia-chat-input-area {
	padding: 15px;
	background-color: white;
	border-top: 1px solid var(--emma-border);
}

#emma-ia-chat-form {
	display: flex;
	align-items: center;
	background-color: #ffffff;
	border: 1px solid var(--emma-border);
	border-radius: 8px;
	padding: 8px 8px 8px 15px;
}

#emma-ia-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 10px 0;
	font-size: 14px;
	color: var(--emma-text-main);
	outline: none;
}

#emma-ia-input::placeholder {
	color: #999;
}

#emma-ia-send-btn {
	background-color: var(--emma-primary);
	color: white;
	border: none;
	border-radius: 6px;
	padding: 10px 20px;
	font-weight: 600;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.2s;
}

#emma-ia-send-btn:hover {
	background-color: var(--emma-primary-hover);
}

/* Responsive */
@media (max-width: 480px) {
	.emma-ia-chat-window {
		width: calc(100vw - 40px);
		bottom: 90px;
	}
}
