/* Chat Widget Styles */
.chat-widget {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 9999;
	font-family: 'Heebo', 'Assistant', Arial, sans-serif;
}

/* Кнопка открытия чата */
.chat-toggle {
	width: 60px;
	height: 60px;
	background: #f97316;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: all 0.3s ease;
	position: relative;
	color: white;
}

.chat-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.chat-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #ff4444;
	color: white;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: bold;
	border: 2px solid white;
}

/* Окно чата */
.chat-window {
	width: 380px;
	height: 600px;
	background: white;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: slideUp 0.3s ease;
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.chat-widget.chat-minimized .chat-window {
	height: 60px;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: auto;
	width: 100%;
	border-radius: 0;
}

/* Заголовок */
.chat-header {
	background: #f97316;
	color: white;
	padding: 16px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.chat-header-title h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
}

.chat-status {
	font-size: 12px;
	opacity: 0.9;
	margin-top: 4px;
	display: block;
}

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

.chat-btn-minimize,
.chat-btn-close {
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: white;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.chat-btn-minimize:hover,
.chat-btn-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Сообщения */
.chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: #f5f7fa;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

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

.chat-messages::-webkit-scrollbar-track {
	background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
	background: #555;
}

.chat-message {
	display: flex;
	flex-direction: column;
	max-width: 75%;
	animation: fadeIn 0.3s ease;
}

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

.chat-message-user {
	align-self: flex-end;
	align-items: flex-end;
}

.chat-message-bot {
	align-self: flex-start;
	align-items: flex-start;
}

.chat-message-content {
	padding: 12px 16px;
	border-radius: 18px;
	word-wrap: break-word;
	line-height: 1.4;
	font-size: 14px;
}

.chat-message-user .chat-message-content {
	background: #f97316;
	color: white;
	border-bottom-right-radius: 4px;
}

.chat-message-bot .chat-message-content {
	background: white;
	color: #333;
	border-bottom-left-radius: 4px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-message-time {
	font-size: 11px;
	color: #999;
	margin-top: 4px;
	padding: 0 4px;
}

/* Индикатор печати */
.chat-typing-indicator {
	display: flex;
	gap: 6px;
	padding: 4px 0;
	align-items: center;
}

.chat-typing-indicator span {
	width: 10px;
	height: 10px;
	background: #f97316;
	border-radius: 50%;
	animation: typing 1.4s ease-in-out infinite;
	display: inline-block;
}

.chat-typing-indicator span:nth-child(1) {
	animation-delay: 0s;
}

.chat-typing-indicator span:nth-child(2) {
	animation-delay: 0.2s;
}

.chat-typing-indicator span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0) scale(1);
		opacity: 0.4;
	}
	30% {
		transform: translateY(-12px) scale(1.1);
		opacity: 1;
	}
}

/* Поле ввода */
.chat-input-container {
	padding: 16px;
	background: white;
	border-top: 1px solid #e0e0e0;
	display: flex;
	gap: 8px;
	align-items: flex-end;
}

.chat-input {
	flex: 1;
	border: 1px solid #e0e0e0;
	border-radius: 20px;
	padding: 10px 16px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	max-height: 100px;
	overflow-y: auto;
	transition: border-color 0.2s;
}

.chat-input:focus {
	outline: none;
	border-color: #f97316;
}

.chat-input:disabled {
	background: #f5f5f5;
	cursor: not-allowed;
}

.chat-send-btn {
	width: 44px;
	height: 44px;
	background: #f97316;
	border: none;
	border-radius: 50%;
	color: white;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.chat-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Адаптивность */
@media (max-width: 768px) {
	.chat-widget {
		bottom: 20px;
		left: 20px;
	}

	.chat-widget.chat-open {
		bottom: 0;
		left: 0 !important;
		right: 0;
		top: 0;
		width: 100%;
		height: 100%;
	}

	.chat-window {
		width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}

	.chat-widget.chat-minimized .chat-window {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: auto;
		height: 60px;
		width: 100%;
		border-radius: 0;
	}

	.chat-toggle {
		width: 56px;
		height: 56px;
		position: fixed;
		bottom: 20px;
		left: 20px;
		z-index: 10000;
	}
}

/* RTL поддержка */
[dir="rtl"] .chat-widget {
	right: auto;
	left: 20px;
}

[dir="rtl"] .chat-message-user {
	align-self: flex-start;
	align-items: flex-start;
}

[dir="rtl"] .chat-message-bot {
	align-self: flex-end;
	align-items: flex-end;
}

[dir="rtl"] .chat-message-user .chat-message-content {
	border-bottom-right-radius: 18px;
	border-bottom-left-radius: 4px;
}

[dir="rtl"] .chat-message-bot .chat-message-content {
	border-bottom-left-radius: 18px;
	border-bottom-right-radius: 4px;
}

