/*
 * 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/>.
 */

.voiceConnectionContainer {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-3);
	margin: 0;
	padding: var(--voice-connection-padding-y) var(--user-area-padding-x);
	background-color: transparent;
	border: none;
	width: 100%;
	min-width: 0;
	flex-shrink: 0;
}

.statusRow {
	display: flex;
	align-items: center;
	gap: var(--spacing-2);
	min-width: 0;
}

.channelAvatarStack {
	display: flex;
	align-items: center;
	min-width: 0;
	flex-shrink: 1;
	align-self: flex-start;
}

.signalIcon {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 24px;
	width: 24px;
	color: var(--text-tertiary);
	flex-shrink: 0;
}

.statusButton {
	cursor: pointer;
	border: none;
	background: transparent;
	padding: 0;
	text-align: left;
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1.125rem;
	color: var(--text-primary);
	user-select: none;
	-webkit-user-select: none;
	flex: 1;
	min-width: 0;
}

.statusConnected {
	color: var(--status-online);
}

.statusConnecting {
	color: var(--status-idle);
}

.statusDisconnected {
	color: var(--status-danger);
}

.controls {
	display: flex;
	align-items: center;
	gap: var(--spacing-2);
	flex-shrink: 0;
}

.controlButton {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 32px;
	width: 32px;
	background-color: transparent;
	color: var(--control-button-normal-text);
	border: none;
	border-radius: var(--radius-md);
	cursor: pointer;
	position: relative;
	padding: 0;
	flex-shrink: 0;
}

.controlButton:hover {
	background-color: color-mix(in srgb, var(--control-button-normal-text) 10%, transparent);
	color: var(--control-button-hover-text);
}

.controlButton.selected {
	background-color: var(--background-modifier-selected);
	color: var(--surface-interactive-selected-color);
}

.controlButton.selected:hover {
	background-color: color-mix(in srgb, var(--text-primary) 12%, transparent);
	color: var(--surface-interactive-selected-color);
}

.icon {
	height: 20px;
	width: 20px;
}

.connectionInfo {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-2);
}

.channelSourceRow {
	display: flex;
	align-items: center;
	min-width: 0;
}

.channelSourceLink {
	display: inline-flex;
	align-items: center;
	min-width: 0;
	max-width: 100%;
	border: none;
	background: transparent;
	padding: 0;
	font-size: 0.75rem;
	line-height: 1rem;
	color: var(--text-secondary);
	text-decoration: none;
	text-decoration-color: currentColor;
	cursor: pointer;
}

.channelSourceLink:visited {
	color: var(--text-secondary);
}

.channelSourceLink:hover {
	color: var(--text-secondary);
	text-decoration: underline;
	text-decoration-color: currentColor;
}

.channelSourceLink:active {
	color: var(--text-secondary);
}

.channelSourceText {
	display: inline-flex;
	align-items: center;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: inherit;
}

.channelSourceChannel {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	color: inherit;
}

.channelSourceSeparator {
	margin: 0 2px;
	flex-shrink: 0;
	color: inherit;
}

.channelSourceGuild {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: inherit;
}

.connectionIdRow {
	display: flex;
	align-items: center;
	gap: var(--spacing-2);
	min-width: 0;
	font-size: 0.75rem;
	line-height: 1rem;
	color: var(--text-secondary);
}

.connectionIdValue {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
}

.connectionIdValueText {
	display: inline-block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.connectionIdIcon {
	height: 16px;
	width: 16px;
	color: var(--text-tertiary);
	flex-shrink: 0;
}

.mediaSection {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--spacing-1);
}

.mediaButton {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 32px;
	width: 100%;
	background-color: color-mix(in srgb, var(--background-modifier-hover) 70%, transparent);
	color: var(--control-button-normal-text);
	border: 1px solid var(--background-modifier-hover);
	border-radius: var(--radius-md);
	cursor: pointer;
	position: relative;
	padding: 0;
}

.mediaButton:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--control-button-normal-text) 10%, transparent);
	color: var(--control-button-hover-text);
	border-color: var(--background-modifier-selected);
}

.mediaButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.mediaButton.cameraActive,
.mediaButton.screenShareActive {
	background-color: color-mix(in srgb, var(--status-online) 15%, transparent);
	color: var(--status-online);
	border-color: color-mix(in srgb, var(--status-online) 30%, transparent);
}

.mediaButton.cameraActive:hover:not(:disabled),
.mediaButton.screenShareActive:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--status-online) 20%, transparent);
	color: var(--status-online);
}

.mediaIcon {
	height: 20px;
	width: 20px;
}

.popoutContainer {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-3);
	width: calc(var(--layout-sidebar-width) - 16px);
	box-sizing: border-box;
	padding: var(--spacing-3);
	background-color: var(--voice-surface-2);
	border: 1px solid var(--voice-surface-5);
	border-radius: var(--radius-md);
}

.popoutHeader {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-1);
}

.popoutTitle {
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--text-primary);
}

.popoutCloseButton {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 24px;
	width: 24px;
	background-color: transparent;
	color: var(--text-primary-muted);
	border: none;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition:
		background-color var(--transition-fast),
		color var(--transition-fast);
	padding: 0;
}

.popoutCloseButton:hover {
	background-color: var(--background-modifier-hover);
	color: var(--text-primary);
}

.popoutStats {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-1);
}

.popoutStatRow {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: var(--spacing-2);
}

.popoutStatLabel {
	font-size: 0.75rem;
	color: var(--text-secondary);
}

.popoutStatValue {
	font-weight: 600;
	font-size: 0.75rem;
	color: var(--text-primary);
	margin-left: auto;
}

.deviceBadge {
	display: flex;
	align-items: center;
	gap: var(--spacing-1);
	min-width: 0;
	justify-content: flex-end;
	flex: 1 1 auto;
}

.deviceBadgeText {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
	font-size: 0.75rem;
	color: var(--text-primary);
}

.endpointBadge {
	display: flex;
	align-items: center;
	gap: var(--spacing-1);
	min-width: 0;
	justify-content: flex-end;
	flex: 1 1 auto;
	max-width: 100%;
	cursor: pointer;
	padding: 2px 4px;
	border-radius: var(--radius-sm);
}

.endpointBadgeText {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 700;
	font-size: 0.75rem;
	color: var(--status-online);
	min-width: 0;
	max-width: 100%;
	text-align: right;
}

.chartContainer {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.chartSvg {
	overflow: visible;
	width: 100%;
}

.gridLine {
	stroke: currentColor;
	stroke-width: 1px;
}

.gridLineHorizontal {
	opacity: 0.3;
}

.gridLineVertical {
	stroke-width: 1px;
}

.gridText {
	fill: var(--text-tertiary);
	font-size: 10px;
	text-anchor: end;
	dominant-baseline: middle;
}

.chartLine {
	stroke: currentColor;
	stroke-width: 2px;
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.chartPoint {
	fill: currentColor;
}

.textGreen {
	color: var(--voice-status-success);
}

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

.textTextTertiary {
	fill: var(--text-tertiary);
}

.flexShrink0 {
	flex-shrink: 0;
}

.iconSmall {
	height: 16px;
	width: 16px;
}

.deviceIcon {
	height: 14px;
	width: 14px;
	flex-shrink: 0;
}

.lockIcon {
	height: 12px;
	width: 12px;
	flex-shrink: 0;
	color: var(--status-online);
}

.regionSelectorContainer {
	position: relative;
	margin-left: auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.regionButton {
	display: flex;
	align-items: center;
	gap: var(--spacing-1);
	padding: 4px 8px;
	background-color: var(--background-secondary);
	border: 1px solid var(--background-modifier-hover);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition:
		background-color var(--transition-fast),
		border-color var(--transition-fast);
	font-size: 0.75rem;
	color: var(--text-primary);
}

.regionButton:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
	border-color: var(--background-modifier-selected);
}

.regionButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.regionIcon {
	height: 14px;
	width: 14px;
	color: var(--text-secondary);
	flex-shrink: 0;
}

.regionButtonText {
	font-weight: 600;
	color: var(--text-primary);
	white-space: nowrap;
}

.regionCaret {
	height: 12px;
	width: 12px;
	color: var(--text-secondary);
	flex-shrink: 0;
	transition: transform var(--transition-fast);
}

.regionCaretOpen {
	transform: rotate(180deg);
}

.regionDropdown {
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 4px;
	min-width: 160px;
	max-height: 200px;
	overflow-y: auto;
	background-color: var(--background-tertiary);
	border: 1px solid var(--background-modifier-hover);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	z-index: 100;
	display: flex;
	flex-direction: column;
	padding: 4px;
}

.regionOption {
	display: flex;
	align-items: center;
	gap: var(--spacing-2);
	padding: 8px 12px;
	background-color: transparent;
	border: none;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: background-color var(--transition-fast);
	font-size: 0.875rem;
	color: var(--text-primary);
	text-align: left;
	width: 100%;
}

.regionOption:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
}

.regionOption:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.regionOptionSelected {
	background-color: var(--background-modifier-selected);
}

.regionOptionSelected:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--background-modifier-selected) 80%, var(--background-modifier-hover));
}

.regionEmoji {
	font-size: 1rem;
	flex-shrink: 0;
}

.regionName {
	font-weight: 500;
	white-space: nowrap;
}
