/*
 * Copyright (C) 2026 Fluxer Contributors
 *
 * This file is part of Fluxer.
 *
 * Fluxer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Fluxer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
 */

.container {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	height: 100%;
	min-height: 0;
}

.header {
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
}

.title {
	margin: 0 0 0.5rem;
	font-weight: 600;
	font-size: 1.25rem;
	line-height: 1.75rem;
}

.subtitle {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--text-primary-muted);
}

.searchContainer {
	flex-shrink: 0;
}

.searchInput {
	width: 100%;
}

.controls {
	flex-shrink: 0;
}

.scrollContainer {
	display: flex;
	flex-direction: column;
}

.memberList {
	display: flex;
	flex-direction: column;
	padding-bottom: 1rem;
}

.memberGroup {
	overflow: hidden;
	border-radius: 0.75rem;
	background-color: var(--background-secondary-alt);
}

.memberTable {
	display: flex;
	flex-direction: column;
	padding-bottom: 1rem;
}

.memberRow {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.875rem 1rem;
	border-radius: 0.5rem;
	background-color: var(--background-secondary-alt);
	margin-bottom: 0.5rem;
	cursor: pointer;
	transition: background-color 0.15s;
	-webkit-tap-highlight-color: transparent;
	border: none;
	text-align: left;
}

.memberRow:last-child {
	margin-bottom: 0;
}

@media (hover: hover) and (pointer: fine) {
	.memberRow:hover {
		background-color: var(--background-modifier-hover);
	}

	.memberRow:active {
		background-color: var(--background-modifier-active);
	}
}

.memberItemWrapper {
	display: contents;
}

.memberItem {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.875rem 1rem;
	text-align: left;
	transition: background-color 0.15s;
	-webkit-tap-highlight-color: transparent;
	user-select: none;

	border: none;
	background: transparent;
	font: inherit;
	color: inherit;
}

.memberItemInteractive {
	cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
	.memberItemInteractive:hover {
		background-color: var(--background-modifier-hover);
	}

	.memberItemInteractive:active {
		background-color: var(--background-modifier-active);
	}
}

.memberItemPressed {
	background-color: var(--background-modifier-hover);
}

.memberContent,
.memberMain {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
	flex: 1;
}

.avatarWrapper {
	flex-shrink: 0;
}

.avatar {
	height: 2.5rem;
	width: 2.5rem;
	border-radius: 9999px;
	object-fit: cover;
	flex-shrink: 0;
}

.avatarPlaceholder {
	display: flex;
	height: 2.5rem;
	width: 2.5rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background-color: var(--background-header-secondary);
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1;
	color: var(--text-primary);
	flex-shrink: 0;
}

.memberInfo {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	min-width: 0;
	flex: 1;
}

.nameRow {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	min-width: 0;
}

.displayName {
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.3;
	color: var(--text-primary);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ownerIcon {
	height: 1rem;
	width: 1rem;
	flex-shrink: 0;
	color: var(--status-idle);
}

.tag {
	font-size: 0.8125rem;
	color: var(--text-tertiary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.memberRoles {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem;
	flex-shrink: 0;
	max-width: 50%;
}

.memberActions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-shrink: 0;
	gap: 0.5rem;
}

.moreButton {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.375rem;
	border: none;
	border-radius: 0.375rem;
	background: transparent;
	color: var(--text-tertiary);
	cursor: pointer;
	transition:
		background-color 150ms ease,
		color 150ms ease;
}

.moreButton:hover,
.moreButtonActive {
	background-color: var(--background-modifier-hover);
	color: var(--text-primary);
}

.moreButtonIcon {
	height: 1.25rem;
	width: 1.25rem;
}

.chevron {
	flex-shrink: 0;
	color: var(--text-tertiary);
}

.divider {
	margin-left: 1rem;
	margin-right: 1rem;
	height: 1px;
	background-color: var(--background-header-secondary);
	opacity: 0.3;
}

.loadingContainer {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 3rem 0;
	flex: 1;
}

.loadingText {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--text-primary-muted);
}

.notice,
.emptyState {
	border-radius: 0.75rem;
	background-color: var(--background-secondary-alt);
	padding: 1.5rem;
}

.noticeText,
.emptyStateText {
	margin: 0;
	text-align: center;
	color: var(--text-primary-muted);
}

@media (min-width: 768px) {
	.memberItem,
	.memberRow {
		padding: 0.75rem 1rem;
	}

	.memberRoles {
		max-width: none;
	}
}

@media (max-width: 767px) {
	.memberItem,
	.memberRow {
		padding: 1rem;
	}

	.displayName {
		font-size: 1rem;
	}

	.tag {
		font-size: 0.875rem;
	}
}
