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

/* Desktop styles */
.container {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-2);
	padding: var(--spacing-3);
	background-color: var(--background-secondary);
	border: 1px solid var(--background-modifier-accent);
	border-radius: var(--radius-lg);
	max-width: 400px;
	width: 100%;
}

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

.playButton {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	padding: 0;
	border: none;
	background-color: var(--brand-primary);
	border-radius: var(--radius-full);
	color: var(--text-on-brand-primary);
	cursor: pointer;
	transition:
		filter 150ms ease,
		transform 150ms ease;
}

.playButton:hover {
	filter: brightness(1.1);
}

.playButton:active {
	transform: scale(0.95);
}

.playButtonIcon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.loadingSpinnerDesktop {
	position: absolute;
	inset: -3px;
	border-radius: var(--radius-full);
	border: 2px solid transparent;
	border-top-color: var(--text-on-brand-primary);
	animation: spin 0.8s linear infinite;
	pointer-events: none;
}

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

.fileName {
	display: flex;
	align-items: baseline;
	gap: 0;
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--text-primary);
	line-height: 1.3;
}

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

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

.fileMeta {
	margin: 0;
	font-size: 12px;
	color: var(--text-tertiary);
}

.progressSection {
	display: flex;
	align-items: center;
	gap: var(--spacing-2);
	min-width: 240px;
}

.progressBar {
	flex: 1;
	min-width: 120px;
}

.time {
	font-family: var(--font-mono, monospace);
	font-size: 11px;
	line-height: 1;
	color: var(--text-tertiary);
	white-space: nowrap;
	min-width: 70px;
	text-align: right;
}

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

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

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

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

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

.volumeControl button:hover {
	color: var(--text-primary);
}

.actionButton {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
	border-radius: var(--radius-sm);
	transition:
		color 150ms ease,
		background-color 150ms ease;
}

.actionButton:hover {
	color: var(--text-primary);
	background-color: var(--background-tertiary);
}

/* Mobile styles */
.mobileContainer {
	display: flex;
	align-items: center;
	gap: var(--spacing-3);
	padding: var(--spacing-2) var(--spacing-3);
	border-radius: var(--radius-2xl);
	background-color: var(--background-secondary);
	min-width: 200px;
}

.mobilePlayButton {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border: none;
	border-radius: var(--radius-full);
	background-color: var(--brand-primary);
	color: var(--text-on-brand-primary);
	cursor: pointer;
}

.loadingSpinner {
	position: absolute;
	inset: -3px;
	border-radius: var(--radius-full);
	border: 2px solid transparent;
	border-top-color: var(--text-on-brand-primary);
	animation: spin 0.8s linear infinite;
	pointer-events: none;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.mobileContent {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--spacing-1);
}

.mobileFileInfo {
	display: flex;
	align-items: baseline;
	font-size: var(--font-size-xs);
	line-height: 1.3;
	color: var(--text-primary);
}

.mobileFileName {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 500;
}

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

.mobileContainerActive .mobileFileMeta {
	color: color-mix(in srgb, var(--text-on-brand-primary) 70%, transparent);
}

.mobileProgressContainer {
	display: flex;
	align-items: center;
	height: 12px;
	cursor: pointer;
}

.mobileProgressTrack {
	position: relative;
	width: 100%;
	height: 4px;
	background-color: var(--text-tertiary);
	border-radius: var(--radius-sm);
	overflow: hidden;
}

.mobileProgressTrackActive {
	background-color: color-mix(in srgb, var(--text-on-brand-primary) 40%, transparent);
}

.mobileProgressFill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background-color: var(--brand-primary);
	border-radius: var(--radius-sm);
	transition: width 50ms linear;
}

.mobileProgressFillActive {
	background-color: var(--text-on-brand-primary);
}

.mobileTimestamp {
	flex-shrink: 0;
	font-size: 12px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--text-secondary);
	min-width: 32px;
	text-align: right;
}
