/* RE:ecosystem chat widget - minimal, on-brand */
#ree-chat-root {
	--ree-chat-bg: #0a0a0a;
	--ree-chat-surface: #171717;
	--ree-chat-border: #262626;
	--ree-chat-text: #fafafa;
	--ree-chat-muted: #a3a3a3;
	--ree-chat-accent: #3b82f6;
	--ree-chat-accent-hover: #2563eb;
	--ree-chat-radius: 12px;
	--ree-chat-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
	font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	box-sizing: border-box;
}

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

#ree-chat-toggle {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--ree-chat-surface);
	border: 1px solid var(--ree-chat-border);
	color: var(--ree-chat-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--ree-chat-shadow);
	transition: transform 0.2s, box-shadow 0.2s;
	z-index: 9998;
}

#ree-chat-toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

#ree-chat-toggle svg {
	width: 24px;
	height: 24px;
}

#ree-chat-panel {
	position: fixed;
	bottom: 90px;
	right: 24px;
	width: 380px;
	max-width: calc(100vw - 48px);
	height: 520px;
	max-height: calc(100vh - 140px);
	background: var(--ree-chat-bg);
	border: 1px solid var(--ree-chat-border);
	border-radius: var(--ree-chat-radius);
	box-shadow: var(--ree-chat-shadow);
	display: flex;
	flex-direction: column;
	z-index: 9999;
	overflow: hidden;
}

#ree-chat-panel.ree-chat-hidden {
	display: none;
}

#ree-chat-header {
	padding: 14px 16px;
	border-bottom: 1px solid var(--ree-chat-border);
	background: var(--ree-chat-surface);
	font-weight: 600;
	color: var(--ree-chat-text);
}

#ree-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

#ree-chat-messages .ree-msg {
	max-width: 92%;
	align-self: flex-start;
	padding: 10px 14px;
	border-radius: var(--ree-chat-radius);
}

#ree-chat-messages .ree-msg.ree-user {
	align-self: flex-end;
	background: var(--ree-chat-accent);
	color: white;
}

#ree-chat-messages .ree-msg.ree-assistant {
	background: var(--ree-chat-surface);
	border: 1px solid var(--ree-chat-border);
	color: var(--ree-chat-text);
}

#ree-chat-messages .ree-msg .ree-answer-from-docs {
	display: block;
	font-size: 11px;
	color: var(--ree-chat-muted);
	margin-bottom: 6px;
}

#ree-chat-messages .ree-msg .ree-msg-body {
	white-space: pre-wrap;
	word-break: break-word;
}

#ree-chat-messages .ree-msg .ree-msg-body a {
	color: var(--ree-chat-accent);
	text-decoration: none;
}

#ree-chat-messages .ree-msg .ree-msg-body a:hover {
	text-decoration: underline;
}

#ree-chat-messages .ree-sources {
	margin-top: 8px;
	font-size: 12px;
	color: var(--ree-chat-muted);
}

#ree-chat-messages .ree-sources a {
	color: var(--ree-chat-accent);
	text-decoration: none;
	margin-right: 8px;
}

#ree-chat-messages .ree-sources a:hover {
	text-decoration: underline;
}

.ree-typing {
	display: flex;
	gap: 4px;
	padding: 10px 14px;
}

.ree-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ree-chat-muted);
	animation: ree-bounce 0.6s ease-in-out infinite;
}

.ree-typing span:nth-child(2) { animation-delay: 0.1s; }
.ree-typing span:nth-child(3) { animation-delay: 0.2s; }

@keyframes ree-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

#ree-chat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 16px 12px;
}

#ree-chat-chips button {
	padding: 6px 12px;
	border-radius: 9999px;
	border: 1px solid var(--ree-chat-border);
	background: var(--ree-chat-surface);
	color: var(--ree-chat-text);
	font-size: 12px;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

#ree-chat-chips button:hover {
	background: #262626;
	border-color: #404040;
}

#ree-chat-input-wrap {
	padding: 12px 16px 16px;
	border-top: 1px solid var(--ree-chat-border);
	background: var(--ree-chat-bg);
}

#ree-chat-input-row {
	display: flex;
	gap: 8px;
	align-items: flex-end;
}

#ree-chat-input {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	padding: 10px 14px;
	border-radius: var(--ree-chat-radius);
	border: 1px solid var(--ree-chat-border);
	background: var(--ree-chat-surface);
	color: var(--ree-chat-text);
	font: inherit;
	resize: none;
	transition: border-color 0.15s;
}

#ree-chat-input::placeholder {
	color: var(--ree-chat-muted);
}

#ree-chat-input:focus {
	outline: none;
	border-color: var(--ree-chat-accent);
}

#ree-chat-send {
	width: 40px;
	height: 40px;
	border-radius: var(--ree-chat-radius);
	border: none;
	background: var(--ree-chat-accent);
	color: white;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s;
}

#ree-chat-send:hover:not(:disabled) {
	background: var(--ree-chat-accent-hover);
}

#ree-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

#ree-chat-send svg {
	width: 18px;
	height: 18px;
}

#ree-chat-hint {
	font-size: 11px;
	color: var(--ree-chat-muted);
	margin-top: 6px;
}
