/*
 * 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;
	align-items: center;
	gap: var(--spacing-2);
	padding: var(--spacing-1) var(--spacing-2);
	border-radius: var(--radius-2xl);
	background-color: var(--background-secondary);
	border: 1px solid var(--background-modifier-accent);
	max-width: 300px;
	min-width: 200px;
}

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

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

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

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

.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);
	}
}

.waveformContainer {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 1px;
	height: 20px;
	cursor: pointer;
	overflow: hidden;
	min-width: 0;
}

.waveformBar {
	flex: 1;
	min-width: 1.5px;
	background-color: var(--text-tertiary);
	border-radius: var(--radius-sm);
	transition: background-color 0.15s ease;
}

.waveformBarPast {
	background-color: var(--brand-primary-light);
}

:global(.theme-light) .waveformBarPast {
	background-color: var(--brand-primary);
}

.timestamp {
	flex-shrink: 0;
	font-size: 11px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--text-secondary);
	text-align: right;
}

.speedControl {
	flex-shrink: 0;
}

.containerActive .speedControl {
	color: color-mix(in srgb, var(--text-on-brand-primary) 90%, transparent);
}

.containerActive .speedControl:hover {
	background-color: color-mix(in srgb, var(--text-on-brand-primary) 15%, transparent);
}

.volumeControl {
	flex-shrink: 0;
}

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

.containerActive .volumeControl button:hover {
	color: var(--text-on-brand-primary);
	background-color: color-mix(in srgb, var(--text-on-brand-primary) 15%, transparent);
}
