/* Prometheus AI Chat — front-end widget
 *
 * Every rule is scoped to #ppc-root (ID specificity) on purpose. Page-builder
 * themes ship global button/link styling like `.elementor-kit-9 button {...}`,
 * which outranks a plain class selector and repaints the widget in the theme's
 * button color. An ID beats any stack of classes, so the widget looks the same
 * on every site. The reset block below neutralises inherited typography and
 * decoration before the real styles are applied.
 */

#ppc-root {
	--ppc-accent: #0874B3;
	--ppc-accent-dark: #065a8c;
	--ppc-ink: #101418;
	--ppc-muted: #69727d;
	--ppc-line: #e3e7ec;
	--ppc-bot-bg: #f2f5f8;
	--ppc-radius: 16px;
	--ppc-shadow: 0 18px 48px rgba(16, 20, 24, 0.22);
	position: fixed;
	z-index: 99998;
	bottom: 20px;
	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	color: var(--ppc-ink);
}

#ppc-root.ppc-right { right: 20px; }
#ppc-root.ppc-left { left: 20px; }

#ppc-root *,
#ppc-root *::before,
#ppc-root *::after { box-sizing: border-box; }

/* ---------- Theme armor ---------- */

#ppc-root button,
#ppc-root a,
#ppc-root input,
#ppc-root textarea,
#ppc-root div,
#ppc-root span {
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	white-space: normal;
	box-shadow: none;
	margin: 0;
	min-width: 0;
	min-height: 0;
	max-width: 100%;
	text-decoration: none;
	text-shadow: none;
	float: none;
	transform: none;
}

#ppc-root button,
#ppc-root input,
#ppc-root textarea {
	appearance: none;
	-webkit-appearance: none;
	background-image: none;
	outline-offset: 2px;
}

#ppc-root a { color: inherit; }
#ppc-root a:hover { color: inherit; }

/* ---------- Launcher ---------- */

#ppc-root .ppc-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	width: auto;
	height: auto;
	padding: 13px 20px 13px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--ppc-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: 0 10px 26px rgba(8, 116, 179, 0.34);
	transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}

#ppc-root .ppc-launcher:hover {
	background: var(--ppc-accent-dark);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 14px 32px rgba(8, 116, 179, 0.4);
}

#ppc-root .ppc-launcher:focus-visible {
	outline: 3px solid var(--ppc-ink);
	outline-offset: 2px;
}

#ppc-root .ppc-launcher svg { width: 22px; height: 22px; flex: none; }
#ppc-root .ppc-launcher span { color: #fff; font-weight: 600; }

#ppc-root.ppc-open .ppc-launcher { display: none; }

/* ---------- Panel ---------- */

#ppc-root .ppc-panel {
	display: none;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border: 0;
	border-radius: var(--ppc-radius);
	box-shadow: var(--ppc-shadow);
	overflow: hidden;
}

#ppc-root.ppc-open .ppc-panel {
	display: flex;
	animation: ppc-rise .18s ease-out;
}

@keyframes ppc-rise {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	#ppc-root.ppc-open .ppc-panel { animation: none; }
	#ppc-root .ppc-launcher { transition: none; }
}

/* ---------- Header ---------- */

#ppc-root .ppc-head {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 15px 14px 15px 18px;
	background: var(--ppc-accent);
	color: #fff;
	flex: none;
}

#ppc-root .ppc-avatar {
	width: 36px;
	height: 36px;
	flex: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 15px;
	color: #fff;
}

#ppc-root .ppc-head-text { flex: 1; min-width: 0; }
#ppc-root .ppc-head-name { font-weight: 600; font-size: 15px; color: #fff; }
#ppc-root .ppc-head-sub { font-size: 12px; opacity: .85; color: #fff; }

#ppc-root .ppc-close {
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	padding: 6px;
	width: auto;
	height: auto;
	border-radius: 8px;
	line-height: 0;
	flex: none;
}

#ppc-root .ppc-close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
#ppc-root .ppc-close:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
#ppc-root .ppc-close svg { width: 18px; height: 18px; }

/* ---------- Log ---------- */

#ppc-root .ppc-log {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fff;
}

#ppc-root .ppc-msg {
	max-width: 86%;
	padding: 10px 14px;
	border: 0;
	border-radius: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-size: 15px;
	line-height: 1.5;
}

#ppc-root .ppc-bot {
	align-self: flex-start;
	background: var(--ppc-bot-bg);
	color: var(--ppc-ink);
	border-bottom-left-radius: 4px;
}

#ppc-root .ppc-user {
	align-self: flex-end;
	background: var(--ppc-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

#ppc-root .ppc-msg a { text-decoration: underline; }
#ppc-root .ppc-bot a { color: var(--ppc-accent); }
#ppc-root .ppc-user a { color: #fff; }

#ppc-root .ppc-note {
	align-self: center;
	max-width: 100%;
	font-size: 12.5px;
	color: var(--ppc-muted);
	text-align: center;
	background: none;
	padding: 4px 8px;
}

/* ---------- Typing ---------- */

#ppc-root .ppc-typing { display: flex; gap: 4px; align-items: center; padding: 14px; }

#ppc-root .ppc-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9aa5b1;
	animation: ppc-blink 1.3s infinite ease-in-out;
}

#ppc-root .ppc-typing span:nth-child(2) { animation-delay: .18s; }
#ppc-root .ppc-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes ppc-blink {
	0%, 80%, 100% { opacity: .3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
	#ppc-root .ppc-typing span { animation: none; opacity: .6; }
}

/* ---------- Suggestions ---------- */

#ppc-root .ppc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 4px 16px 12px;
	flex: none;
}

#ppc-root .ppc-chip {
	display: inline-block;
	width: auto;
	max-width: 100%;
	border: 1px solid var(--ppc-line);
	background: #fff;
	color: var(--ppc-accent);
	border-radius: 999px;
	padding: 7px 13px;
	font-size: 13.5px;
	font-weight: 400;
	line-height: 1.35;
	white-space: normal;
	cursor: pointer;
	text-align: left;
}

#ppc-root .ppc-chip:hover {
	border-color: var(--ppc-accent);
	background: #f5fafd;
	color: var(--ppc-accent);
}

#ppc-root .ppc-chip:focus-visible { outline: 2px solid var(--ppc-accent); outline-offset: 1px; }

/* ---------- Composer ---------- */

#ppc-root .ppc-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--ppc-line);
	background: #fff;
	flex: none;
}

#ppc-root .ppc-input {
	flex: 1;
	display: block;
	resize: none;
	border: 1px solid var(--ppc-line);
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 15px;
	line-height: 1.4;
	height: auto;
	max-height: 110px;
	color: var(--ppc-ink);
	background: #fff;
}

#ppc-root .ppc-input:focus {
	outline: 2px solid var(--ppc-accent);
	outline-offset: -1px;
	border-color: transparent;
	background: #fff;
	color: var(--ppc-ink);
}

#ppc-root .ppc-send {
	flex: none;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: var(--ppc-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
}

#ppc-root .ppc-send:disabled { opacity: .45; cursor: default; }
#ppc-root .ppc-send:not(:disabled):hover { background: var(--ppc-accent-dark); color: #fff; }
#ppc-root .ppc-send:focus-visible { outline: 2px solid var(--ppc-ink); outline-offset: 2px; }
#ppc-root .ppc-send svg { width: 19px; height: 19px; }

#ppc-root .ppc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

#ppc-root .ppc-foot {
	padding: 0 14px 10px;
	font-size: 11.5px;
	color: var(--ppc-muted);
	text-align: center;
	background: #fff;
	flex: none;
}

/* ---------- Theme override armor ----------
 *
 * Page-builder themes routinely ship `!important` on global button and link
 * colors (this site's Elementor kit paints every button #CC3366 that way), and
 * an ID selector still loses to `!important`. So the handful of properties a
 * theme typically claims are re-declared here with `!important`, gathered in
 * one block to keep the rules above readable. Colors come from the same custom
 * properties, so the admin's accent picker still drives everything.
 */

#ppc-root .ppc-panel {
	background-color: #fff !important;
	border: 0 !important;
	border-radius: var(--ppc-radius) !important;
}

#ppc-root .ppc-log,
#ppc-root .ppc-chips,
#ppc-root .ppc-form,
#ppc-root .ppc-foot { background-color: #fff !important; }

#ppc-root .ppc-launcher {
	background-color: var(--ppc-accent) !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 999px !important;
}

#ppc-root .ppc-launcher:hover { background-color: var(--ppc-accent-dark) !important; color: #fff !important; }
#ppc-root .ppc-launcher span { color: #fff !important; }

#ppc-root .ppc-head { background-color: var(--ppc-accent) !important; }

#ppc-root .ppc-head-name,
#ppc-root .ppc-head-sub,
#ppc-root .ppc-avatar,
#ppc-root .ppc-close { color: #fff !important; }

#ppc-root .ppc-close { background-color: transparent !important; border: 0 !important; }
#ppc-root .ppc-close:hover { background-color: rgba(255, 255, 255, 0.16) !important; }

#ppc-root .ppc-chip {
	color: var(--ppc-accent) !important;
	background-color: #fff !important;
	border: 1px solid var(--ppc-line) !important;
	border-radius: 999px !important;
	white-space: normal !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	width: auto !important;
	max-width: 100% !important;
}

#ppc-root .ppc-chip:hover {
	color: var(--ppc-accent) !important;
	background-color: #f5fafd !important;
	border-color: var(--ppc-accent) !important;
}

#ppc-root .ppc-bot { background-color: var(--ppc-bot-bg) !important; color: var(--ppc-ink) !important; }
#ppc-root .ppc-user { background-color: var(--ppc-accent) !important; color: #fff !important; }
#ppc-root .ppc-bot a { color: var(--ppc-accent) !important; }
#ppc-root .ppc-user a { color: #fff !important; }
#ppc-root .ppc-note { background-color: transparent !important; color: var(--ppc-muted) !important; }

#ppc-root .ppc-input {
	background-color: #fff !important;
	color: var(--ppc-ink) !important;
	border: 1px solid var(--ppc-line) !important;
	border-radius: 12px !important;
}

#ppc-root .ppc-send {
	background-color: var(--ppc-accent) !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 12px !important;
	width: 42px !important;
	height: 42px !important;
	padding: 0 !important;
}

#ppc-root .ppc-send:not(:disabled):hover { background-color: var(--ppc-accent-dark) !important; }

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
	#ppc-root { bottom: 14px; }
	#ppc-root.ppc-right { right: 14px; }
	#ppc-root.ppc-left { left: 14px; }

	#ppc-root.ppc-open {
		inset: 0;
		bottom: 0;
		right: 0;
		left: 0;
	}

	/* !important here so these beat the armor block above, which is equally
	   specific and would otherwise pin the desktop radius on mobile. */
	#ppc-root.ppc-open .ppc-panel {
		width: 100vw !important;
		max-width: 100vw !important;
		height: 100%;
		max-height: none;
		border-radius: 0 !important;
	}

	#ppc-root .ppc-launcher span { display: none; }
	#ppc-root .ppc-launcher { padding: 15px; }
}
