.chat-root {
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	width: 100%; height: 100%;
	pointer-events: none;
	z-index: 10000;
	font-family: Poppins, sans-serif;
}

.chat-root .ui-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
	line-height: 1em;
	text-align: center;
}

/* â”â”â” CHAT WINDOW (DRAWER) â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â” */
.chat-window {
	position: absolute;
	bottom: 80px;
	right: 15px;
	width: 380px;
	height: 520px;
	background-color: #121214;
	border: 1px solid #27272a;
	border-radius: 16px;
	display: flex;
	flex-direction: column;
	backdrop-filter: blur(8px);
	overflow: hidden;

	/* Visibility & Animation */
	opacity: 0;
	pointer-events: none;
	transform: translateY(20px) scale(0.96);
	transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
	box-shadow: 0 24px 56px rgba(0, 0, 0, 0.72);

	&.visible {
		opacity: 1;
		pointer-events: all;
		transform: translateY(0) scale(1);
		border-color: #3b82f6;
		box-shadow: 0 24px 56px rgba(0, 0, 0, 0.72), 0 0 28px rgba(59, 130, 246, 0.22);
	}
}

.chat-win-header {
	padding: 10px 16px;
	background-color: #18181b;
	border-bottom: 1px solid #27272a;
	display: flex;
	justify-content: space-between;
	align-items: center;

	.chat-win-title {
		font-size: 12px;
		font-weight: 800;
		color: #f8fafc;
		text-transform: uppercase;
		letter-spacing: 1px;
	}

	.chat-win-close {
		width: 24px; height: 24px;
		background-color: transparent;
		color: #52525b;
		font-size: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 6px;
		transition: all 0.2s;
		&:hover { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }
	}
}

.chat-win-history {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: stretch;
	overflow-y: scroll;
	padding: 15px;
	gap: 10px;
}

/* Chat Entry Styling */
.chat-win-entry {
	display: flex;
	flex-shrink: 0;
	min-height: 44px;
	height: auto;
	width: 100%;
	gap: 10px;
	padding: 7px 12px;
	margin-bottom: 2px;
	background-color: #18181b;
	border-radius: 10px;
	border: 1px solid #27272a;
	border-left: 3px solid #3f3f46;
	transition: all 0.15s ease-out;
	animation: slide-in-chat 0.25s cubic-bezier(0.19, 1, 0.22, 1) both;

	&:hover {
		background-color: #1e1e22;
		border-color: #3f3f46;
	}

	&.is-self {
		background-color: #1a2744;
		border: 1px solid rgba(59, 130, 246, 0.35);
		border-left: 1px solid rgba(59, 130, 246, 0.35);
		border-right: 5px solid #3b82f6;
		padding-left: 12px;
		padding-right: 16px;
		height: auto;
		box-shadow: 0 6px 16px rgba(59, 130, 246, 0.14);

		.cw-name {
			color: #93c5fd !important;
			font-weight: 1000;
		}
	}

	.cw-icon {
		font-size: 16px;
		width: 32px; height: 32px;
		background-color: #09090b;
		border-radius: 8px;
		display: flex;
		justify-content: center;
		align-items: center;
		border: 1px solid #27272a;
		flex-shrink: 0;
	}

	.cw-icon .ui-icon {
		width: 18px;
		height: 18px;
		line-height: 18px;
		font-size: 17px;
		padding: 0;
	}

	.cw-content {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.cw-name {
		font-size: 10px;
		font-weight: 900;
		margin-bottom: 1px;
		letter-spacing: 0.5px;
		text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
	}

	.cw-msg {
		font-size: 13px;
		color: #fafafa;
		line-height: 18px;
		word-break: break-all;
		white-space: normal;
	}
}

/* --- TRADE / INFO BANNER ENTRIES --- */
.chat-info-entry {
	display: flex;
	flex-shrink: 0;
	height: 30px;
	width: 100%;
	gap: 6px;
	padding: 0 10px;
	align-items: center;
	background-color: rgba(255, 255, 255, 0.03);
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	animation: slide-in-chat 0.25s cubic-bezier(0.19, 1, 0.22, 1) both;

	&.trade-buy {
		background-color: rgba(74, 222, 128, 0.05);
		border-color: rgba(74, 222, 128, 0.18);
	}

	&.trade-sell {
		background-color: rgba(248, 113, 113, 0.05);
		border-color: rgba(248, 113, 113, 0.18);
	}

	&.info-connect {
		background-color: rgba(255, 255, 255, 0.03);
		border-color: rgba(255, 255, 255, 0.07);
	}

	.ci-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 18px;
		height: 18px;

		.ui-icon {
			width: 16px;
			height: 16px;
			font-size: 15px;
			line-height: 16px;
		}
	}

	.ci-name {
		font-size: 11px;
		font-weight: 900;
		color: #ffffff;
		letter-spacing: 0.3px;
		flex-shrink: 0;
	}

	.ci-action {
		font-size: 11px;
		font-weight: 600;
		color: #e4e4e7;
		flex: 1;
	}

	.ci-count {
		font-size: 10px;
		font-weight: 800;
		color: #ffffff;
		background-color: rgba(255, 255, 255, 0.15);
		padding: 1px 6px;
		border-radius: 4px;
		flex-shrink: 0;
	}
}

.chat-win-input {
	padding: 16px;
	background-color: #121214;
	border-top: 1px solid #27272a;
	display: flex;
	gap: 12px;

	TextEntry {
		flex: 1;
		background-color: #09090b;
		border: 1px solid #27272a;
		border-radius: 10px;
		padding: 8px 16px;
		color: white;
		font-size: 14px;
		transition: all 0.2s;

		&:focus {
			background-color: #111111;
			border-color: #3b82f6;
			box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
		}
	}

	.chat-win-send {
		width: 42px;
		height: 42px;
		background: #3b82f6;
		color: white;
		border-radius: 10px;
		display: flex;
		justify-content: center;
		align-items: center;
		transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
		border: none;
		box-shadow: 0 6px 0 #1d4ed8;

		.icon {
			font-size: 20px;
			color: white;
		}

		.ui-icon {
			width: 20px;
			height: 20px;
			line-height: 20px;
			font-size: 18px;
			color: #ffffff;
			padding: 0;
		}

		&:hover {
			background-color: #60a5fa;
			transform: translateY(-2px);
			box-shadow: 0 8px 0 #1d4ed8;
		}
		
		&:active {
			transform: translateY(3px);
			box-shadow: 0 3px 0 #1d4ed8;
		}
	}
}

/* â”â”â” PREVIEWS â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â” */
.chat-previews-list {
	position: absolute;
	bottom: 85px;
	right: 15px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: 340px;
	pointer-events: none;
	opacity: 1;
	transition: opacity 0.3s;
	&.hidden { opacity: 0; }

	.chat-preview-item {
		background-color: rgba(18, 18, 20, 0.95);
		backdrop-filter: blur(10px);
		border-left: 3px solid #3b82f6;
		border-top: 1px solid #27272a;
		border-right: 1px solid #27272a;
		border-bottom: 1px solid #27272a;
		padding: 10px 16px;
		border-radius: 10px;
		display: flex;
		flex-direction: column; /* Stack name and text for better vertical growth */
		gap: 2px;
		height: auto;
		min-height: 40px;
		max-height: 120px; /* Prevent wall-of-text from covering screen */
		overflow: hidden;
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
		animation: slide-in-preview 0.3s cubic-bezier(0.19, 1, 0.22, 1) both;

		.preview-top-row {
			display: flex;
			align-items: center;
			gap: 6px;
			margin-bottom: 2px;
		}

		.preview-sender {
			font-size: 10px;
			font-weight: 900;
			text-transform: uppercase;
		}

		.preview-count {
			font-size: 9px;
			font-weight: 800;
			background-color: rgba(255, 255, 255, 0.12);
			padding: 1px 5px;
			border-radius: 4px;
		}

		.preview-text {
			font-size: 13px;
			color: #f4f4f5;
			line-height: 18px;
			word-break: break-all;
			white-space: nowrap;
			text-overflow: ellipsis;
		}
	}
}

/* â”â”â” TOGGLE BUBBLE â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â” */
.chat-bubble {
	position: absolute;
	bottom: 15px;
	right: 15px;
	width: 56px;
	height: 56px;
	background: #3b82f6;
	border-radius: 18px;
	display: flex;
	justify-content: center;
	align-items: center;
	pointer-events: all;
	cursor: pointer;
	box-shadow: 0 8px 0 #1d4ed8;
	transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
	border: none;

	&:hover {
		background-color: #60a5fa;
		transform: translateY(-2px);
		box-shadow: 0 10px 0 #1d4ed8;
	}

	&.is-open {
		background: #18181b;
		transform: rotate(90deg);
		box-shadow: 0 6px 0 #09090b;
		border: 1px solid #3f3f46;
	}

	.chat-bubble-icon {
		font-size: 24px;
		color: white;
	}

	.chat-bubble-icon .ui-icon {
		width: 24px;
		height: 24px;
		line-height: 24px;
		font-size: 23px;
		padding: 0;
	}

	.chat-badge {
		position: absolute;
		top: -4px; right: -4px;
		width: 14px; height: 14px;
		background-color: #ef4444;
		border-radius: 50%;
		border: 2px solid #1e1e22;
		animation: pulse-badge 1.5s infinite;
	}
}

/* â”â”â” ANIMATIONS â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â” */
@keyframes slide-in-chat {
	from { opacity: 0; transform: translateX(10px); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-preview {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-badge {
	0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
	70% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
	100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
