@if (_isMinimized)
{
    <div class="minimized-dock">
        <LevelMeterFab OnClick="@ToggleMinimized" />
    </div>
}
else
{
    <div class="@PlayerModeClass d-flex flex-column" @ref="_playerRoot">
        <MudContainer MaxWidth="MaxWidth.Large" Class="player-inner-container">
            <MudPaper Elevation="8" Class="player-surface pa-3">

                <div class="player-layout">
                    <PlayerTransportZone IsLoaded="IsLoaded"
                                         CanPlay="CanPlay"
                                         IsLoading="IsLoading"
                                         IsStreaming="IsStreaming"
                                         LoadProgress="LoadProgress"
                                         DisplayTime="DisplayTime"
                                         Duration="Duration"
                                         Fixed="Fixed"
                                         TogglePlayPause="@TogglePlayPause"
                                         Stop="@Stop"
                                         Class="transport-zone"/>

                    <VolumeZone Volume="@Volume" VolumeChanged="@OnVolumeChange"/>

                    <div class="meta-zone">
                        <TrackMetaLabel Track="CurrentTrack"/>
                    </div>

                    <PlayerSeekZone OnSeekStart="@OnSeekStart"
                                    OnSeekEnd="@OnSeekEnd"
                                    OnSeekChange="@OnSeekChange"
                                    Class="seek-zone"/>
                </div>

                @* Minimize / close — positioned absolutely top-right *@
                @if (!Fixed)
                {
                    <PlayerWindowControls OnMinimize="@ToggleMinimized" OnClose="@Close"/>
                }
            </MudPaper>
        </MudContainer>
            
        @if (!string.IsNullOrEmpty(ErrorMessage))
        {
            <MudAlert Severity="Severity.Error" 
                      ShowCloseIcon="true" 
                      CloseIconClicked="ClearError" 
                      Class="ma-2">
                @ErrorMessage
            </MudAlert>
        }
    </div>
}
