@namespace DeepDrftPublic.Client.Controls.AudioPlayerBar

<MudStack Row="false" AlignItems="AlignItems.Center" Spacing="1" Class="@Class">
    <MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
        <PlayerControls IsLoaded="IsLoaded"
                        CanPlay="CanPlay"
                        Fixed="Fixed"
                        TogglePlayPause="TogglePlayPause"
                        Stop="Stop"
                        HasNext="HasNext"
                        HasPrevious="HasPrevious"
                        SkipNext="SkipNext"
                        SkipPrevious="SkipPrevious"/>
        @if (IsLoading && !IsStreaming)
        {
            <MudProgressCircular Color="Color.Tertiary"
                                 Size="Size.Small"
                                 Max="1D"
                                 Value="@LoadProgress"
                                 Indeterminate="@(LoadProgress == 0)"/>
        }
    </MudStack>
    @* Queue toggle: a second row between the transport controls and the timestamp (§3.1 placement —
       "below the control buttons, to the left of the timestamps"). Shown only when a queue is loaded,
       mirroring the skip-affordance gating, so an empty/single-track player is byte-for-byte unchanged. *@
    <MudStack Row AlignItems="AlignItems.Center">
        <TimestampLabel CurrentTime="DisplayTime" Duration="@Duration"/>
        @if (ShowQueueButton)
        {
            <MudTooltip Text="Queue">
                <MudIconButton Icon="@Icons.Material.Filled.QueueMusic"
                               Color="Color.Primary"
                               Size="Size.Medium"
                               OnClick="QueueToggle"
                               aria-label="Queue"
                               aria-expanded="@QueueOpen"
                               Class="@($"deepdrft-queue-toggle{(QueueOpen ? " deepdrft-queue-toggle-active" : "")}")"/>
            </MudTooltip>
        }
    </MudStack>
</MudStack>
