/* vc-chat-widget.css — floating chat widget for virtual-context.com */

:root {
	--vcw-bg: #0c0f14;
	--vcw-header: #12161e;
	--vcw-input-bg: #12161e;
	--vcw-input-border: #1e2636;
	--vcw-accent: #2ba8e0;
	--vcw-accent-hover: #239fd4;
	--vcw-user-msg: #2ba8e0;
	--vcw-assistant-msg: #171c26;
	--vcw-text: #dce4f0;
	--vcw-text-muted: #8a95aa;
	--vcw-code-bg: #0a0d12;
	--vcw-radius-panel: 12px;
	--vcw-radius-msg: 16px;
	--vcw-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Floating button ── */
#vc-chat-btn {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--vcw-accent);
	border: none;
	cursor: pointer;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(43, 168, 224, 0.35);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#vc-chat-btn:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 24px rgba(43, 168, 224, 0.5);
}

#vc-chat-btn svg {
	width: 26px;
	height: 26px;
	fill: #fff;
}

/* Hide button when panel is open */
#vc-chat-btn.vc-chat-hidden {
	display: none;
}

/* ── Chat panel ── */
#vc-chat-panel {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 380px;
	height: 520px;
	background: var(--vcw-bg);
	border-radius: var(--vcw-radius-panel);
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
	z-index: 9998;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: var(--vcw-font);
	opacity: 0;
	transform: translateY(20px);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

#vc-chat-panel.vc-chat-open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* ── Header ── */
.vc-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--vcw-header);
	border-bottom: 1px solid var(--vcw-input-border);
	flex-shrink: 0;
}

.vc-chat-header-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--vcw-text);
	letter-spacing: 0.02em;
}

.vc-chat-close {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--vcw-text-muted);
	padding: 4px;
	line-height: 1;
	font-size: 18px;
	border-radius: 4px;
	transition: color 0.15s ease, background 0.15s ease;
}

.vc-chat-close:hover {
	color: var(--vcw-text);
	background: rgba(255, 255, 255, 0.06);
}

/* ── Messages area ── */
.vc-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.vc-chat-messages::-webkit-scrollbar {
	width: 5px;
}

.vc-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}

.vc-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.12);
	border-radius: 4px;
}

/* Message bubbles */
.vc-chat-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: var(--vcw-radius-msg);
	font-size: 13.5px;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.vc-chat-msg-user {
	align-self: flex-end;
	background: var(--vcw-user-msg);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.vc-chat-msg-assistant {
	align-self: flex-start;
	background: var(--vcw-assistant-msg);
	color: var(--vcw-text);
	border-bottom-left-radius: 4px;
}

/* Markdown inside messages */
.vc-chat-msg p {
	margin: 0 0 8px 0;
}

.vc-chat-msg p:last-child {
	margin-bottom: 0;
}

.vc-chat-msg strong {
	font-weight: 600;
}

.vc-chat-msg em {
	font-style: italic;
}

.vc-chat-msg code {
	font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
	font-size: 12px;
	background: var(--vcw-code-bg);
	padding: 2px 5px;
	border-radius: 4px;
}

.vc-chat-msg-user code {
	background: rgba(0, 0, 0, 0.18);
}

.vc-chat-msg pre {
	margin: 8px 0;
	padding: 10px 12px;
	background: var(--vcw-code-bg);
	border-radius: 6px;
	overflow-x: auto;
	font-size: 12px;
	line-height: 1.5;
}

.vc-chat-msg pre code {
	background: none;
	padding: 0;
	font-size: inherit;
}

.vc-chat-msg-user pre {
	background: rgba(0, 0, 0, 0.18);
}

.vc-chat-msg a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.vc-chat-msg-assistant a {
	color: var(--vcw-accent);
}

.vc-chat-msg ul,
.vc-chat-msg ol {
	margin: 4px 0;
	padding-left: 20px;
}

.vc-chat-msg li {
	margin-bottom: 2px;
}

/* Typing indicator */
.vc-chat-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 12px 16px;
	background: var(--vcw-assistant-msg);
	border-radius: var(--vcw-radius-msg);
	border-bottom-left-radius: 4px;
}

.vc-chat-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--vcw-text-muted);
	animation: vcChatBounce 1.2s infinite ease-in-out;
}

.vc-chat-typing-dot:nth-child(2) {
	animation-delay: 0.15s;
}

.vc-chat-typing-dot:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes vcChatBounce {
	0%, 60%, 100% { transform: translateY(0); }
	30% { transform: translateY(-5px); }
}

/* ── Input area ── */
.vc-chat-input-area {
	display: flex;
	align-items: flex-end;
	padding: 12px;
	background: var(--vcw-input-bg);
	border-top: 1px solid var(--vcw-input-border);
	gap: 8px;
	flex-shrink: 0;
}

.vc-chat-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--vcw-input-border);
	background: var(--vcw-bg);
	color: var(--vcw-text);
	border-radius: 8px;
	padding: 10px 12px;
	font-family: var(--vcw-font);
	font-size: 13.5px;
	line-height: 1.4;
	max-height: 100px;
	overflow-y: auto;
	outline: none;
	transition: border-color 0.15s ease;
}

.vc-chat-input::placeholder {
	color: var(--vcw-text-muted);
}

.vc-chat-input:focus {
	border-color: var(--vcw-accent);
}

.vc-chat-send {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--vcw-accent);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s ease;
}

.vc-chat-send:hover {
	background: var(--vcw-accent-hover);
}

.vc-chat-send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.vc-chat-send svg {
	width: 16px;
	height: 16px;
	fill: #fff;
}

/* ── Error message ── */
.vc-chat-msg-error {
	align-self: center;
	background: rgba(220, 60, 60, 0.15);
	color: #e87070;
	font-size: 12.5px;
	padding: 8px 14px;
	border-radius: 8px;
	text-align: center;
}

/* ── Mobile responsive ── */
@media (max-width: 639px) {
	#vc-chat-panel {
		bottom: 0;
		right: 0;
		width: 100%;
		height: calc(100% - 24px);
		border-radius: var(--vcw-radius-panel) var(--vcw-radius-panel) 0 0;
	}

	#vc-chat-btn {
		bottom: 16px;
		right: 16px;
	}
}
