/*
 * 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;
	height: 100%;
	flex-direction: column;
}

.header {
	padding: 1rem 2rem;
}

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

.description {
	margin-top: 0.5rem;
	font-size: 0.875rem;
	color: var(--text-secondary);
}

.scrollContainer {
	flex: 1;
	overflow: hidden;
}

.scrollerPadding {
	padding-left: 2rem;
	padding-right: 2rem;
}

.appList {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-bottom: 1rem;
}

.appCard {
	display: flex;
	flex-direction: column;
	border-radius: var(--radius-xl);
	border: 1px solid var(--background-modifier-accent);
	background-color: var(--background-textarea);
	overflow: hidden;
}

.headerButton {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: var(--input-container-min-height);
	padding: 0 var(--input-container-padding);
	background: transparent;
	border: none;
	cursor: pointer;
	text-align: left;
	transition: background-color var(--transition-fast);
}

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

.headerButton:focus-visible {
	background-color: var(--background-modifier-hover);
	outline: 2px solid var(--brand-primary);
	outline-offset: -2px;
}

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

.appAvatar {
	height: 32px;
	width: 32px;
	flex-shrink: 0;
	border-radius: 9999px;
	background-color: var(--background-tertiary);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.appAvatarImage {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.appAvatarPlaceholder {
	width: 18px;
	height: 18px;
	color: var(--text-muted);
}

.textBlock {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}

.titleRow {
	display: flex;
	align-items: center;
	gap: var(--spacing-1);
}

.appName {
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1.125rem;
	color: var(--text-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

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

.metaText {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chevron {
	width: 20px;
	height: 20px;
	color: var(--text-tertiary);
	flex-shrink: 0;
	transition: transform var(--transition-fast);
}

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

.loadingContainer {
	display: flex;
	height: 100%;
	align-items: center;
	justify-content: center;
}

.errorContainer {
	display: flex;
	height: 100%;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 2rem;
	text-align: center;
}

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

.details {
	border-top: 1px solid var(--background-modifier-accent);
	padding: var(--spacing-3) var(--input-container-padding);
	display: flex;
	flex-direction: column;
	gap: var(--spacing-3);
}

.detailsRow {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-3);
}

@media (min-width: 768px) {
	.detailsRow {
		flex-direction: row;
		align-items: flex-start;
		justify-content: space-between;
		gap: var(--spacing-4);
	}
}

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

.sectionLabel {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

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

.scopeTag {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: var(--spacing-2);
	border-radius: var(--radius-lg);
	border: 1px solid var(--background-modifier-accent);
	background-color: var(--background-tertiary);
}

.scopeName {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--text-primary);
	font-family: var(--font-mono);
}

.scopeDescription {
	font-size: 0.82rem;
	color: var(--text-secondary);
	line-height: 1.4;
}

.actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--spacing-2);
	align-self: flex-end;
}

.actions > :global(button) {
	white-space: nowrap;
}
