/**
 * Chat IA – InfoPeñíscola · estilos del widget.
 * Todo va bajo .ipx-chat-* para no colisionar con el tema.
 */

:root {
	--ipx-color: #0f766e;
	--ipx-panel-bg: #ffffff;
	--ipx-text: #1f2937;
	--ipx-muted: #6b7280;
	--ipx-border: #e5e7eb;
	--ipx-radius: 16px;
}

/* Nota: NO hay modo oscuro automático. Si el visitante ve el chat oscuro es
   porque el administrador eligió el estilo «Oscuro» en Apariencia. */

.ipx-chat-root {
	position: fixed;
	bottom: 20px;
	/* Por encima de cabeceras sticky de temas (usamos el máximo práctico). */
	z-index: 2147483000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	display: flex;
	align-items: center;
	gap: 10px;
}
/* Panel fuera del flujo; la fila es burbuja + etiqueta. */
.ipx-chat-root.ipx-pos-right { right: 20px; flex-direction: row-reverse; }
.ipx-chat-root.ipx-pos-left  { left: 20px; flex-direction: row; }

/* Texto junto a la burbuja */
.ipx-bubble-label {
	/* Color configurable desde el admin (por defecto blanco). */
	background: var(--ipx-label-bg, #fff);
	color: #1f2937;
	border: 1px solid #e5e7eb;
	border-radius: 999px;
	padding: 8px 10px 8px 14px;
	font-size: 13.5px;
	line-height: 1.2;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
	cursor: pointer;
	user-select: none;
	max-width: 40vw;
	display: flex;
	align-items: center;
	gap: 6px;
	transition: transform 0.15s ease;
	/* Subido bastante más que la burbuja. */
	margin-bottom: 30px;
}
.ipx-bubble-label:hover { transform: translateY(-2px); }
/* Sacudida periódica para llamar la atención (intervalo desde el admin). */
@keyframes ipx-label-shake {
	0%, 100% { transform: translateX(0); }
	15% { transform: translateX(-4px) rotate(-2deg); }
	30% { transform: translateX(4px) rotate(2deg); }
	45% { transform: translateX(-3px) rotate(-1deg); }
	60% { transform: translateX(3px) rotate(1deg); }
	80% { transform: translateX(-2px); }
}
.ipx-bubble-label.ipx-shake { animation: ipx-label-shake 0.7s ease; }
.ipx-bubble-label[hidden] { display: none !important; }
.ipx-bubble-label-text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}
.ipx-bubble-label-close {
	background: transparent;
	border: none;
	color: inherit;
	opacity: 0.55;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
	border-radius: 50%;
	flex-shrink: 0;
	font-family: inherit;
}
.ipx-bubble-label-close:hover { opacity: 1; }
.ipx-style-dark .ipx-bubble-label {
	background: var(--ipx-label-bg, #111827);
	color: #f3f4f6;
	border-color: #374151;
}

/* Burbuja flotante */
.ipx-chat-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: var(--ipx-color);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	padding: 0;
	overflow: hidden;
}
.ipx-chat-bubble:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.ipx-chat-bubble img {
	width: 70%;
	height: 70%;
	object-fit: contain;
	border-radius: 50%;
}
.ipx-chat-bubble:focus-visible {
	outline: 3px solid var(--ipx-color);
	outline-offset: 3px;
}
/* Punto de "vida" */
.ipx-chat-bubble::after {
	content: "";
	position: absolute;
	top: 2px;
	right: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid #fff;
}
.ipx-chat-bubble { position: relative; }

/* Panel */
.ipx-chat-panel {
	position: absolute;
	bottom: 76px;
	width: min(380px, calc(100vw - 32px));
	height: min(600px, calc(100vh - 120px));
	background: var(--ipx-panel-bg);
	color: var(--ipx-text);
	border-radius: var(--ipx-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
	border: 1px solid var(--ipx-border);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}
.ipx-chat-root.ipx-pos-right .ipx-chat-panel { right: 0; }
.ipx-chat-root.ipx-pos-left  .ipx-chat-panel { left: 0; }
.ipx-chat-panel.ipx-open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* Cabecera */
/* Aviso "Irta está siendo entrenada": en ROJO para que se vea bien */
.ipx-chat-notice {
	padding: 9px 14px;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.45;
	text-align: center;
	color: #b91c1c;
	background: #fef2f2;
	border-bottom: 2px solid #fca5a5;
	flex-shrink: 0;
}
.ipx-style-dark .ipx-chat-notice {
	color: #fca5a5;
	background: #450a0a;
	border-bottom-color: #7f1d1d;
}
.ipx-chat-header {
	background: var(--ipx-color);
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}
.ipx-chat-header img {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
}
.ipx-chat-title {
	font-weight: 600;
	font-size: 15px;
	flex: 1;
}
.ipx-chat-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
}
.ipx-chat-close:hover { background: rgba(255, 255, 255, 0.15); }

/* Mensajes */
.ipx-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}
.ipx-msg {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: break-word;
	white-space: normal;
}
.ipx-msg-user {
	align-self: flex-end;
	background: var(--ipx-color);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.ipx-msg-bot {
	align-self: flex-start;
	background: var(--ipx-panel-bg);
	border: 1px solid var(--ipx-border);
	border-bottom-left-radius: 4px;
}
.ipx-msg-bot p { margin: 0 0 8px; }
.ipx-msg-bot p:last-child { margin-bottom: 0; }
.ipx-msg-bot ul { margin: 4px 0 8px; padding-left: 18px; }
.ipx-msg-bot a { color: inherit; text-decoration: underline; }
.ipx-msg-error {
	align-self: stretch;
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
	font-size: 13px;
}

/* Valoración 👍/👎 de cada respuesta del bot */
.ipx-msg-rate {
	display: flex;
	gap: 4px;
	margin-top: 8px;
}
.ipx-msg-bot p:last-child + .ipx-msg-rate { margin-top: 2px; }
.ipx-vote {
	background: transparent;
	border: 1px solid var(--ipx-border);
	border-radius: 8px;
	padding: 2px 8px;
	font-size: 13px;
	line-height: 1.4;
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ipx-vote:hover {
	opacity: 1;
	border-color: var(--ipx-color);
}
.ipx-vote:focus-visible {
	outline: 2px solid var(--ipx-color);
	outline-offset: 1px;
}
.ipx-vote-on {
	opacity: 1;
	border-color: var(--ipx-color);
	background: rgba(15, 118, 110, 0.1);
}
.ipx-vote-thanks {
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--ipx-muted);
	margin-left: 3px;
	align-self: center;
}
.ipx-style-dark .ipx-vote { border-color: var(--ipx-border); }
.ipx-style-dark .ipx-vote-on { background: rgba(255, 255, 255, 0.12); }

/* Enlace «Ayúdanos a mejorar» en la línea del pie */
.ipx-chat-help-link {
	background: none;
	color: inherit;
	border: none;
	padding: 0;
	margin: 0;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.ipx-chat-help-link:hover { color: var(--ipx-color); }
.ipx-chat-help-link:focus-visible {
	outline: 2px solid var(--ipx-color);
	outline-offset: 1px;
	border-radius: 3px;
}

/* Cuerpo del formulario de sugerencia */
.ipx-sug-body {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.ipx-sug-intro {
	margin: 0;
	font-size: 13px;
	line-height: 1.55;
	color: var(--ipx-muted);
}
.ipx-sug-text {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid var(--ipx-border);
	border-radius: 10px;
	padding: 10px;
	font: inherit;
	background: var(--ipx-panel-bg);
	color: var(--ipx-text);
	resize: vertical;
	min-height: 90px;
}
.ipx-sug-text:focus {
	outline: none;
	border-color: var(--ipx-color);
}
.ipx-sug-send {
	background: var(--ipx-color);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 9px 14px;
	font-weight: 600;
	font-size: 13.5px;
	cursor: pointer;
	align-self: flex-start;
}
.ipx-sug-send:hover { filter: brightness(1.08); }
.ipx-sug-send:disabled { opacity: 0.5; cursor: default; }
.ipx-sug-status {
	font-size: 12.5px;
	line-height: 1.5;
}
.ipx-sug-ok { color: #0f766e; }
.ipx-sug-err { color: #b91c1c; }
.ipx-style-dark .ipx-sug-ok { color: #34d399; }
.ipx-style-dark .ipx-sug-err { color: #f87171; }

/* Avatar del bot */
.ipx-msg-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.ipx-msg-row .ipx-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

/* Indicador de escritura */
.ipx-typing {
	align-self: flex-start;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 14px;
	background: var(--ipx-panel-bg);
	border: 1px solid var(--ipx-border);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	max-width: 100%;
	box-sizing: border-box;
}
.ipx-typing-dots {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}
.ipx-typing-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ipx-muted);
	animation: ipx-bounce 1.2s infinite;
}
.ipx-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ipx-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.ipx-typing-text {
	margin-left: 9px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--ipx-muted);
}
@keyframes ipx-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Sugerencias */
.ipx-chat-suggestions {
	padding: 0 14px 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex-shrink: 0;
}
.ipx-chat-suggestions:empty { display: none; }
.ipx-chip-title {
	width: 100%;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ipx-muted, #6b7280);
	margin: 2px 0 2px;
}
.ipx-chip {
	background: transparent;
	border: 1px solid var(--ipx-color);
	color: var(--ipx-color);
	border-radius: 999px;
	padding: 5px 11px;
	font-size: 12.5px;
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease;
	font-family: inherit;
}
.ipx-chip:hover {
	background: var(--ipx-color);
	color: #fff;
}

/* Toolbar: valoración + acciones (PDF / borrar) */
.ipx-chat-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 7px 12px;
	border-top: 1px solid var(--ipx-border);
	flex-shrink: 0;
	background: var(--ipx-panel-bg);
}
.ipx-chat-toolbar[hidden] { display: none !important; }
.ipx-chat-rating {
	display: flex;
	align-items: center;
	gap: 1px;
}
.ipx-rating-label {
	font-size: 11.5px;
	color: var(--ipx-muted);
	margin-right: 5px;
	white-space: nowrap;
}
.ipx-star {
	background: none;
	border: none;
	padding: 0 1px;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	color: #d1d5db;
	transition: color 0.12s ease, transform 0.12s ease;
	font-family: inherit;
}
.ipx-star:hover { color: #f59e0b; transform: scale(1.15); }
.ipx-star-on { color: #f59e0b; }
.ipx-chat-actions {
	display: flex;
	gap: 6px;
}
.ipx-chat-action {
	background: transparent;
	border: 1px solid var(--ipx-border);
	color: var(--ipx-text);
	border-radius: 999px;
	padding: 4px 9px;
	font-size: 11.5px;
	line-height: 1.2;
	cursor: pointer;
	font-family: inherit;
	transition: border-color 0.12s ease, color 0.12s ease;
	white-space: nowrap;
}
.ipx-chat-action:hover {
	border-color: var(--ipx-color);
	color: var(--ipx-color);
}

/* Entrada */
.ipx-chat-inputrow {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--ipx-border);
	flex-shrink: 0;
	background: var(--ipx-panel-bg);
}
.ipx-chat-inputrow input {
	flex: 1;
	border: 1px solid var(--ipx-border);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	background: var(--ipx-panel-bg);
	color: var(--ipx-text);
	min-width: 0;
}
.ipx-chat-inputrow input:focus {
	outline: 2px solid var(--ipx-color);
	outline-offset: -2px;
	border-color: transparent;
}
.ipx-chat-inputrow button {
	background: var(--ipx-color);
	color: #fff;
	border: none;
	border-radius: 10px;
	width: 42px;
	cursor: pointer;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.12s ease;
	flex-shrink: 0;
}
.ipx-chat-inputrow button:disabled { opacity: 0.5; cursor: default; }

/* Botón de detener la generación */
.ipx-chat-stop {
	background: transparent;
	border: 1px solid var(--ipx-border);
	color: var(--ipx-text);
	border-radius: 10px;
	width: 42px;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: border-color 0.12s ease, color 0.12s ease;
}
.ipx-chat-stop:hover { border-color: #b91c1c; color: #b91c1c; }
.ipx-chat-stop[hidden] { display: none !important; }

/* Ventana independiente del chat (?ipx_chat=1) */
.ipx-chat-root.ipx-standalone .ipx-chat-bubble,
.ipx-chat-root.ipx-standalone .ipx-bubble-label { display: none; }
.ipx-standalone-page { background: transparent; }

/* Pie */
.ipx-chat-footer {
	font-size: 11px;
	color: var(--ipx-muted);
	text-align: center;
	padding: 4px 10px 8px;
	flex-shrink: 0;
	background: var(--ipx-panel-bg);
}
.ipx-chat-footer a { color: inherit; }

/* ------------------------------------------------------------------ */
/* Estilos (pestaña Apariencia)                                       */
/* ------------------------------------------------------------------ */

/* Oscuro: panel siempre en negro, independientemente del tema del sistema */
.ipx-style-dark {
	--ipx-panel-bg: #111827;
	--ipx-text: #f3f4f6;
	--ipx-muted: #9ca3af;
	--ipx-border: #374151;
}
.ipx-style-dark .ipx-chat-header { background: #0b1220; border-bottom: 1px solid #1f2937; }
.ipx-style-dark .ipx-msg-bot,
.ipx-style-dark .ipx-typing,
.ipx-style-dark .ipx-chat-inputrow,
.ipx-style-dark .ipx-chat-footer,
.ipx-style-dark .ipx-chat-toolbar { background: #0b1220; }
.ipx-style-dark .ipx-chat-inputrow input {
	background: #0b1220;
	color: #f3f4f6;
}
.ipx-style-dark .ipx-chat-bubble {
	background: #111827;
	border: 2px solid var(--ipx-color);
	color: #f3f4f6;
}
.ipx-style-dark .ipx-chat-bubble::after { border-color: #111827; }
.ipx-style-dark .ipx-star { color: #4b5563; }
.ipx-style-dark .ipx-chat-action { color: #f3f4f6; border-color: #374151; }
.ipx-style-dark .ipx-chat-action:hover { color: var(--ipx-color); border-color: var(--ipx-color); }
.ipx-style-dark .ipx-bubble-label {
	background: #111827;
	color: #f3f4f6;
	border-color: #374151;
}

/* Minimalista: líneas finas, burbuja blanca con borde de color, sin sombras fuertes */
.ipx-style-minimal .ipx-chat-bubble {
	background: #fff;
	color: var(--ipx-color);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	border: 2px solid var(--ipx-color);
}
.ipx-style-minimal .ipx-chat-bubble::after { display: none; }
.ipx-style-minimal .ipx-chat-panel {
	border-radius: 10px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.ipx-style-minimal .ipx-chat-header {
	background: transparent;
	color: var(--ipx-text);
	border-bottom: 1px solid var(--ipx-border);
}
.ipx-style-minimal .ipx-chat-close { color: var(--ipx-text); }
.ipx-style-minimal .ipx-chat-close:hover { background: rgba(0, 0, 0, 0.06); }
.ipx-style-minimal .ipx-msg-bot { background: #fff; }
.ipx-style-minimal .ipx-chip { border-color: var(--ipx-border); color: var(--ipx-muted); }
.ipx-style-minimal .ipx-chip:hover {
	background: transparent;
	border-color: var(--ipx-color);
	color: var(--ipx-color);
}

/* Clásico: esquinas rectas, cabecera azul marino */
.ipx-style-classic .ipx-chat-bubble {
	border-radius: 10px;
	width: 58px;
	height: 58px;
	background: #2c3e50;
}
.ipx-style-classic .ipx-chat-panel { border-radius: 4px; }
.ipx-style-classic .ipx-chat-header { background: #2c3e50; border-bottom: 3px solid rgba(0, 0, 0, 0.1); }
.ipx-style-classic .ipx-msg { border-radius: 6px; }
.ipx-style-classic .ipx-chat-inputrow input { border-radius: 4px; }
.ipx-style-classic .ipx-chat-inputrow button { border-radius: 4px; }
.ipx-style-classic .ipx-chat-close { border-radius: 4px; }

/* Personalizado: base neutra igual que moderno, pensado para ajustes manuales vía CSS */

/* Móvil: casi pantalla completa, siempre por encima de la cabecera del tema */
@media (max-width: 480px) {
	.ipx-chat-root { bottom: 14px; }
	.ipx-chat-root.ipx-pos-right { right: 14px; }
	.ipx-chat-root.ipx-pos-left { left: 14px; }
	.ipx-chat-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 110px);
		bottom: 72px;
	}
	/* Abierto: cubre casi toda la pantalla, por encima de cabeceras y barras sticky. */
	.ipx-chat-panel.ipx-open {
		position: fixed;
		left: 50%;
		right: auto;
		bottom: 12px;
		width: calc(100vw - 24px);
		height: calc(100dvh - 90px);
		transform: translateX(-50%);
		z-index: 2147483000;
	}
	.ipx-chat-bubble { width: 54px; height: 54px; font-size: 23px; }
}

/* ------------------------------------------------------------------ */
/* Historial de conversaciones                                        */
/* ------------------------------------------------------------------ */
.ipx-hist-overlay {
	position: absolute;
	inset: 0;
	background: var(--ipx-panel-bg);
	z-index: 5;
	display: flex;
	flex-direction: column;
	border-radius: inherit;
	overflow: hidden;
}
.ipx-hist-overlay[hidden] { display: none !important; }
.ipx-hist-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-bottom: 1px solid var(--ipx-border);
	font-weight: 600;
	font-size: 14px;
	flex-shrink: 0;
}
.ipx-hist-head .ipx-chat-close { color: var(--ipx-text); }
/* El título ocupa el hueco; «Borrar todo» y la ✕ quedan a la derecha. */
.ipx-hist-head span { flex: 1; min-width: 0; }
.ipx-hist-list {
	flex: 1;
	overflow-y: auto;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.ipx-hist-item { display: flex; align-items: stretch; gap: 6px; }
.ipx-hist-open {
	flex: 1;
	min-width: 0;
	text-align: left;
	background: transparent;
	border: 1px solid var(--ipx-border);
	border-radius: 10px;
	padding: 8px 10px;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	color: var(--ipx-text);
	transition: border-color 0.12s ease;
}
.ipx-hist-open:hover { border-color: var(--ipx-color); }
.ipx-hist-open .t {
	display: block;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ipx-hist-open .d {
	display: block;
	font-size: 11px;
	color: var(--ipx-muted);
	margin-top: 2px;
}
.ipx-hist-del {
	background: transparent;
	border: 1px solid var(--ipx-border);
	border-radius: 10px;
	color: var(--ipx-muted);
	cursor: pointer;
	font-size: 14px;
	padding: 0 8px;
	transition: color 0.12s ease, border-color 0.12s ease;
}
.ipx-hist-del:hover { color: #b91c1c; border-color: #b91c1c; }
/* Botón "Borrar todo el historial" (cabecera del historial) */
.ipx-hist-clearall {
	background: transparent;
	border: 1px solid var(--ipx-border);
	border-radius: 999px;
	color: #b91c1c;
	cursor: pointer;
	font-family: inherit;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.2;
	padding: 4px 10px;
	margin-left: 10px;
	white-space: nowrap;
	transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
	flex-shrink: 0;
}
.ipx-hist-clearall:hover {
	background: #fef2f2;
	border-color: #b91c1c;
	color: #b91c1c;
}
.ipx-hist-clearall[hidden] { display: none !important; }
.ipx-style-dark .ipx-hist-clearall { border-color: #374151; color: #fca5a5; }
.ipx-style-dark .ipx-hist-clearall:hover { background: #450a0a; border-color: #fca5a5; }
.ipx-hist-empty {
	color: var(--ipx-muted);
	font-size: 13px;
	padding: 14px 10px;
	text-align: center;
}

/* ------------------------------------------------------------------ */
/* Ventana independiente (?ipx_chat=1): panel centrado y a casi        */
/* pantalla completa en CUALQUIER tamaño, sin heredar la posición      */
/* de la burbuja ni los márgenes del tema.                             */
/* ------------------------------------------------------------------ */
body.ipx-standalone-page {
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	background: #f1f5f9;
}
.ipx-chat-root.ipx-standalone {
	position: static;
	display: block;
	width: 100%;
	height: 100%;
}
.ipx-chat-root.ipx-standalone .ipx-chat-panel,
.ipx-chat-root.ipx-standalone .ipx-chat-panel.ipx-open {
	position: fixed !important;
	left: 50% !important;
	right: auto !important;
	top: 50% !important;
	bottom: auto !important;
	transform: translate(-50%, -50%) !important;
	width: min(460px, calc(100vw - 24px)) !important;
	height: min(700px, calc(100vh - 24px)) !important;
	height: min(700px, calc(100dvh - 24px)) !important;
	max-width: none !important;
	max-height: none !important;
	opacity: 1 !important;
	pointer-events: auto !important;
	z-index: 2147483000 !important;
	transition: none !important;
}
@media (max-width: 480px) {
	.ipx-chat-root.ipx-standalone .ipx-chat-panel,
	.ipx-chat-root.ipx-standalone .ipx-chat-panel.ipx-open {
		width: calc(100vw - 12px) !important;
		height: calc(100vh - 12px) !important;
		height: calc(100dvh - 12px) !important;
		border-radius: 12px;
	}
}