/* IAprovação - Floating Widget Styles */
:root {
	--ia-primary: #1e40af;
	--ia-accent: #3b82f6;
}

.ia-widget {
	position: fixed;
	bottom: 24px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.ia-widget--left {
	left: 24px;
}

.ia-widget--right {
	right: 24px;
}

/* Floating Trigger Button */
.ia-widget__trigger {
	position: relative;
	width: 64px;
	height: 64px;
	background: linear-gradient(135deg, var(--ia-primary) 0%, var(--ia-accent) 100%);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4);
	transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s, visibility 0.3s;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ia-widget__trigger.is-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: scale(0.8);
}

.ia-widget__trigger:not(.is-hidden):hover {
	transform: scale(1.08);
	box-shadow: 0 12px 40px rgba(59, 130, 246, 0.5);
}

.ia-widget__logo {
	width: 36px;
	height: 36px;
	object-fit: contain;
	filter: brightness(0) invert(1);
	flex-shrink: 0;
}

.ia-widget__pulse {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: var(--ia-accent);
	animation: ia-pulse 2s ease-out infinite;
	z-index: -1;
	pointer-events: none;
}

.ia-widget__trigger.is-hidden .ia-widget__pulse {
	animation: none;
}

@keyframes ia-pulse {
	0% {
		transform: scale(1);
		opacity: 0.5;
	}
	100% {
		transform: scale(1.6);
		opacity: 0;
	}
}

/* Chat Window */
.ia-widget__window {
	position: absolute;
	bottom: 80px;
	width: 380px;
	height: 520px;
	background: #0f172a;
	border-radius: 20px;
	box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: ia-slideUp 0.3s ease-out;
}

.ia-widget--left .ia-widget__window {
	left: 0;
}

.ia-widget--right .ia-widget__window {
	right: 0;
}

@keyframes ia-slideUp {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Window Header */
.ia-widget__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	background: linear-gradient(135deg, var(--ia-primary) 0%, var(--ia-accent) 100%);
	color: #fff;
}

.ia-widget__header-info {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.ia-widget__header-logo {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	padding: 8px;
	object-fit: contain;
	filter: brightness(0) invert(1);
}

.ia-widget__header-info strong {
	display: block;
	font-size: 1.1rem;
	font-weight: 600;
}

.ia-widget__header-info small {
	font-size: 0.85rem;
	opacity: 0.85;
	display: flex;
	align-items: center;
	gap: 4px;
}

.ia-widget__header-info small::before {
	content: '';
	width: 8px;
	height: 8px;
	background: #4ade80;
	border-radius: 50%;
}

.ia-widget__header-actions {
	display: flex;
	gap: 0.25rem;
}

.ia-widget__header-actions button {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	border-radius: 8px;
	color: #fff;
	width: 32px;
	height: 32px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.ia-widget__header-actions button:hover {
	background: rgba(255, 255, 255, 0.25);
}

/* Messages */
.ia-widget__messages {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	background: #0f172a;
}

.ia-widget__welcome {
	background: #1e293b;
	padding: 1rem;
	border-radius: 16px;
	color: #94a3b8;
	font-size: 1rem;
	line-height: 1.6;
}

.ia-widget__message {
	display: flex;
	gap: 0.5rem;
	max-width: 90%;
	animation: ia-fadeIn 0.25s ease-out;
}

@keyframes ia-fadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.ia-widget__message--user {
	flex-direction: row-reverse;
	margin-left: auto;
}

.ia-widget__message-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.7rem;
	font-weight: 600;
}

.ia-widget__message--assistant .ia-widget__message-avatar {
	background: linear-gradient(135deg, var(--ia-primary) 0%, var(--ia-accent) 100%);
}

.ia-widget__message--assistant .ia-widget__message-avatar img {
	width: 18px;
	height: 18px;
	filter: brightness(0) invert(1);
}

.ia-widget__message--user .ia-widget__message-avatar {
	background: #475569;
	color: #fff;
}

.ia-widget__message-content {
	background: #1e293b;
	padding: 0.75rem 1rem;
	border-radius: 16px;
	color: #e2e8f0;
	font-size: 1rem;
	line-height: 1.6;
}

.ia-widget__message--user .ia-widget__message-content {
	background: linear-gradient(135deg, var(--ia-primary) 0%, var(--ia-accent) 100%);
	color: #fff;
}

.ia-widget__message-content p {
	margin: 0 0 0.5rem;
}

.ia-widget__message-content p:last-child {
	margin-bottom: 0;
}

.ia-widget__message-content h1,
.ia-widget__message-content h2,
.ia-widget__message-content h3,
.ia-widget__message-content h4,
.ia-widget__message-content h5,
.ia-widget__message-content h6 {
	color: #fff !important;
	font-weight: 600;
	margin: 1rem 0 0.5rem;
	line-height: 1.4;
}

.ia-widget__message-content h1:first-child,
.ia-widget__message-content h2:first-child,
.ia-widget__message-content h3:first-child,
.ia-widget__message-content h4:first-child {
	margin-top: 0;
}

.ia-widget__message-content h1 { font-size: 1.25rem; }
.ia-widget__message-content h2 { font-size: 1.15rem; }
.ia-widget__message-content h3 { font-size: 1.05rem; }
.ia-widget__message-content h4 { font-size: 1rem; }

.ia-widget__message-content pre {
	background: #0f172a;
	padding: 0.75rem;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 0.8rem;
	margin: 0.5rem 0;
}

.ia-widget__message-content code {
	font-family: 'Fira Code', monospace;
}

.ia-widget__message-image {
	max-width: 200px;
	border-radius: 8px;
	margin-bottom: 0.5rem;
}

/* Typing */
.ia-widget__typing {
	display: flex;
	gap: 4px;
	padding: 0.25rem 0;
}

.ia-widget__typing span {
	width: 6px;
	height: 6px;
	background: var(--ia-accent);
	border-radius: 50%;
	animation: ia-typingBounce 1.2s infinite ease-in-out;
}

.ia-widget__typing span:nth-child(1) { animation-delay: 0s; }
.ia-widget__typing span:nth-child(2) { animation-delay: 0.15s; }
.ia-widget__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ia-typingBounce {
	0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
	40% { transform: scale(1); opacity: 1; }
}

/* Form */
.ia-widget__form {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	background: #1e293b;
	border-top: 1px solid #334155;
}

.ia-widget__upload {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: #334155;
	border-radius: 10px;
	color: #94a3b8;
	cursor: pointer;
	flex-shrink: 0;
	transition: all 0.2s;
}

.ia-widget__upload:hover {
	background: #475569;
	color: var(--ia-accent);
}

.ia-widget__image-preview {
	position: relative;
	max-width: 60px;
}

.ia-widget__image-preview img {
	width: 100%;
	border-radius: 6px;
}

.ia-widget__image-preview button {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 18px;
	height: 18px;
	background: #475569;
	border: none;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	font-size: 10px;
	line-height: 1;
}

.ia-widget__input {
	flex: 1;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 1rem;
	padding: 0.5rem 0;
}

.ia-widget__input:focus {
	outline: none;
}

.ia-widget__input::placeholder {
	color: #64748b;
}

.ia-widget__send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: linear-gradient(135deg, var(--ia-primary) 0%, var(--ia-accent) 100%);
	border: none;
	border-radius: 10px;
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
	transition: all 0.2s;
	padding: 0;
}

.ia-widget__send svg {
	width: 18px;
	height: 18px;
	display: block;
	margin: auto;
}

.ia-widget__send:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ia-widget__send:not(:disabled):hover {
	transform: scale(1.05);
}

/* Scrollbar */
.ia-widget__messages::-webkit-scrollbar {
	width: 4px;
}

.ia-widget__messages::-webkit-scrollbar-track {
	background: transparent;
}

.ia-widget__messages::-webkit-scrollbar-thumb {
	background: #334155;
	border-radius: 2px;
}

/* Mobile */
@media (max-width: 480px) {
	.ia-widget {
		bottom: 16px;
	}

	.ia-widget--left {
		left: 16px;
	}

	.ia-widget--right {
		right: 16px;
	}

	.ia-widget__window {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		border-radius: 0;
	}

	.ia-widget__trigger {
		width: 56px;
		height: 56px;
	}

	.ia-widget__logo {
		width: 32px;
		height: 32px;
	}
}

