/* AI Marketplace — виджет чата (переоформлено под тему BitRich) */

.aimp-chat {
	max-width: 100%;
	margin: 2em 0;
	border: 1px solid #E6E8F3;
	border-radius: 18px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
	background: #fff;
	box-shadow: 0 20px 50px -30px rgba(79,70,229,.25);
}

.aimp-chat-price-hint {
	font-size: 0.8em;
	color: #8B8FA3;
	margin: 0 0 0.6em;
	padding: 0 1em;
}

.aimp-chat-log {
	height: 420px;
	overflow-y: auto;
	padding: 1.2em;
	background: #F6F7FC;
	display: flex;
	flex-direction: column;
	gap: 0.7em;
}

.aimp-chat-empty {
	color: #8B8FA3;
	text-align: center;
	margin: auto;
	font-weight: 600;
}

.aimp-chat-bubble-wrap {
	max-width: 80%;
	display: flex;
	flex-direction: column;
}

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

.aimp-chat-wrap-assistant,
.aimp-chat-wrap-error {
	align-self: flex-start;
	align-items: flex-start;
}

.aimp-chat-bubble {
	padding: 0.7em 1em;
	border-radius: 14px;
	white-space: pre-wrap;
	word-break: break-word;
	line-height: 1.5;
}

.aimp-chat-bubble-user {
	background: #4F46E5;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.aimp-chat-bubble-assistant {
	background: #fff;
	border: 1px solid #E6E8F3;
	color: #1B1E2B;
	border-bottom-left-radius: 4px;
}

.aimp-chat-credits-spent {
	font-size: 0.75em;
	color: #8B8FA3;
	margin-top: 0.3em;
	font-weight: 600;
}

.aimp-chat-bubble-formatted {
	white-space: normal;
}

.aimp-chat-bubble-error {
	background: #FCEBEB;
	border: 1px solid #F7C1C1;
	color: #A32D2D;
}

.aimp-chat-typing {
	align-self: flex-start;
	max-width: 80%;
	display: flex;
	flex-direction: column;
	gap: 0.4em;
}

.aimp-chat-dots {
	display: flex;
	flex-direction: row;
	align-items: center;
}

.aimp-chat-typing-note {
	font-size: 0.8em;
	color: #8B8FA3;
}

.aimp-chat-dots span {
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 3px;
	border-radius: 50%;
	background: #4F46E5;
	animation: aimp-typing 1s infinite ease-in-out;
}

.aimp-chat-dots span:nth-child(2) {
	animation-delay: 0.15s;
}

.aimp-chat-dots span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes aimp-typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.5;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

.aimp-chat-bubble-assistant h1,
.aimp-chat-bubble-assistant h2,
.aimp-chat-bubble-assistant h3,
.aimp-chat-bubble-assistant h4,
.aimp-chat-bubble-assistant h5,
.aimp-chat-bubble-assistant h6 {
	margin: 0.6em 0 0.3em;
	line-height: 1.3;
	font-weight: 800;
}

.aimp-chat-bubble-assistant h1 { font-size: 1.35em; }
.aimp-chat-bubble-assistant h2 { font-size: 1.2em; }
.aimp-chat-bubble-assistant h3 { font-size: 1.08em; }
.aimp-chat-bubble-assistant h4,
.aimp-chat-bubble-assistant h5,
.aimp-chat-bubble-assistant h6 { font-size: 1em; }

.aimp-chat-bubble-assistant p {
	margin: 0 0 0.6em;
}

.aimp-chat-bubble-assistant p:last-child {
	margin-bottom: 0;
}

.aimp-chat-bubble-assistant ul,
.aimp-chat-bubble-assistant ol {
	margin: 0 0 0.6em;
	padding-left: 1.4em;
}

.aimp-chat-bubble-assistant li {
	margin-bottom: 0.25em;
}

.aimp-chat-bubble-assistant blockquote {
	margin: 0 0 0.6em;
	padding: 0.2em 0.9em;
	border-left: 3px solid #0FBE8F;
	color: #565B71;
}

.aimp-chat-bubble-assistant code {
	background: #EDECFC;
	color: #4338CA;
	border-radius: 4px;
	padding: 0.1em 0.4em;
	font-size: 0.9em;
	font-family: Consolas, Monaco, monospace;
}

.aimp-chat-bubble-assistant .aimp-md-codeblock {
	margin: 0 0 0.6em;
	border-radius: 10px;
	overflow: hidden;
	background: #1B1E2B;
}

.aimp-chat-bubble-assistant .aimp-md-codeblock-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.5em 1em;
	background: #12141F;
	border-bottom: 1px solid rgba(255,255,255,0.08);
}

.aimp-chat-bubble-assistant .aimp-md-codeblock-lang {
	font-size: 0.78em;
	color: #8B8FA3;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 700;
}

.aimp-chat-bubble-assistant .aimp-md-copy-btn {
	font-size: 0.78em;
	font-weight: 600;
	color: #C9CBE0;
	background: rgba(255,255,255,0.08);
	border: none;
	border-radius: 6px;
	padding: 0.3em 0.7em;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.aimp-chat-bubble-assistant .aimp-md-copy-btn:hover {
	background: rgba(255,255,255,0.16);
	color: #fff;
}

.aimp-chat-bubble-assistant .aimp-md-copy-btn-done {
	background: #0FBE8F;
	color: #fff;
}

.aimp-chat-bubble-assistant .aimp-md-pre {
	background: transparent;
	color: #eee;
	border-radius: 0;
	padding: 0.9em 1em;
	overflow-x: auto;
	margin: 0;
}

.aimp-chat-bubble-assistant .aimp-md-pre code {
	background: none;
	color: inherit;
	padding: 0;
}

.aimp-chat-bubble-assistant a {
	color: #4338CA;
	font-weight: 600;
}

.aimp-chat-controls {
	display: flex;
	gap: 1.5em;
	padding: 0.7em 1.2em;
	border-top: 1px solid #E6E8F3;
	background: #fff;
	font-size: 0.85em;
	color: #565B71;
	flex-wrap: wrap;
	font-weight: 600;
}

.aimp-chat-control {
	display: flex;
	align-items: center;
	gap: 0.4em;
}

.aimp-chat-control select {
	padding: 0.3em 0.5em;
	border-radius: 8px;
	border: 1px solid #E6E8F3;
	font-family: inherit;
}

.aimp-chat-checkbox {
	cursor: pointer;
}

.aimp-chat-form {
	display: flex;
	gap: 0.6em;
	padding: 0.9em 1.2em;
	border-top: 1px solid #E6E8F3;
	background: #fff;
}

.aimp-chat-input {
	flex: 1;
	resize: none;
	padding: 0.7em 0.9em;
	border: 1.5px solid #E6E8F3;
	border-radius: 12px;
	font: inherit;
	background: #F6F7FC;
}

.aimp-chat-input:focus {
	outline: none;
	border-color: #4F46E5;
	background: #fff;
}

.aimp-chat-send {
	padding: 0 1.6em;
	border: none;
	border-radius: 12px;
	background: #4F46E5;
	color: #fff;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s;
}

.aimp-chat-send:hover:not(:disabled) {
	background: #3D34C9;
}

.aimp-chat-send:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.aimp-chat-attach-row {
	display: flex;
	align-items: center;
	gap: 0.8em;
	padding: 0.6em 1.2em 0;
	background: #fff;
}

.aimp-chat-attach-btn {
	display: inline-block;
	padding: 0.4em 0.9em;
	border: 1.5px solid #E6E8F3;
	border-radius: 20px;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	background: #F6F7FC;
	user-select: none;
}

.aimp-chat-attach-btn:hover {
	border-color: #4F46E5;
}

.aimp-chat-attach-hint {
	font-size: 0.75em;
	color: #8B8FA3;
}

.aimp-chat-attach-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	padding: 0 1.2em;
	background: #fff;
}

.aimp-chat-attach-list:not(:empty) {
	padding-bottom: 0.5em;
}

.aimp-attach-chip {
	display: flex;
	align-items: center;
	gap: 0.4em;
	background: #F6F7FC;
	border: 1px solid #E6E8F3;
	border-radius: 10px;
	padding: 0.25em 0.6em;
	font-size: 0.8em;
	max-width: 260px;
}

.aimp-attach-chip-error {
	background: #FCEBEB;
	border-color: #F7C1C1;
	color: #A32D2D;
}

.aimp-attach-chip-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aimp-attach-chip-remove {
	border: none;
	background: none;
	color: #8B8FA3;
	cursor: pointer;
	font-size: 1.1em;
	line-height: 1;
	padding: 0 0.1em;
	flex-shrink: 0;
}

.aimp-attach-chip-remove:hover {
	color: #A32D2D;
}

.aimp-chat-attached-files {
	font-size: 0.75em;
	color: #8B8FA3;
	margin-top: 0.25em;
}

.aimp-chat-downloads {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin-top: 0.5em;
}

.aimp-chat-download-file {
	display: inline-block;
	padding: 0.4em 0.8em;
	background: #1B1E2B;
	color: #fff;
	text-decoration: none;
	border-radius: 16px;
	font-size: 0.8em;
	font-weight: 700;
}

.aimp-chat-download-file:hover {
	background: #4F46E5;
	color: #fff;
}

.aimp-attach-archive-note {
	width: 100%;
	font-size: 0.75em;
	color: #B4720F;
	background: #FFF1DC;
	border: 1px solid #F5D8A8;
	border-radius: 8px;
	padding: 0.35em 0.7em;
	margin-top: 0.2em;
}

.aimp-chat-download-zip {
	display: inline-block;
	padding: 0.4em 0.8em;
	background: #0FBE8F;
	color: #fff;
	border: none;
	border-radius: 16px;
	font-size: 0.8em;
	font-weight: 700;
	cursor: pointer;
}

.aimp-chat-download-zip:hover {
	background: #0A9C76;
}

.aimp-attach-pinned-note {
	width: 100%;
	font-size: 0.75em;
	color: #B4720F;
	margin-top: 0.3em;
}

.aimp-attach-detach-all {
	border: 1px solid #E6E8F3;
	background: #fff;
	border-radius: 16px;
	padding: 0.25em 0.7em;
	font-size: 0.75em;
	color: #565B71;
	cursor: pointer;
	margin-top: 0.2em;
	font-weight: 600;
}

.aimp-attach-detach-all:hover {
	background: #FCEBEB;
	color: #A32D2D;
	border-color: #F7C1C1;
}

.aimp-chat-topbar {
	display: flex;
	gap: 0.5em;
	padding: 0.7em 1.2em;
	background: #F6F7FC;
	border-bottom: 1px solid #E6E8F3;
}

.aimp-chat-history-toggle,
.aimp-chat-new-btn {
	border: 1.5px solid #E6E8F3;
	background: #fff;
	border-radius: 16px;
	padding: 0.4em 0.9em;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	color: #1B1E2B;
}

.aimp-chat-history-toggle:hover,
.aimp-chat-new-btn:hover {
	border-color: #4F46E5;
	color: #4338CA;
}

.aimp-chat-history-panel {
	max-height: 220px;
	overflow-y: auto;
	background: #F6F7FC;
	border-bottom: 1px solid #E6E8F3;
}

.aimp-chat-history-list {
	display: flex;
	flex-direction: column;
}

.aimp-chat-history-empty {
	padding: 0.8em 1.2em;
	font-size: 0.85em;
	color: #8B8FA3;
}

.aimp-chat-history-item {
	display: flex;
	align-items: center;
	border-bottom: 1px solid #E6E8F3;
}

.aimp-chat-history-item-active {
	background: #EDECFC;
}

.aimp-chat-history-item-title {
	flex: 1;
	text-align: left;
	border: none;
	background: none;
	padding: 0.6em 1.2em;
	font-size: 0.85em;
	color: #1B1E2B;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-family: inherit;
}

.aimp-chat-history-item-title:hover {
	color: #4338CA;
}

.aimp-chat-history-item-delete {
	border: none;
	background: none;
	color: #C9CBE0;
	cursor: pointer;
	padding: 0.4em 0.8em;
	font-size: 0.9em;
}

.aimp-chat-history-item-delete:hover {
	color: #A32D2D;
}

.aimp-chat-guest-hint {
	font-size: 0.8em;
	color: #B4720F;
	background: #FFF1DC;
	border-bottom: 1px solid #F5D8A8;
	padding: 0.7em 1.2em;
	margin: 0;
	font-weight: 600;
}
