<UserControl x:Class="NexusShell.Views.NexusDesktopView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:controls="clr-namespace:NexusShell.Controls"
             xmlns:converters="clr-namespace:NexusShell.Converters">
    <UserControl.Resources>
        <converters:BoolToVisibilityConverter x:Key="BoolToVisibility"/>
    </UserControl.Resources>
    <Grid ClipToBounds="False">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Light-theme default desktop gradient -->
        <Rectangle Grid.RowSpan="2" IsHitTestVisible="False"
                   Visibility="{Binding UseLightDesktopBackground, Converter={StaticResource BoolToVisibility}}">
            <Rectangle.Fill>
                <DynamicResource ResourceKey="NexusDesktopBackgroundBrush"/>
            </Rectangle.Fill>
        </Rectangle>

        <!-- Custom or dark bundled wallpaper -->
        <Image Grid.RowSpan="2"
               Source="{Binding WallpaperSource}"
               Stretch="UniformToFill"
               RenderOptions.BitmapScalingMode="HighQuality"
               Visibility="{Binding ShowWallpaperImage, Converter={StaticResource BoolToVisibility}}"/>

        <!-- Subtle horizon glow for light desktop -->
        <Rectangle Grid.RowSpan="2" IsHitTestVisible="False" Opacity="0.55"
                   Visibility="{Binding ShowDesktopBrand, Converter={StaticResource BoolToVisibility}}">
            <Rectangle.Fill>
                <DynamicResource ResourceKey="NexusHorizonGlowBrush"/>
            </Rectangle.Fill>
        </Rectangle>

        <!-- Central brand — light theme default desktop -->
        <StackPanel Grid.RowSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center"
                    Visibility="{Binding ShowDesktopBrand, Converter={StaticResource BoolToVisibility}}">
            <Viewbox MaxWidth="120" MaxHeight="120" Margin="0,0,0,16">
                <Image Source="{Binding LogoLargeUri}" RenderOptions.BitmapScalingMode="HighQuality"/>
            </Viewbox>
            <TextBlock Text="NINJA NEXUS" FontSize="28" FontWeight="Bold"
                       Foreground="{DynamicResource NexusTextPrimaryBrush}"
                       HorizontalAlignment="Center" Margin="0,0,0,6"/>
            <TextBlock Text="ÉT SYSTEM. ALT FORBUNDET." FontSize="12" FontWeight="Medium"
                       Foreground="{DynamicResource NexusTextSecondaryBrush}"
                       HorizontalAlignment="Center" Opacity="0.85"/>
        </StackPanel>

        <!-- Subtle bottom fade so dock chrome stays readable -->
        <Rectangle Grid.RowSpan="2" IsHitTestVisible="False">
            <Rectangle.Fill>
                <DynamicResource ResourceKey="NexusDesktopVignetteBrush"/>
            </Rectangle.Fill>
        </Rectangle>

        <controls:NexusTopStatusBar Grid.Row="0"
                                    DataContext="{Binding}"
                                    Panel.ZIndex="20"/>

        <Grid Grid.Row="1" VerticalAlignment="Bottom" ClipToBounds="False">
            <controls:NexusWorkspaceTaskbar DataContext="{Binding}"
                                            VerticalAlignment="Bottom"/>
            <controls:NexusBottomDock DataContext="{Binding}"
                                      HorizontalAlignment="Stretch"
                                      VerticalAlignment="Bottom"/>
        </Grid>
    </Grid>
</UserControl>
