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

/* ── Botón flotante ─────────────────────────────────────────────────────── */

.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;
}

/* ── 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;
}

/* ── Ventana de chat ────────────────────────────────────────────────────── */

.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;
	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: 10px 12px;
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

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

/* ── Botones del header (reinicio y cierre) ─────────────────────────────── */

.ivpsm-chat-restart,
.ivpsm-chat-close {
	background: none;
	border: none;
	color: #fff;
	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-restart:hover,
.ivpsm-chat-close:hover {
	background-color: rgba(255, 255, 255, 0.22);
}

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

.ivpsm-chat-close {
	font-size: 22px;
	line-height: 1;
}

/* ── Contenedor principal del chat ──────────────────────────────────────── */

.ivpsm-chat-container {
	flex: 1;
	overflow: hidden;
	position: relative;
	/* REQ 4: inercia de scroll nativa en iOS */
	-webkit-overflow-scrolling: touch;
}

.ivpsm-chat-container > *,
.ivpsm-webchat-mount {
	height: 100% !important;
}

/* REQ 4: asegurar scroll fluido en el transcript de WebChat */
.ivpsm-chat-container .webchat__basic-transcript,
.ivpsm-chat-container [class*="basic-transcript"] {
	-webkit-overflow-scrolling: touch;
	overflow-y: auto;
}

/* ── Caja de texto multilinea (REQ 5) ───────────────────────────────────── */

.ivpsm-send-textarea {
	width: 100%;
	min-height: 60px;
	max-height: 180px;
	overflow-y: auto;
	resize: none;
	box-sizing: border-box;
	padding: 10px 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	border: none;
	outline: none;
	background: transparent;
	/* Inercia en iOS */
	-webkit-overflow-scrolling: touch;
}

.ivpsm-send-textarea:focus {
	outline: none;
}

/* ── Estados loading / error ────────────────────────────────────────────── */

.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;
}

/* ── Responsive – mobile (REQ 7) ────────────────────────────────────────── */
/* En pantallas < 768 px: 100 % de ancho y alto, sin bordes redondeados.    */

@media (max-width: 767px) {
	.ivpsm-chat-window {
		position: fixed !important;
		top: 0 !important;
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100% !important;
		height: 100% !important;
		max-height: 100% !important;
		border-radius: 0 !important;
		/* Sobreescribir el bottom inline del JS */
		margin: 0;
	}

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