/* JPPI Research Chatbot. Logical properties (inline-start/end) make RTL and LTR work from the dir attribute. */
.jppi-chat-panel {
	--jc-accent: #1f3c6e;
	--jc-bg: #fff;
	--jc-soft: #f2f4f8;
	--jc-text: #1d2330;
	--jc-muted: #5b6475;
	display: flex;
	flex-direction: column;
	background: var(--jc-bg);
	color: var(--jc-text);
	border: 1px solid #d6dbe4;
	border-radius: 12px;
	font-size: 15px;
	line-height: 1.55;
	max-height: 600px;
	min-height: 360px;
	overflow: hidden;
	box-sizing: border-box;
}
.jppi-chat-panel *, .jppi-chat-panel *::before, .jppi-chat-panel *::after { box-sizing: border-box; }
.jppi-chat-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: var(--jc-accent);
	color: #fff;
}
.jppi-chat-title { flex: 1; font-weight: 600; }
.jppi-chat-head button {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .5);
	color: #fff;
	border-radius: 6px;
	padding: 2px 8px;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
}
.jppi-chat-head .jppi-chat-close { border: 0; font-size: 22px; line-height: 1; padding: 0 4px; }
.jppi-chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.jppi-chat-msg { padding: 9px 12px; border-radius: 10px; max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; }
.jppi-chat-user { align-self: flex-end; background: var(--jc-accent); color: #fff; }
.jppi-chat-bot { align-self: flex-start; background: var(--jc-soft); }
.jppi-chat-wait { color: var(--jc-muted); font-style: italic; }
.jppi-chat-error { background: #fdecec; color: #8a1c1c; }
.jppi-chat-cite { font-size: .8em; vertical-align: super; text-decoration: none; margin-inline-start: 1px; }
.jppi-chat-warn { margin-top: 8px; padding: 6px 8px; background: #fff6dd; border-radius: 6px; font-size: 13px; }
.jppi-chat-sources { margin-top: 8px; font-size: 13px; white-space: normal; }
.jppi-chat-sources-title { font-weight: 600; color: var(--jc-muted); }
.jppi-chat-sources ol { margin: 4px 0 0; padding-inline-start: 22px; }
.jppi-chat-date { color: var(--jc-muted); }
.jppi-chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e3e7ee; }
.jppi-chat-form textarea {
	flex: 1;
	resize: none;
	border: 1px solid #c9cfda;
	border-radius: 8px;
	padding: 8px 10px;
	font: inherit;
	min-width: 0;
}
.jppi-chat-send {
	background: var(--jc-accent);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 0 16px;
	font: inherit;
	cursor: pointer;
}
.jppi-chat-send:disabled { opacity: .5; cursor: wait; }
.jppi-chat-foot { padding: 4px 12px 8px; font-size: 11px; color: var(--jc-muted); text-align: center; }
.jppi-chat-panel :focus-visible, .jppi-chat-fab:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }

/* embedded mode ([jppi_chat] shortcode) */
.jppi-chat-embed { max-width: 820px; margin: 0 auto 24px; }
.jppi-chat-embed .jppi-chat-panel { height: 72vh; max-height: 760px; }

/* floating mode */
.jppi-chat-floating { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 99990; }
.jppi-chat-floating .jppi-chat-panel {
	position: absolute;
	bottom: 70px;
	inset-inline-end: 0;
	width: 380px;
	height: 560px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
}
.jppi-chat-floating .jppi-chat-panel[hidden] { display: none; }
.jppi-chat-fab {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 0;
	background: #1f3c6e;
	color: #fff;
	font-size: 26px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
@media (max-width: 480px) {
	.jppi-chat-floating { bottom: 12px; inset-inline-end: 12px; }
	.jppi-chat-floating .jppi-chat-panel { position: fixed; inset: 8px 8px 80px 8px; width: auto; height: auto; max-height: none; }
}
@media (prefers-reduced-motion: no-preference) {
	.jppi-chat-fab { transition: transform .15s; }
	.jppi-chat-fab:hover { transform: scale(1.06); }
}
