/* zentroStack Chat — AI chat widget */

#zentro-chat-root {
	--zentro-accent: #e85a2a;
	--zentro-dark: #1e293b;
	--zentro-bg: #ffffff;
	--zentro-panel-bg: #f8fafc;
	--zentro-text: #1f2937;
	--zentro-muted: #64748b;
	--zentro-border: #e2e8f0;
	--zentro-radius: 16px;
	--zentro-shadow: 0 18px 48px rgba(15, 23, 42, .22);

	position: fixed;
	bottom: 20px;
	z-index: 99998;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--zentro-text);
}

#zentro-chat-root[data-position="right"] { right: 20px; }
#zentro-chat-root[data-position="left"] { left: 20px; }

/* Themes style bare `button` and `svg` globally — neutralise that here so the
   widget looks the same on any theme. */
#zentro-chat-root,
#zentro-chat-root *,
#zentro-chat-root *::before,
#zentro-chat-root *::after {
	box-sizing: border-box;
}

/* Only properties the component rules below never set — an id selector here
   would otherwise outrank them. */
#zentro-chat-root button {
	margin: 0;
	min-width: 0;
	min-height: 0;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1.4;
}

#zentro-chat-root svg {
	display: block;
	flex: 0 0 auto;
	max-width: none;
	fill: none;
	stroke: currentColor;
}

/* ------------------------------------------------------------- launcher */

.zentro-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 13px 20px 13px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--zentro-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: var(--zentro-shadow);
	transition: transform .18s ease, box-shadow .18s ease;
}

.zentro-launcher:hover { transform: translateY(-2px); }
.zentro-launcher:focus-visible { outline: 3px solid var(--zentro-dark); outline-offset: 2px; }
.zentro-launcher-icon { display: inline-flex; }

#zentro-chat-root.is-open .zentro-launcher { display: none; }

/* ---------------------------------------------------------------- panel */

.zentro-panel {
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 110px);
	overflow: hidden;
	background: var(--zentro-bg);
	border: 1px solid var(--zentro-border);
	border-radius: var(--zentro-radius);
	box-shadow: var(--zentro-shadow);
	animation: zentro-in .18s ease-out;
}

.zentro-panel[hidden] { display: none; }

@keyframes zentro-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

.zentro-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--zentro-dark);
	color: #fff;
}

.zentro-head-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
}

.zentro-head-sub {
	margin: 2px 0 0;
	font-size: 12.5px;
	line-height: 1.3;
	color: rgba(255, 255, 255, .72);
}

.zentro-close {
	display: inline-flex;
	padding: 6px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	opacity: .8;
}

.zentro-close:hover { opacity: 1; background: rgba(255, 255, 255, .12); }

/* ------------------------------------------------------------ transcript */

.zentro-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: var(--zentro-panel-bg);
	overscroll-behavior: contain;
}

.zentro-msg { display: flex; margin-bottom: 10px; }
.zentro-msg--user { justify-content: flex-end; }

.zentro-bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	background: #fff;
	border: 1px solid var(--zentro-border);
	font-size: 14.5px;
	word-wrap: break-word;
}

.zentro-msg--user .zentro-bubble {
	background: var(--zentro-accent);
	border-color: var(--zentro-accent);
	color: #fff;
}

.zentro-bubble p { margin: 0 0 8px; }
.zentro-bubble p:last-child { margin-bottom: 0; }
.zentro-bubble ul { margin: 4px 0 4px 18px; padding: 0; }
.zentro-bubble li { margin: 2px 0; }
.zentro-bubble a { color: inherit; text-decoration: underline; }
.zentro-msg--assistant .zentro-bubble a { color: var(--zentro-accent); }

.zentro-typing .zentro-bubble {
	display: flex;
	gap: 4px;
	align-items: center;
	padding: 14px;
}

.zentro-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--zentro-muted);
	animation: zentro-blink 1.2s infinite ease-in-out;
}

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

@keyframes zentro-blink {
	0%, 60%, 100% { opacity: .25; }
	30% { opacity: 1; }
}

/* ----------------------------------------------------------------- chips */

.zentro-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px;
	background: var(--zentro-panel-bg);
}

.zentro-chips:empty { padding: 0; }

.zentro-chip {
	padding: 7px 12px;
	border: 1px solid var(--zentro-border);
	border-radius: 999px;
	background: #fff;
	color: var(--zentro-dark);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.zentro-chip:hover { border-color: var(--zentro-accent); color: var(--zentro-accent); }

/* --------------------------------------------------------------- composer */

.zentro-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 12px 8px;
	background: var(--zentro-panel-bg);
	border-top: 1px solid var(--zentro-border);
}

.zentro-input {
	flex: 1 1 auto;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid var(--zentro-border);
	border-radius: 12px;
	background: #fff;
	color: var(--zentro-text);
	font: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	resize: none;
}

.zentro-input:focus { outline: none; border-color: var(--zentro-accent); }

.zentro-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: var(--zentro-accent);
	color: #fff;
	cursor: pointer;
}

.zentro-send svg { width: 18px; height: 18px; }
.zentro-close svg { width: 20px; height: 20px; }
.zentro-launcher svg { width: 24px; height: 24px; }

.zentro-send[disabled] { opacity: .55; cursor: default; }

.zentro-foot {
	margin: 0;
	padding: 0 16px 12px;
	background: var(--zentro-panel-bg);
	color: var(--zentro-muted);
	font-size: 11.5px;
	text-align: center;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 480px) {
	#zentro-chat-root { bottom: 14px; }
	#zentro-chat-root[data-position="right"] { right: 14px; }
	#zentro-chat-root[data-position="left"] { left: 14px; }

	.zentro-panel {
		width: calc(100vw - 28px);
		height: calc(100vh - 100px);
	}

	.zentro-launcher-label { display: none; }
	.zentro-launcher { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.zentro-panel, .zentro-launcher { animation: none; transition: none; }
}
