/* The group chat page: its header, the timeline (people, agents, events), @ completion and the members dialog. */

.gchat-head {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 64px 4px;
}

.gchat-menu {
	display: none;
}

.gchat-title {
	overflow: hidden;
	max-width: min(480px, 60vw);
	padding: 5px 14px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: none;
	color: var(--text-strong);
	font: inherit;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.gchat-title:hover {
	border-color: var(--border);
	background: var(--surface-2);
}

.gchat-members {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 5px;
	padding: 4px 10px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--sb-card-bg);
	color: var(--muted);
	font: inherit;
	font-size: calc(13px * var(--ui-scale));
	cursor: pointer;
}

.gchat-members:hover {
	color: var(--text-strong);
	background: var(--surface-2);
}

@media (max-width: 767px) {
	.gchat-head {
		justify-content: flex-start;
		padding: 8px 52px 4px 8px;
	}

	.gchat-menu {
		display: inline-flex;
	}

	.gchat-title {
		flex: 1;
		max-width: none;
		background: var(--surface-2);
		text-align: center;
	}
}

.gchat-empty {
	margin: 48px 0;
	color: var(--faint);
	text-align: center;
}

/* ---- the timeline ---- */

.gmsg-day,
.gmsg-system {
	display: flex;
	justify-content: center;
	margin: 6px 0 18px;
	font-size: calc(12px * var(--ui-scale));
	color: var(--faint);
	text-align: center;
}

.gmsg-day span {
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--surface-2);
}

.gmsg-system span {
	max-width: 85%;
}

.msg-time {
	font-size: calc(11px * var(--ui-scale));
	color: var(--faint);
}

.msg-reply-to {
	font-size: calc(11px * var(--ui-scale));
	color: var(--faint);
}

/* someone else's message: on the left, in a bubble */
.msg-other {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.msg-other .msg-files {
	justify-content: flex-start;
}

.msg-other .msg-bubble {
	border: 1px solid var(--bubble-ai-border);
	background: var(--bubble-ai);
}

.mention {
	color: #2563eb;
	font-weight: 500;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .mention {
		color: #7aa7ff;
	}
}

:root[data-theme="dark"] .mention {
	color: #7aa7ff;
}

.file-media {
	display: block;
	max-width: min(360px, 100%);
	max-height: 240px;
	border-radius: 12px;
	background: #000;
}

.file-audio {
	max-width: min(320px, 100%);
}

/* ---- composer extras ---- */

.gchat-replying {
	margin: 0 0 6px 14px;
	overflow-wrap: anywhere; /* a long agent name without spaces */
	font-size: calc(12px * var(--ui-scale));
	color: var(--muted);
}

.gchat-replying::after {
	content: "…";
}

.mention-pop {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 12px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	min-width: 220px;
	max-width: calc(100% - 24px);
	padding: 4px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	box-shadow: var(--menu-shadow);
}

.mention-pop[hidden] {
	display: none;
}

.mention-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--text);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.mention-item.is-active,
.mention-item:hover {
	background: var(--surface-2);
}

/* ---- the members dialog ---- */

.gm-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-height: 40vh;
	margin: 0 0 16px;
	padding: 0;
	overflow-y: auto;
	list-style: none;
}

.gm-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 4px;
}

.gm-name {
	font-weight: 500;
}

.gm-user {
	font-size: calc(12px * var(--ui-scale));
	color: var(--faint);
}

.gm-section {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 18px;
}

.gm-invite {
	display: flex;
	gap: 8px;
}

.gm-invite .btn {
	flex: none;
	margin: 0;
}

.gm-actions {
	align-items: center;
}

.gm-leave {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--danger);
}
