/* Chat widget - dark theme (Cursor-like), retina-friendly */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
	--chat-bg: #0f172a;
	--chat-panel: #111827;
	--chat-panel-2: #0b1220;
	--chat-accent: #00f5d4;
	--chat-border: rgba(255,255,255,0.08);
	--chat-text: #e5e7eb;
	--chat-text-dim: #9ca3af;
	--chat-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.chat-fab {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 1000;
	display: flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
	border: 1px solid var(--chat-border);
	border-radius: 14px;
	padding: 10px 12px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.35);
	font-family: var(--chat-font);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

.chat-fab input {
	width: 220px;
	background: transparent;
	border: none;
	outline: none;
	color: var(--chat-text);
	font-size: 14px;
	font-family: var(--chat-font);
	font-weight: 400;
	letter-spacing: -0.01em;
}

.chat-fab button {
	background: var(--chat-accent);
	color: #05161a;
	border: none;
	border-radius: 10px;
	padding: 8px 12px;
	font-weight: 600;
	font-family: var(--chat-font);
	font-size: 14px;
	letter-spacing: -0.01em;
	cursor: pointer;
	transition: opacity 0.2s;
}
.chat-fab button:hover {
	opacity: 0.9;
}

/* Modal */
.chat-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(2,6,23,0.7);
	backdrop-filter: blur(6px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1001;
}

.chat-modal.open { display: flex; }

.chat-panel {
	width: min(880px, 92vw);
	height: min(70vh, 760px);
	background: linear-gradient(180deg, var(--chat-panel) 0%, var(--chat-panel-2) 100%);
	border: 1px solid var(--chat-border);
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.45);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--chat-border);
	color: var(--chat-text);
	font-weight: 600;
	font-family: var(--chat-font);
	font-size: 16px;
	letter-spacing: -0.02em;
}

.chat-header-actions {
	display: inline-flex;
	gap: 8px;
}

.chat-close {
	background: transparent;
	border: 1px solid var(--chat-border);
	color: var(--chat-text);
	border-radius: 10px;
	padding: 6px 10px;
	cursor: pointer;
	font-family: var(--chat-font);
	font-size: 13px;
	font-weight: 500;
	transition: all 0.2s;
}
.chat-close:hover {
	background: rgba(255,255,255,0.05);
	border-color: rgba(255,255,255,0.12);
}

.chat-ai-btn {
	background: transparent;
	border: 1px solid var(--chat-border);
	color: var(--chat-accent);
	border-radius: 10px;
	padding: 6px 10px;
	cursor: pointer;
	font-family: var(--chat-font);
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s;
}
.chat-ai-btn:hover { 
	background: rgba(0,245,212,0.08); 
	border-color: rgba(0,245,212,0.35);
}

.chat-scroll {
	flex: 1;
	padding: 18px;
	overflow: auto;
	scroll-behavior: smooth;
}

.chat-msg {
	max-width: 78%;
	padding: 12px 14px;
	border-radius: 12px;
	margin: 8px 0;
	line-height: 1.6;
	font-size: 15px;
	font-family: var(--chat-font);
	font-weight: 400;
	letter-spacing: -0.01em;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

.chat-msg.user { background: #0d2a26; color: #d1fae5; margin-left: auto; }
.chat-msg.bot { background: #0b1220; color: var(--chat-text); border: 1px solid var(--chat-border); }

/* Стили для ссылок и форматирования в сообщениях бота */
.chat-msg.bot a {
	color: var(--chat-accent);
	text-decoration: none;
	text-underline-offset: 3px;
	word-break: break-word;
	transition: all 0.2s ease;
	border-bottom: 1px solid var(--chat-accent);
	padding-bottom: 1px;
	font-weight: 500;
}
.chat-msg.bot a:hover {
	opacity: 0.85;
	border-bottom-color: rgba(0, 245, 212, 0.6);
	text-decoration: none;
}
.chat-msg.bot strong {
	font-weight: 600;
	color: var(--chat-text);
	letter-spacing: -0.01em;
}
.chat-msg.bot em {
	font-style: italic;
}
.chat-msg.bot code {
	background: rgba(255,255,255,0.1);
	padding: 2px 6px;
	border-radius: 4px;
	font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
	font-size: 0.9em;
}

/* Анимация мигающих точек при поиске */
.chat-typing-dots {
	display: inline-block;
	margin-left: 2px;
}
.chat-typing-dots span {
	display: inline-block;
	animation: chat-dot-blink 1.4s infinite;
	animation-fill-mode: both;
}
.chat-typing-dots span:nth-child(1) { animation-delay: 0s; }
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-dot-blink {
	0%, 80%, 100% { opacity: 0.3; }
	40% { opacity: 1; }
}

.chat-input {
	display: flex;
	gap: 10px;
	padding: 14px;
	border-top: 1px solid var(--chat-border);
	background: #0b1220;
}

.chat-input input {
	flex: 1;
	background: #0a1220;
	border: 1px solid var(--chat-border);
	color: var(--chat-text);
	padding: 12px 14px;
	border-radius: 12px;
	outline: none;
	font-family: var(--chat-font);
	font-size: 15px;
	font-weight: 400;
	letter-spacing: -0.01em;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.chat-input button {
	background: var(--chat-accent);
	border: none;
	color: #04181c;
	padding: 12px 16px;
	border-radius: 12px;
	font-weight: 600;
	font-family: var(--chat-font);
	font-size: 15px;
	letter-spacing: -0.01em;
	cursor: pointer;
	transition: opacity 0.2s;
}
.chat-input button:hover {
	opacity: 0.9;
}

/* Retina tweaks */
@media (min-resolution: 2dppx) {
	.chat-panel { box-shadow: 0 24px 80px rgba(0,0,0,0.5); }
}
