/* Chat2 floating widget — purple FAB + panel (mockup) */

.chat2 {
	--chat2-purple: #6349ed;
	--chat2-purple-soft: #7e74d1;
	--chat2-bubble-bot: #f0f0ff;
	--chat2-text: #1f2937;
	--chat2-muted: #9ca3af;
	--chat2-border: #ececf3;
	--chat2-bg: #f7f7fb;

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99990;
	width: auto;
	max-width: none;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	font-family: inherit;
	pointer-events: none;
}

.chat2 > * {
	pointer-events: auto;
}

/* —— FAB button —— */
.chat2-fab {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	order: 2;
	animation: chat2-fab-in 0.45s ease both;
}

.chat2-fab__circle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: var(--chat2-purple-soft);
	box-shadow: 0 8px 24px rgba(99, 73, 237, 0.35);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chat2-fab:hover .chat2-fab__circle {
	transform: scale(1.05);
	background: var(--chat2-purple);
	box-shadow: 0 10px 28px rgba(99, 73, 237, 0.45);
}

.chat2-fab:active .chat2-fab__circle {
	transform: scale(0.96);
}

.chat2-fab__icon {
	display: block;
	width: 39px;
	height: 39px;
	pointer-events: none;
}

@keyframes chat2-fab-in {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.85);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* —— Panel —— */
.chat2-panel {
	order: 1;
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 32px));
	height: min(560px, calc(100vh - 120px));
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
	overflow: hidden;
	animation: chat2-panel-in 0.28s ease both;
}

.chat2-panel[hidden] {
	display: none !important;
}

@keyframes chat2-panel-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.chat2-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--chat2-border);
	background: #fff;
	flex: 0 0 auto;
}

.chat2-panel__identity {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.chat2-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--chat2-purple);
}

.chat2-avatar--sm {
	width: 34px;
	height: 34px;
}

.chat2-avatar__icon {
	display: block;
	width: 26px;
	height: 26px;
}

.chat2-avatar--sm .chat2-avatar__icon {
	width: 20px;
	height: 20px;
}

.chat2-panel__titles {
	min-width: 0;
}

.chat2-panel__title {
	font-size: 15px;
	font-weight: 700;
	color: #111827;
	line-height: 1.25;
}

.chat2-panel__subtitle {
	margin-top: 2px;
	font-size: 12px;
	color: var(--chat2-muted);
	line-height: 1.3;
}

.chat2-panel__actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
}

.chat2-panel__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #9ca3af;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.chat2-panel__btn:hover {
	background: #f3f4f6;
	color: #4b5563;
}

/* —— Messages —— */
.chat2-panel__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: var(--chat2-bg);
	display: flex;
	flex-direction: column;
	gap: 14px;
	-webkit-overflow-scrolling: touch;
}

.chat2-msg {
	display: flex;
	flex-direction: column;
	max-width: 92%;
}

.chat2-msg--bot {
	align-self: flex-start;
}

.chat2-msg--user {
	align-self: flex-end;
	align-items: flex-end;
}

.chat2-msg__row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.chat2-msg--user .chat2-msg__row {
	flex-direction: row-reverse;
}

.chat2-msg__bubble {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-break: break-word;
}

.chat2-msg--bot .chat2-msg__bubble {
	background: var(--chat2-bubble-bot);
	color: var(--chat2-text);
	border-bottom-left-radius: 6px;
}

.chat2-msg--user .chat2-msg__bubble {
	background: var(--chat2-purple);
	color: #fff;
	border-bottom-right-radius: 6px;
}

.chat2-msg__meta {
	margin-top: 4px;
	padding-left: 42px;
	font-size: 11px;
	color: var(--chat2-muted);
	line-height: 1;
}

.chat2-msg--user .chat2-msg__meta {
	padding-left: 0;
	padding-right: 4px;
	text-align: right;
}

.chat2-msg__bubble p {
	margin: 0 0 0.55em;
}

.chat2-msg__bubble p:last-child {
	margin-bottom: 0;
}

.chat2-msg__bubble ul,
.chat2-otvet__list {
	margin: 0 0 0.55em;
	padding-left: 1.2em;
}

.chat2-msg__bubble li {
	margin: 0 0 0.35em;
}

.chat2-msg__bubble a {
	color: #2f6fed;
	text-decoration: underline;
}

.chat2-msg--user .chat2-msg__bubble a {
	color: #e8e4ff;
}

.chat2-msg__bubble.is-error {
	background: #fff5f5;
	color: #b42318;
}

.chat2-msg__bubble.is-loading {
	opacity: 0.75;
	font-style: italic;
}

/* —— Form —— */
.chat2-panel__form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px 14px;
	background: #fff;
	border-top: 1px solid var(--chat2-border);
	flex: 0 0 auto;
}

.chat2-panel__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 44px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	outline: none;
	background: #fff;
	font-size: 14px;
	line-height: 1.4;
	color: var(--chat2-text);
	font-family: inherit;
	box-shadow: none;
}

.chat2-panel__input::placeholder {
	color: #9aa3af;
}

.chat2-panel__input:focus {
	border-color: #c4b5fd;
	box-shadow: 0 0 0 3px rgba(99, 73, 237, 0.12);
}

/* Выше специфичность, чем preflight темы: button/[type=submit] { background: transparent } */
.chat2 button.chat2-panel__send,
.chat2 .chat2-panel__send[type='submit'] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	min-width: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background-color: var(--chat2-purple);
	background-image: none;
	color: #fff;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.chat2 button.chat2-panel__send:hover,
.chat2 .chat2-panel__send[type='submit']:hover {
	background-color: #5238d6;
	color: #fff;
}

.chat2 button.chat2-panel__send:active,
.chat2 .chat2-panel__send[type='submit']:active {
	transform: scale(0.96);
}

.chat2 button.chat2-panel__send:disabled,
.chat2 .chat2-panel__send[type='submit']:disabled {
	opacity: 0.6;
	cursor: wait;
}

.chat2 .chat2-panel__send svg {
	display: block;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: #fff;
	stroke: currentColor;
}

@media (max-width: 480px) {
	.chat2 {
		right: 16px;
		bottom: 16px;
	}

	.chat2-fab__circle {
		width: 52px;
		height: 52px;
	}

	.chat2-fab__icon {
		width: 28px;
		height: 28px;
	}

	.chat2-panel {
		width: calc(100vw - 32px);
		height: min(70vh, 520px);
	}
}
