/**
 * Matrix Q&A Chat History Styles
 * Terminal-style green-on-dark design
 */

/* Remove tab padding when showing chat detail */
#tab-chat-history {
	padding: 0 !important;
	overflow: hidden;
}

/* ===== NEW CHAT BUTTON ===== */

.chat-new-btn-wrapper {
	padding: 12px 12px 4px;
}

.chat-new-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 16px;
	background: rgba(0, 255, 65, 0.08);
	border: 1px dashed rgba(0, 255, 65, 0.3);
	border-radius: 8px;
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.chat-new-btn:hover {
	background: rgba(0, 255, 65, 0.15);
	border-color: rgba(0, 255, 65, 0.5);
	box-shadow: 0 0 20px rgba(0, 255, 65, 0.15);
}

.chat-new-btn:active {
	transform: scale(0.98);
}

.chat-new-btn-icon {
	font-size: 18px;
	font-weight: bold;
	line-height: 1;
}

.chat-new-btn-text {
	letter-spacing: 1px;
	text-transform: uppercase;
}

/* ===== CHAT LIST ===== */

.chat-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px 12px 12px;
}

.chat-item {
	position: relative;
	background: rgba(0, 255, 65, 0.03);
	border: 1px solid rgba(0, 255, 65, 0.15);
	border-radius: 8px;
	padding: 14px 16px;
	cursor: pointer;
	overflow: hidden;
	transition: all 0.3s ease;
}

.chat-item:hover {
	background: rgba(0, 255, 65, 0.08);
	border-color: rgba(0, 255, 65, 0.4);
	box-shadow: 0 0 15px rgba(0, 255, 65, 0.1), inset 0 0 15px rgba(0, 255, 65, 0.03);
}

.chat-item:active {
	transform: scale(0.98);
}

/* Scanline on hover */
.chat-item::after {
	content: "";
	position: absolute;
	top: -100%;
	left: 0;
	width: 100%;
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--matrix-green, #00ff41), transparent);
	opacity: 0;
	transition: opacity 0.3s;
}

.chat-item:hover::after {
	opacity: 0.6;
	animation: chatScanline 1.5s linear infinite;
}

@keyframes chatScanline {
	0% { top: -5%; }
	100% { top: 105%; }
}

.chat-item-header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.chat-item-session {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.7;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.chat-item-time {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.35);
	margin-left: auto;
}

.chat-item-title {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	color: var(--matrix-green, #00ff41);
	margin-bottom: 6px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.chat-item-title::before {
	content: "> ";
	opacity: 0.5;
}

.chat-item-preview {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.4);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.chat-item-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.3);
	font-family: Arial, Helvetica, sans-serif;
}

.chat-item-meta-count::before {
	content: "MSG:";
	color: var(--matrix-green, #00ff41);
	opacity: 0.5;
	margin-right: 4px;
}

/* ===== CHAT DETAIL (Terminal View) ===== */

.chat-detail {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.chat-terminal-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: rgba(0, 255, 65, 0.05);
	border-bottom: 1px solid rgba(0, 255, 65, 0.2);
	font-family: Arial, Helvetica, sans-serif;
}

.chat-terminal-back {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	background: rgba(0, 255, 65, 0.1);
	border: 1px solid rgba(0, 255, 65, 0.2);
	color: var(--matrix-green, #00ff41);
	cursor: pointer;
	font-size: 16px;
	transition: all 0.2s;
	flex-shrink: 0;
}

.chat-terminal-back:hover {
	background: rgba(0, 255, 65, 0.2);
	border-color: rgba(0, 255, 65, 0.4);
}

.chat-terminal-session {
	font-size: 13px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.8;
}

.chat-terminal-title {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.4);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

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

/* When input bar is visible, add bottom padding */
.chat-messages-with-input {
	padding-bottom: 90px;
}

.chat-msg {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	padding: 10px 14px;
	border-radius: 6px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* Model messages with qa-answer-body need whitespace normal */
.chat-msg-model {
	background: rgba(168, 85, 247, 0.06);
	border-left: 3px solid var(--matrix-purple, #a855f7);
	color: rgba(255, 255, 255, 0.85);
	white-space: normal;
}

.chat-msg-model .qa-answer-body {
	font-size: 15px;
	line-height: 1.6;
}

.chat-msg-user {
	background: rgba(0, 255, 65, 0.06);
	border-left: 3px solid var(--matrix-green, #00ff41);
	color: var(--matrix-green, #00ff41);
	white-space: pre-wrap;
}

.chat-msg-user::before {
	content: "> ";
	opacity: 0.5;
	font-weight: bold;
}

/* Attachment indicator in user messages */
.chat-msg-attachment-info {
	font-size: 12px;
	color: var(--matrix-purple, #a855f7);
	margin-bottom: 4px;
	font-family: Arial, Helvetica, sans-serif;
	opacity: 0.8;
}

/* ===== EMPTY STATE ===== */

.chat-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
	text-align: center;
}

.chat-empty-inline {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	text-align: center;
}

.chat-empty-icon {
	font-size: 48px;
	margin-bottom: 16px;
	opacity: 0.3;
}

.chat-empty-text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.4;
}

.chat-empty-text::before {
	content: "// ";
}

.chat-empty-hint {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.25);
	margin-top: 8px;
}

/* ===== LOADING ===== */

.chat-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.5;
}

.chat-loading::after {
	content: "...";
	animation: chatLoadingDots 1.5s infinite;
}

@keyframes chatLoadingDots {
	0% { content: "."; }
	33% { content: ".."; }
	66% { content: "..."; }
}

/* ===== CHAT INPUT BAR ===== */

.chat-input-container {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 100;
	background: var(--bg-primary, #1a1a2e);
	border-top: 1px solid rgba(0, 255, 65, 0.2);
	padding: 8px 12px;
	padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.chat-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

/* Attachment button */
.chat-input-attach-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border: 1px solid rgba(0, 255, 65, 0.2);
	border-radius: 8px;
	background: rgba(0, 255, 65, 0.05);
	color: var(--matrix-green, #00ff41);
	cursor: pointer;
	transition: all 0.2s;
}

.chat-input-attach-btn:hover {
	background: rgba(0, 255, 65, 0.12);
	border-color: rgba(0, 255, 65, 0.4);
}

.chat-input-attach-btn:active {
	transform: scale(0.95);
}

/* Text input */
.chat-input-text {
	flex: 1;
	min-height: 36px;
	max-height: 100px;
	padding: 8px 12px;
	background: rgba(0, 255, 65, 0.04);
	border: 1px solid rgba(0, 255, 65, 0.2);
	border-radius: 8px;
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	resize: none;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-text::placeholder {
	color: rgba(0, 255, 65, 0.3);
	font-family: Arial, Helvetica, sans-serif;
}

.chat-input-text:focus {
	border-color: rgba(0, 255, 65, 0.5);
	box-shadow: 0 0 12px rgba(0, 255, 65, 0.1), inset 0 0 8px rgba(0, 255, 65, 0.03);
}

/* Send button */
.chat-input-send-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border: 1px solid rgba(0, 255, 65, 0.3);
	border-radius: 8px;
	background: rgba(0, 255, 65, 0.1);
	color: var(--matrix-green, #00ff41);
	cursor: pointer;
	transition: all 0.2s;
}

.chat-input-send-btn:hover:not(:disabled) {
	background: rgba(0, 255, 65, 0.25);
	border-color: rgba(0, 255, 65, 0.6);
	box-shadow: 0 0 16px rgba(0, 255, 65, 0.2);
}

.chat-input-send-btn:active:not(:disabled) {
	transform: scale(0.92);
}

.chat-input-send-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

/* ===== ATTACHMENT PREVIEW ===== */

.chat-attachment-preview {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	margin-bottom: 6px;
}

.chat-attachment-item {
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(168, 85, 247, 0.08);
	border: 1px solid rgba(168, 85, 247, 0.2);
	border-radius: 6px;
	padding: 4px 10px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: var(--matrix-purple, #a855f7);
}

.chat-attachment-icon {
	font-weight: bold;
	font-size: 11px;
	background: rgba(168, 85, 247, 0.15);
	padding: 2px 6px;
	border-radius: 4px;
}

.chat-attachment-thumb {
	width: 28px;
	height: 28px;
	object-fit: cover;
	border-radius: 4px;
}

.chat-attachment-name {
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	opacity: 0.8;
}

.chat-attachment-remove {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.5);
	font-size: 14px;
	cursor: pointer;
	padding: 0 4px;
	font-family: Arial, Helvetica, sans-serif;
	transition: color 0.2s;
}

.chat-attachment-remove:hover {
	color: #ff4444;
}

/* ===== TYPING INDICATOR ===== */

.chat-typing-indicator {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	background: rgba(168, 85, 247, 0.06);
	border-left: 3px solid var(--matrix-purple, #a855f7);
	border-radius: 6px;
}

.chat-typing-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--matrix-purple, #a855f7);
	animation: chatTypingPulse 1.4s ease-in-out infinite;
}

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

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

@keyframes chatTypingPulse {
	0%, 60%, 100% {
		opacity: 0.2;
		transform: scale(0.8);
	}
	30% {
		opacity: 1;
		transform: scale(1);
	}
}

.chat-typing-text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: var(--matrix-purple, #a855f7);
	opacity: 0.6;
	margin-left: 4px;
}

/* ===== APPEAR ANIMATION ===== */

.chat-item {
	opacity: 0;
	transform: translateY(10px);
	animation: chatItemAppear 0.3s ease forwards;
}

.chat-item:nth-child(1) { animation-delay: 0.05s; }
.chat-item:nth-child(2) { animation-delay: 0.1s; }
.chat-item:nth-child(3) { animation-delay: 0.15s; }
.chat-item:nth-child(4) { animation-delay: 0.2s; }
.chat-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes chatItemAppear {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.chat-msg {
	opacity: 0;
	transform: translateX(-8px);
	animation: chatMsgAppear 0.3s ease forwards;
}

/* Skip appearance animation when matrix decode is active */
.chat-msg.chat-msg-matrix-active {
	animation: none !important;
	opacity: 1 !important;
	transform: none !important;
}

@keyframes chatMsgAppear {
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* ===== AGENT ICON IN CHAT LIST ===== */

.chat-item-agent-icon {
	font-size: 14px;
	line-height: 1;
	flex-shrink: 0;
}

/* ===== AGENT BADGE IN CHAT HEADER ===== */

.chat-agent-badge {
	font-size: 16px;
	margin-right: 6px;
	vertical-align: middle;
}

/* ===== AGENT SELECT SCREEN ===== */

.agent-select {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.agent-select-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: rgba(0, 255, 65, 0.05);
	border-bottom: 1px solid rgba(0, 255, 65, 0.2);
	font-family: Arial, Helvetica, sans-serif;
}

.agent-select-back {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	background: rgba(0, 255, 65, 0.1);
	border: 1px solid rgba(0, 255, 65, 0.2);
	color: var(--matrix-green, #00ff41);
	cursor: pointer;
	font-size: 16px;
	transition: all 0.2s;
	flex-shrink: 0;
}

.agent-select-back:hover {
	background: rgba(0, 255, 65, 0.2);
	border-color: rgba(0, 255, 65, 0.4);
}

.agent-select-title {
	font-size: 14px;
	color: var(--matrix-green, #00ff41);
	letter-spacing: 1px;
	text-transform: uppercase;
}

/* Agent grid: 2 columns */
.agent-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 12px;
	overflow-y: auto;
	flex: 1;
}

/* Agent card */
.agent-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 14px 10px;
	background: rgba(0, 255, 65, 0.03);
	border: 1px solid rgba(0, 255, 65, 0.15);
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
	opacity: 0;
	transform: scale(0.95);
	animation: agentCardAppear 0.3s ease forwards;
}

.agent-card:nth-child(1) { animation-delay: 0.03s; }
.agent-card:nth-child(2) { animation-delay: 0.06s; }
.agent-card:nth-child(3) { animation-delay: 0.09s; }
.agent-card:nth-child(4) { animation-delay: 0.12s; }
.agent-card:nth-child(5) { animation-delay: 0.15s; }
.agent-card:nth-child(6) { animation-delay: 0.18s; }
.agent-card:nth-child(7) { animation-delay: 0.21s; }
.agent-card:nth-child(8) { animation-delay: 0.24s; }
.agent-card:nth-child(9) { animation-delay: 0.27s; }
.agent-card:nth-child(10) { animation-delay: 0.30s; }
.agent-card:nth-child(11) { animation-delay: 0.33s; }

@keyframes agentCardAppear {
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.agent-card:hover {
	background: rgba(0, 255, 65, 0.08);
	border-color: rgba(0, 255, 65, 0.4);
	box-shadow: 0 0 20px rgba(0, 255, 65, 0.12), inset 0 0 15px rgba(0, 255, 65, 0.03);
	transform: scale(1.02);
}

.agent-card:active {
	transform: scale(0.97);
}

/* Scanline effect on hover */
.agent-card::after {
	content: "";
	position: absolute;
	top: -100%;
	left: 0;
	width: 100%;
	height: 2px;
	background: linear-gradient(90deg, transparent, var(--matrix-green, #00ff41), transparent);
	opacity: 0;
	transition: opacity 0.3s;
}

.agent-card:hover::after {
	opacity: 0.5;
	animation: chatScanline 1.5s linear infinite;
}

/* Universal agent card -- slightly different style */
.agent-card-universal {
	grid-column: 1 / -1;
	flex-direction: row;
	text-align: left;
	gap: 12px;
	padding: 12px 16px;
	background: rgba(0, 255, 65, 0.06);
	border-color: rgba(0, 255, 65, 0.25);
}

.agent-card-universal:hover {
	background: rgba(0, 255, 65, 0.12);
	border-color: rgba(0, 255, 65, 0.5);
}

.agent-card-icon {
	font-size: 28px;
	line-height: 1;
	flex-shrink: 0;
}

.agent-card-universal .agent-card-icon {
	font-size: 24px;
}

.agent-card-info {
	min-width: 0;
}

.agent-card-name {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
	color: var(--matrix-green, #00ff41);
	font-weight: bold;
	letter-spacing: 0.5px;
	margin-bottom: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.agent-card-desc {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: rgba(255, 255, 255, 0.4);
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ===== AGENT CARD COST BADGE ===== */

.agent-card-cost {
	position: absolute;
	top: 6px;
	right: 6px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 9px;
	color: var(--matrix-green, #00ff41);
	background: rgba(0, 255, 65, 0.1);
	border: 1px solid rgba(0, 255, 65, 0.3);
	border-radius: 4px;
	padding: 1px 5px;
	letter-spacing: 0.3px;
}

/* ===== AGENT SELECT LIMITS ===== */

.agent-select-limits {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: rgba(255, 255, 255, 0.3);
	text-align: center;
	padding: 8px 12px 12px;
	letter-spacing: 0.3px;
}

/* ===== CONTINUE BUTTON ===== */

.chat-continue-btn {
	display: block;
	margin: 8px auto 4px;
	padding: 8px 20px;
	background: transparent;
	border: 1px solid rgba(0, 255, 65, 0.35);
	border-radius: 6px;
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	cursor: pointer;
	transition: all 0.3s ease;
	letter-spacing: 0.5px;
}

.chat-continue-btn:hover {
	background: rgba(0, 255, 65, 0.1);
	border-color: rgba(0, 255, 65, 0.6);
	box-shadow: 0 0 15px rgba(0, 255, 65, 0.15);
}

.chat-continue-btn:active {
	transform: scale(0.96);
}

/* ===== CODE DOWNLOAD BUTTON ===== */

.code-download-wrapper {
	margin: 8px 0 4px;
	padding: 10px 14px;
	background: rgba(0, 255, 65, 0.04);
	border: 1px solid rgba(0, 255, 65, 0.2);
	border-radius: 6px;
	opacity: 0;
	animation: chatMsgAppear 0.3s ease forwards;
	animation-delay: 0.15s;
}

.code-download-files {
	margin-bottom: 8px;
	max-height: 120px;
	overflow-y: auto;
}

.code-download-file-item {
	font-family: "Courier New", monospace;
	font-size: 11px;
	color: rgba(0, 255, 65, 0.6);
	padding: 2px 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.code-download-file-item::before {
	content: "\2514\2500 ";
	opacity: 0.4;
}

.code-download-btn {
	display: block;
	width: 100%;
	padding: 10px 16px;
	background: rgba(0, 255, 65, 0.08);
	border: 1px solid rgba(0, 255, 65, 0.35);
	border-radius: 6px;
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.3s ease;
	letter-spacing: 0.5px;
	text-align: center;
}

.code-download-btn:hover:not(:disabled) {
	background: rgba(0, 255, 65, 0.15);
	border-color: rgba(0, 255, 65, 0.6);
	box-shadow: 0 0 20px rgba(0, 255, 65, 0.15);
}

.code-download-btn:active:not(:disabled) {
	transform: scale(0.97);
}

.code-download-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.code-download-info {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.5;
	text-align: center;
	margin-top: 6px;
}

/* ===== COPY BUTTON & COST LABEL (under model messages) ===== */

.chat-msg-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 8px;
	padding-top: 6px;
	border-top: 1px solid rgba(168, 85, 247, 0.1);
	gap: 8px;
}

.chat-msg-copy-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	background: transparent;
	border: 1px solid rgba(168, 85, 247, 0.25);
	border-radius: 4px;
	color: rgba(168, 85, 247, 0.5);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	cursor: pointer;
	transition: all 0.2s ease;
	flex-shrink: 0;
	letter-spacing: 0.3px;
}

.chat-msg-copy-btn:hover {
	color: rgba(168, 85, 247, 0.85);
	border-color: rgba(168, 85, 247, 0.5);
	background: rgba(168, 85, 247, 0.08);
}

.chat-msg-copy-btn:active {
	transform: scale(0.95);
}

.chat-msg-copy-btn.copied {
	color: var(--matrix-green, #00ff41);
	border-color: rgba(0, 255, 65, 0.4);
}

.chat-msg-copy-icon {
	font-size: 12px;
	line-height: 1;
}

.chat-msg-footer-left {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}

.chat-msg-dl-btn {
	padding: 3px 8px;
	font-size: 10px;
}

.chat-msg-footer-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.chat-msg-cost {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: rgba(255, 255, 255, 0.25);
	letter-spacing: 0.3px;
	flex-shrink: 0;
	white-space: nowrap;
}

/* ===== TEXT SELECTION IN ANSWERS ===== */

.qa-answer-body,
.chat-msg-model .qa-answer-body {
	-webkit-user-select: text;
	user-select: text;
}

/* Copyable elements show pointer cursor (except links) */
.qa-answer-body p,
.qa-answer-body pre,
.qa-answer-body li,
.qa-answer-body blockquote,
.qa-answer-body h1,
.qa-answer-body h2,
.qa-answer-body h3,
.qa-answer-body h4,
.qa-answer-body td,
.qa-answer-body th {
	cursor: pointer;
	transition: background-color 0.15s ease;
}

/* Links keep default cursor */
.qa-answer-body a {
	cursor: pointer;
}

/* ===== COPY FLASH EFFECT ===== */

.chat-copy-flash {
	background-color: rgba(0, 255, 65, 0.15) !important;
	transition: background-color 0.4s ease !important;
}

/* ===== COPY MINI TOAST ===== */

.chat-copy-toast {
	position: fixed;
	z-index: 10001;
	padding: 4px 12px;
	background: rgba(0, 255, 65, 0.15);
	border: 1px solid rgba(0, 255, 65, 0.4);
	border-radius: 4px;
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	letter-spacing: 0.5px;
	pointer-events: none;
	opacity: 1;
	transition: opacity 0.3s ease;
	text-shadow: 0 0 6px rgba(0, 255, 65, 0.4);
	box-shadow: 0 0 10px rgba(0, 255, 65, 0.1);
}

.chat-copy-toast-fadeout {
	opacity: 0;
}

/* ===== COPY HINT (one-time) ===== */

.chat-copy-hint {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: var(--matrix-green, #00ff41);
	opacity: 0.45;
	text-align: center;
	padding: 4px 0 8px;
	letter-spacing: 0.5px;
	transition: opacity 0.3s ease;
}

.chat-copy-hint::before {
	content: "// ";
	opacity: 0.5;
}

.chat-copy-hint-fadeout {
	opacity: 0;
}

/* ===== INSUFFICIENT BALANCE MESSAGE ===== */

.chat-insufficient-balance {
	text-align: center;
	padding: 16px 14px;
}

.chat-insufficient-text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: rgba(255, 255, 255, 0.7);
	line-height: 1.6;
	margin-bottom: 12px;
}

.chat-insufficient-text b {
	color: var(--matrix-green, #00ff41);
	font-size: 15px;
}

.chat-topup-btn {
	display: inline-block;
	padding: 10px 24px;
	background: rgba(0, 255, 65, 0.1);
	border: 1px solid rgba(0, 255, 65, 0.4);
	border-radius: 8px;
	color: var(--matrix-green, #00ff41);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.3s ease;
	letter-spacing: 0.5px;
}

.chat-topup-btn:hover {
	background: rgba(0, 255, 65, 0.2);
	border-color: rgba(0, 255, 65, 0.7);
	box-shadow: 0 0 20px rgba(0, 255, 65, 0.2), 0 0 40px rgba(0, 255, 65, 0.1);
	text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

.chat-topup-btn:active {
	transform: scale(0.96);
}

/* ===== MIC BUTTON & VOICE RECORDING ===== */

.chat-input-mic-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border: 1px solid rgba(0, 255, 65, 0.2);
	border-radius: 8px;
	background: rgba(0, 255, 65, 0.05);
	color: var(--matrix-green, #00ff41);
	cursor: pointer;
	transition: all 0.2s;
}

.chat-input-mic-btn:hover {
	background: rgba(0, 255, 65, 0.12);
	border-color: rgba(0, 255, 65, 0.4);
}

.chat-input-mic-btn:active {
	transform: scale(0.95);
}

/* Recording state: red pulsing */
.chat-input-mic-btn.recording {
	background: rgba(255, 50, 50, 0.15);
	border-color: rgba(255, 50, 50, 0.5);
	color: #ff3232;
	animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(255, 50, 50, 0.3);
	}
	50% {
		box-shadow: 0 0 12px 4px rgba(255, 50, 50, 0.2);
	}
}

/* Recording timer */
.chat-input-timer {
	flex: 1;
	text-align: center;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	color: #ff3232;
	letter-spacing: 1px;
	font-variant-numeric: tabular-nums;
	animation: timerBlink 1s ease-in-out infinite;
}

@keyframes timerBlink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.6; }
}

/* Voice attachment in preview */
.chat-attachment-voice {
	border-color: rgba(0, 255, 65, 0.3);
	background: rgba(0, 255, 65, 0.08);
	color: var(--matrix-green, #00ff41);
}

.chat-attachment-voice .chat-attachment-name {
	color: var(--matrix-green, #00ff41);
}

/* ===== VOICE TRANSCRIPTION BLOCK ===== */

.voice-transcription {
	background: rgba(168, 85, 247, 0.04) !important;
	border-left: 3px solid var(--matrix-purple, #a855f7) !important;
	border-radius: 6px;
	padding: 12px 14px !important;
}

.voice-transcription-label {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: var(--matrix-purple, #a855f7);
	opacity: 0.7;
	margin-bottom: 8px;
	letter-spacing: 0.3px;
}

.voice-transcription-text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.9);
	background: rgba(168, 85, 247, 0.06);
	border: 1px solid rgba(168, 85, 247, 0.15);
	border-radius: 6px;
	padding: 12px 14px;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	white-space: pre-wrap;
	word-wrap: break-word;
	-webkit-user-select: text;
	user-select: text;
}

.voice-transcription-text:hover {
	background: rgba(168, 85, 247, 0.12);
	border-color: rgba(168, 85, 247, 0.3);
	box-shadow: 0 0 12px rgba(168, 85, 247, 0.1);
}

.voice-transcription-text:active {
	transform: scale(0.99);
}

/* Flash effect after copy */
.voice-transcription-copied {
	background: rgba(0, 255, 65, 0.15) !important;
	border-color: rgba(0, 255, 65, 0.4) !important;
	box-shadow: 0 0 15px rgba(0, 255, 65, 0.1) !important;
}

.voice-transcription-hint {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.35);
	margin-top: 10px;
	letter-spacing: 0.3px;
}

.voice-transcription-hint::before {
	content: "// ";
	opacity: 0.5;
}

.voice-transcription-cost {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: rgba(255, 255, 255, 0.25);
	margin-top: 8px;
	letter-spacing: 0.3px;
	text-align: right;
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
	.chat-item,
	.chat-msg,
	.agent-card {
		animation: none !important;
		opacity: 1;
		transform: none;
	}

	.chat-typing-dot {
		animation: none !important;
		opacity: 0.6;
	}

	.chat-input-mic-btn.recording {
		animation: none !important;
		box-shadow: 0 0 8px rgba(255, 50, 50, 0.3);
	}

	.chat-input-timer {
		animation: none !important;
		opacity: 1;
	}
}
