/* ==========================================================================
   IVPSM Copilot Agents – Chat Widget Styles
   ========================================================================== */

/* ── Floating toggle button ─────────────────────────────────────────────── */

.ivpsm-chat-btn {
	position: fixed;
	right: 20px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background-color: #0078d4;
	color: #fff;
	border: none;
	cursor: pointer;
	z-index: 99999;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.30);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	padding: 0;
}

.ivpsm-chat-btn:hover {
	background-color: #005a9e;
	transform: scale(1.07);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.ivpsm-chat-btn:focus-visible {
	outline: 3px solid #ffb900;
	outline-offset: 3px;
}

.ivpsm-chat-btn.ivpsm-btn-active {
	background-color: #004578;
}

/* ── Chat window ────────────────────────────────────────────────────────── */

.ivpsm-chat-window {
	position: fixed;
	right: 20px;
	width: 380px;
	height: 520px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
	z-index: 99998;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	/* Entrance animation */
	animation: ivpsm-slide-up 0.2s ease;
}

@keyframes ivpsm-slide-up {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.ivpsm-hidden {
	display: none !important;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.ivpsm-chat-header {
	background-color: #0078d4;
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	gap: 8px;
}

.ivpsm-chat-title {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Close button ───────────────────────────────────────────────────────── */

.ivpsm-chat-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background-color 0.15s;
	flex-shrink: 0;
}

.ivpsm-chat-close:hover {
	background-color: rgba(255, 255, 255, 0.20);
}

.ivpsm-chat-close:focus-visible {
	outline: 2px solid #ffb900;
	outline-offset: 2px;
}

/* ── WebChat render target ──────────────────────────────────────────────── */

.ivpsm-chat-container {
	flex: 1;
	overflow: hidden;
	position: relative;
}

/* WebChat iframe / inner container needs full height */
.ivpsm-chat-container > * {
	height: 100% !important;
}

/* ── Loading & error states ─────────────────────────────────────────────── */

.ivpsm-loading,
.ivpsm-error {
	padding: 20px 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	margin: 0;
}

.ivpsm-loading {
	color: #555;
}

.ivpsm-error {
	color: #a4262c;
}

/* ── Widget Fondo LATAM – color corporativo #ee7623 ─────────────────────── */

#ivpsm-fondo-btn {
	background-color: #ee7623;
}

#ivpsm-fondo-btn:hover {
	background-color: #cc6319;
}

#ivpsm-fondo-btn.ivpsm-btn-active {
	background-color: #b5561a;
}

#ivpsm-fondo-window .ivpsm-chat-header {
	background-color: #ee7623;
}

/* ── Responsive: full-width on small screens ────────────────────────────── */

@media (max-width: 440px) {
	.ivpsm-chat-window {
		right: 0 !important;
		bottom: 0 !important;
		width: 100% !important;
		height: 80dvh !important;
		border-radius: 12px 12px 0 0;
	}

	.ivpsm-chat-btn {
		right: 12px;
	}
}
