<Window x:Class="PSLauncher.App.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:PSLauncher.App.ViewModels"
        xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
        Title="PROSERVE Launcher"
        Background="Black"
        Width="1280" Height="720"
        MinWidth="980" MinHeight="600"
        WindowStartupLocation="CenterScreen"
        WindowStyle="None"
        ResizeMode="CanResize"
        AllowsTransparency="False"
        d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        mc:Ignorable="d"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">

    <shell:WindowChrome.WindowChrome>
        <shell:WindowChrome CaptionHeight="56"
                            GlassFrameThickness="0"
                            CornerRadius="0"
                            ResizeBorderThickness="6"
                            UseAeroCaptionButtons="False" />
    </shell:WindowChrome.WindowChrome>

    <Window.Resources>

        <!-- =================== TEMPLATE : LIGNE COMPACTE (autres versions) =================== -->
        <DataTemplate x:Key="CompactRowTemplate" DataType="{x:Type vm:VersionRowViewModel}">
            <Border Margin="0,0,0,8" CornerRadius="6" BorderThickness="1">
                <Border.Style>
                    <Style TargetType="Border">
                        <Setter Property="Background" Value="{StaticResource Brush.Bg.Card}" />
                        <Setter Property="BorderBrush" Value="{StaticResource Brush.Border}" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsRemoteOnly}" Value="True">
                                <Setter Property="Background" Value="{StaticResource Brush.Status.AvailableBg}" />
                                <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Available}" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsBusy}" Value="True">
                                <Setter Property="Background" Value="{StaticResource Brush.Status.BusyBg}" />
                                <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Busy}" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Border.Style>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="4" />     <!-- accent strip -->
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <!-- Strip latérale colorée -->
                    <Rectangle Grid.Column="0" RadiusX="2" RadiusY="2" Margin="0,8">
                        <Rectangle.Style>
                            <Style TargetType="Rectangle">
                                <Setter Property="Fill" Value="{StaticResource Brush.Status.Installed}" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsRemoteOnly}" Value="True">
                                        <Setter Property="Fill" Value="{StaticResource Brush.Status.Available}" />
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding IsBusy}" Value="True">
                                        <Setter Property="Fill" Value="{StaticResource Brush.Status.Busy}" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Rectangle.Style>
                    </Rectangle>

                    <Grid Grid.Column="1" Margin="16,12">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <StackPanel Grid.Row="0" Orientation="Horizontal">
                            <TextBlock Text="{Binding Version, StringFormat='v{0}'}"
                                       FontSize="15" FontWeight="SemiBold"
                                       VerticalAlignment="Center"
                                       Foreground="{StaticResource Brush.Text.Primary}" />
                            <Border CornerRadius="10" Padding="8,3" Margin="12,0,0,0"
                                    VerticalAlignment="Center">
                                <Border.Style>
                                    <Style TargetType="Border">
                                        <Setter Property="Background" Value="{StaticResource Brush.Status.Installed}" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding IsRemoteOnly}" Value="True">
                                                <Setter Property="Background" Value="{StaticResource Brush.Status.Available}" />
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding IsBusy}" Value="True">
                                                <Setter Property="Background" Value="{StaticResource Brush.Status.Busy}" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Border.Style>
                                <TextBlock Text="{Binding StateLabel}" FontSize="11" FontWeight="SemiBold"
                                           Foreground="White" />
                            </Border>
                        </StackPanel>
                        <TextBlock Grid.Row="1" FontSize="11"
                                   Foreground="{StaticResource Brush.Text.Secondary}"
                                   Margin="0,4,0,0">
                            <Run Text="{Binding SizeDisplay, Mode=OneWay}" />
                            <Run Text=" • " />
                            <Run Text="{Binding PrimaryDate, Mode=OneWay}" />
                        </TextBlock>
                    </Grid>

                    <!-- Action button -->
                    <StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0,0,0">
                        <Button Style="{StaticResource PrimaryButton}"
                                Content="▶  Lancer" Padding="22,8" FontSize="13"
                                Command="{Binding LaunchCommand}"
                                Visibility="{Binding IsInstalled, Converter={StaticResource BoolToVisibility}}" />
                        <Button Style="{StaticResource AccentButton}"
                                Content="{Binding InstallButtonLabel}" Padding="22,8" FontSize="13"
                                Command="{Binding InstallCommand}"
                                Visibility="{Binding IsRemoteOnly, Converter={StaticResource BoolToVisibility}}" />
                        <StackPanel Orientation="Horizontal"
                                    Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibility}}">
                            <ProgressBar Width="140" Height="6"
                                         Value="{Binding ProgressPercent}" Maximum="100"
                                         Foreground="{StaticResource Brush.Status.Busy}"
                                         Background="#2A2A30" BorderThickness="0"
                                         VerticalAlignment="Center" />
                            <TextBlock Text="{Binding ProgressPercent, StringFormat={}{0:0}%}"
                                       FontSize="11" Margin="8,0,0,0" VerticalAlignment="Center"
                                       Foreground="{StaticResource Brush.Text.Secondary}" />
                        </StackPanel>
                    </StackPanel>

                    <!-- ... menu -->
                    <Button Grid.Column="3"
                            Style="{StaticResource IconButton}"
                            Content="⋯" FontSize="18" FontWeight="Bold"
                            Margin="8,0,8,0" VerticalAlignment="Center"
                            ToolTip="Plus d'actions"
                            Tag="{Binding}"
                            Click="OnMoreMenuClick">
                        <Button.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="📜  Voir les release notes"
                                          Command="{Binding PlacementTarget.Tag.ShowReleaseNotesCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
                                <MenuItem Header="📁  Ouvrir le dossier"
                                          Command="{Binding PlacementTarget.Tag.OpenFolderCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                                          Visibility="{Binding PlacementTarget.Tag.IsInstalled, RelativeSource={RelativeSource AncestorType=ContextMenu}, Converter={StaticResource BoolToVisibility}}" />
                                <Separator Visibility="{Binding PlacementTarget.Tag.IsInstalled, RelativeSource={RelativeSource AncestorType=ContextMenu}, Converter={StaticResource BoolToVisibility}}" />
                                <MenuItem Header="🗑  Supprimer cette version…"
                                          Command="{Binding PlacementTarget.Tag.UninstallCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                                          Visibility="{Binding PlacementTarget.Tag.IsInstalled, RelativeSource={RelativeSource AncestorType=ContextMenu}, Converter={StaticResource BoolToVisibility}}" />
                            </ContextMenu>
                        </Button.ContextMenu>
                    </Button>
                </Grid>
            </Border>
        </DataTemplate>
    </Window.Resources>

    <Grid Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!-- Background image (sous tout le reste, ne capte pas la souris).
             Le fond noir du Grid garantit que les zones transparentes de l'image
             (et l'image dans son ensemble à faible opacity) reposent sur du noir
             pur, sans héritage du brush système. -->
        <Image Grid.Row="0" Grid.RowSpan="3"
               Source="pack://application:,,,/Resources/Background.png"
               Stretch="UniformToFill"
               Opacity="0.25"
               IsHitTestVisible="False" />

        <!-- Top bar : 3 colonnes (brand / license center / chrome) -->
        <Border Grid.Row="0" Background="{StaticResource Brush.Bg.Sidebar}"
                BorderBrush="{StaticResource Brush.Border}" BorderThickness="0,0,0,1"
                Padding="20,12">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />    <!-- brand -->
                    <ColumnDefinition Width="*" />    <!-- license (center) -->
                    <ColumnDefinition Width="*" />    <!-- chrome (right) -->
                </Grid.ColumnDefinitions>
                <!-- Col 1 : brand -->
                <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
                    <TextBlock Text="PROSERVE"
                               FontFamily="{StaticResource Font.Brand}"
                               FontSize="22"
                               Foreground="{StaticResource Brush.Text.Primary}"
                               VerticalAlignment="Center" />
                    <TextBlock Text="Launcher"
                               FontSize="20"
                               FontWeight="Bold"
                               Foreground="{StaticResource Brush.Text.Primary}"
                               VerticalAlignment="Center"
                               Margin="14,0,0,0" />
                </StackPanel>

                <!-- Col 2 : badge license cliquable, centré -->
                <Border Grid.Column="1"
                        HorizontalAlignment="Center" VerticalAlignment="Center"
                        Cursor="Hand"
                        CornerRadius="16" Padding="14,6"
                        shell:WindowChrome.IsHitTestVisibleInChrome="True"
                        ToolTip="Voir / changer la license">
                    <Border.Style>
                        <Style TargetType="Border">
                            <Setter Property="Background" Value="#2A1414" />
                            <Setter Property="BorderBrush" Value="#EF4444" />
                            <Setter Property="BorderThickness" Value="1" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding LicenseSeverity}" Value="Ok">
                                    <Setter Property="Background" Value="{StaticResource Brush.Status.InstalledBg}" />
                                    <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Installed}" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding LicenseSeverity}" Value="Warning">
                                    <Setter Property="Background" Value="{StaticResource Brush.Status.BusyBg}" />
                                    <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Busy}" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Border.Style>
                    <Border.InputBindings>
                        <MouseBinding Gesture="LeftClick" Command="{Binding OpenLicenseCommand}" />
                    </Border.InputBindings>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding LicenseIcon}"
                                   FontSize="15" FontWeight="Bold"
                                   VerticalAlignment="Center"
                                   Margin="0,0,8,0">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Setter Property="Foreground" Value="#EF4444" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding LicenseSeverity}" Value="Ok">
                                            <Setter Property="Foreground" Value="{StaticResource Brush.Status.Installed}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding LicenseSeverity}" Value="Warning">
                                            <Setter Property="Foreground" Value="{StaticResource Brush.Status.Busy}" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                        <TextBlock Text="{Binding LicenseSummary}"
                                   FontSize="13" FontWeight="SemiBold"
                                   VerticalAlignment="Center">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Setter Property="Foreground" Value="#FCA5A5" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding LicenseSeverity}" Value="Ok">
                                            <Setter Property="Foreground" Value="#86EFAC" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding LicenseSeverity}" Value="Warning">
                                            <Setter Property="Foreground" Value="#FCD34D" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </StackPanel>
                </Border>

                <!-- Col 3 : Paramètres + window chrome -->
                <StackPanel Grid.Column="2" Orientation="Horizontal"
                            HorizontalAlignment="Right" VerticalAlignment="Center">
                    <Button Style="{StaticResource SecondaryButton}"
                            Content="⚙  Paramètres"
                            shell:WindowChrome.IsHitTestVisibleInChrome="True"
                            Command="{Binding OpenSettingsCommand}"
                            Margin="0,0,16,0" />
                    <Button Style="{StaticResource WindowControlButton}"
                            Content="—" ToolTip="Réduire"
                            shell:WindowChrome.IsHitTestVisibleInChrome="True"
                            Click="OnMinimizeClick" />
                    <Button Style="{StaticResource WindowControlButton}"
                            Content="☐" ToolTip="Agrandir / Restaurer"
                            shell:WindowChrome.IsHitTestVisibleInChrome="True"
                            Click="OnMaxRestoreClick" />
                    <Button Style="{StaticResource WindowCloseButton}"
                            Content="✕" ToolTip="Fermer"
                            shell:WindowChrome.IsHitTestVisibleInChrome="True"
                            Click="OnCloseClick" />
                </StackPanel>
            </Grid>
        </Border>

        <!-- Body : Grid pour pouvoir superposer le bouton flottant "Vérifier les MAJ" -->
        <Grid Grid.Row="1">
            <ScrollViewer VerticalScrollBarVisibility="Auto">
            <StackPanel Margin="32,28">

                <!-- ========= FEATURED (version courante) ========= -->
                <Border CornerRadius="10" BorderThickness="1"
                        Padding="0"
                        Margin="0,0,0,32"
                        Visibility="{Binding HasFeaturedVersion, Converter={StaticResource BoolToVisibility}}">
                    <Border.Style>
                        <Style TargetType="Border">
                            <Setter Property="Background" Value="{StaticResource Brush.Bg.Card}" />
                            <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Installed}" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding FeaturedVersion.IsRemoteOnly}" Value="True">
                                    <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Available}" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding FeaturedVersion.IsBusy}" Value="True">
                                    <Setter Property="BorderBrush" Value="{StaticResource Brush.Status.Busy}" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Border.Style>

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="6" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <!-- Bande latérale large -->
                        <Rectangle Grid.Column="0">
                            <Rectangle.Style>
                                <Style TargetType="Rectangle">
                                    <Setter Property="Fill" Value="{StaticResource Brush.Status.Installed}" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding FeaturedVersion.IsRemoteOnly}" Value="True">
                                            <Setter Property="Fill" Value="{StaticResource Brush.Status.Available}" />
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding FeaturedVersion.IsBusy}" Value="True">
                                            <Setter Property="Fill" Value="{StaticResource Brush.Status.Busy}" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Rectangle.Style>
                        </Rectangle>

                        <Grid Grid.Column="1" Margin="32,28">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <!-- Label "Version courante" -->
                            <TextBlock Grid.Row="0" Grid.Column="0"
                                       Text="VERSION COURANTE"
                                       FontSize="11" FontWeight="Bold"
                                       Foreground="{StaticResource Brush.Text.Secondary}"
                                       Margin="0,0,0,4" />

                            <!-- Numéro version + badge -->
                            <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
                                <TextBlock Text="{Binding FeaturedVersion.Version, StringFormat='Proserve v{0}'}"
                                           FontSize="32" FontWeight="Bold"
                                           Foreground="{StaticResource Brush.Text.Primary}" />
                                <Border CornerRadius="12" Padding="10,4" Margin="16,8,0,0"
                                        VerticalAlignment="Center">
                                    <Border.Style>
                                        <Style TargetType="Border">
                                            <Setter Property="Background" Value="{StaticResource Brush.Status.Installed}" />
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding FeaturedVersion.IsRemoteOnly}" Value="True">
                                                    <Setter Property="Background" Value="{StaticResource Brush.Status.Available}" />
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding FeaturedVersion.IsBusy}" Value="True">
                                                    <Setter Property="Background" Value="{StaticResource Brush.Status.Busy}" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Border.Style>
                                    <TextBlock Text="{Binding FeaturedVersion.StateLabel}" FontSize="12" FontWeight="SemiBold"
                                               Foreground="White" />
                                </Border>
                            </StackPanel>

                            <!-- Meta -->
                            <TextBlock Grid.Row="2" Grid.Column="0"
                                       FontSize="13"
                                       Foreground="{StaticResource Brush.Text.Secondary}"
                                       Margin="0,8,0,0">
                                <Run Text="Sortie le " />
                                <Run Text="{Binding FeaturedVersion.PrimaryDate, Mode=OneWay}" />
                                <Run Text="  •  " />
                                <Run Text="{Binding FeaturedVersion.SizeDisplay, Mode=OneWay}" />
                            </TextBlock>

                            <!-- Action principale (gros bouton) -->
                            <Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="1"
                                    Style="{StaticResource PrimaryButton}"
                                    Content="▶  LANCER"
                                    FontSize="20" Padding="56,16"
                                    VerticalAlignment="Center"
                                    Command="{Binding FeaturedVersion.LaunchCommand}"
                                    Visibility="{Binding FeaturedVersion.IsInstalled, Converter={StaticResource BoolToVisibility}}" />

                            <Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="1"
                                    Style="{StaticResource AccentButton}"
                                    Content="{Binding FeaturedVersion.InstallButtonLabel}"
                                    FontSize="20" Padding="48,16"
                                    VerticalAlignment="Center"
                                    Command="{Binding FeaturedVersion.InstallCommand}"
                                    Visibility="{Binding FeaturedVersion.IsRemoteOnly, Converter={StaticResource BoolToVisibility}}" />

                            <StackPanel Grid.Row="0" Grid.RowSpan="3" Grid.Column="1"
                                        Orientation="Vertical" VerticalAlignment="Center" Width="220"
                                        Visibility="{Binding FeaturedVersion.IsBusy, Converter={StaticResource BoolToVisibility}}">
                                <TextBlock Text="{Binding FeaturedVersion.StateLabel}"
                                           HorizontalAlignment="Center"
                                           Foreground="{StaticResource Brush.Status.Busy}"
                                           FontWeight="SemiBold" Margin="0,0,0,8" />
                                <ProgressBar Height="8"
                                             Value="{Binding FeaturedVersion.ProgressPercent}" Maximum="100"
                                             Foreground="{StaticResource Brush.Status.Busy}"
                                             Background="#2A2A30" BorderThickness="0" />
                                <TextBlock Text="{Binding FeaturedVersion.ProgressPercent, StringFormat={}{0:0}%}"
                                           HorizontalAlignment="Center"
                                           FontSize="12" Margin="0,4,0,0"
                                           Foreground="{StaticResource Brush.Text.Secondary}" />
                            </StackPanel>

                            <!-- ... menu -->
                            <Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="2"
                                    Style="{StaticResource IconButton}"
                                    Content="⋯" FontSize="22" FontWeight="Bold"
                                    Margin="12,0,0,0"
                                    VerticalAlignment="Center"
                                    ToolTip="Plus d'actions"
                                    Tag="{Binding FeaturedVersion}"
                                    Click="OnMoreMenuClick">
                                <Button.ContextMenu>
                                    <ContextMenu>
                                        <MenuItem Header="📜  Voir les release notes"
                                                  Command="{Binding PlacementTarget.Tag.ShowReleaseNotesCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
                                        <MenuItem Header="📁  Ouvrir le dossier"
                                                  Command="{Binding PlacementTarget.Tag.OpenFolderCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                                                  Visibility="{Binding PlacementTarget.Tag.IsInstalled, RelativeSource={RelativeSource AncestorType=ContextMenu}, Converter={StaticResource BoolToVisibility}}" />
                                        <Separator Visibility="{Binding PlacementTarget.Tag.IsInstalled, RelativeSource={RelativeSource AncestorType=ContextMenu}, Converter={StaticResource BoolToVisibility}}" />
                                        <MenuItem Header="🗑  Supprimer cette version…"
                                                  Command="{Binding PlacementTarget.Tag.UninstallCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                                                  Visibility="{Binding PlacementTarget.Tag.IsInstalled, RelativeSource={RelativeSource AncestorType=ContextMenu}, Converter={StaticResource BoolToVisibility}}" />
                                    </ContextMenu>
                                </Button.ContextMenu>
                            </Button>
                        </Grid>
                    </Grid>
                </Border>

                <!-- ========= AUTRES VERSIONS ========= -->
                <StackPanel Visibility="{Binding HasOtherVersions, Converter={StaticResource BoolToVisibility}}">
                    <Grid Margin="0,0,0,12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="AUTRES VERSIONS"
                                   FontSize="12" FontWeight="Bold"
                                   Foreground="{StaticResource Brush.Text.Secondary}"
                                   VerticalAlignment="Center" />
                        <Border Grid.Column="1" Background="{StaticResource Brush.Border}"
                                Height="1" Margin="12,0,0,0" VerticalAlignment="Center" />
                    </Grid>

                    <ItemsControl ItemsSource="{Binding OtherVersions}"
                                  ItemTemplate="{StaticResource CompactRowTemplate}" />
                </StackPanel>

                <!-- Empty state -->
                <Border Background="{StaticResource Brush.Bg.Card}"
                        BorderBrush="{StaticResource Brush.Border}" BorderThickness="1"
                        CornerRadius="6"
                        Padding="32"
                        Visibility="{Binding EmptyHintVisibility}">
                    <TextBlock Text="{Binding EmptyHint}"
                               Foreground="{StaticResource Brush.Text.Secondary}"
                               TextWrapping="Wrap" />
                </Border>

            </StackPanel>
            </ScrollViewer>

            <!-- Bouton flottant "Vérifier les MAJ" : ancré bas-gauche du body, au-dessus
                 du background bitmap, à l'extérieur du footer. -->
            <Button HorizontalAlignment="Left" VerticalAlignment="Bottom"
                    Margin="32,0,0,24"
                    Style="{StaticResource SecondaryButton}"
                    Content="🔄  Vérifier les MAJ"
                    Command="{Binding CheckForUpdatesCommand}" />
        </Grid>

        <!-- Footer : visible uniquement quand busy / status à afficher.
             Le bouton "Vérifier les MAJ" a été déplacé en flottant au-dessus du body. -->
        <Border Grid.Row="2" Background="{StaticResource Brush.Bg.Footer}"
                BorderBrush="{StaticResource Brush.Border}" BorderThickness="0,1,0,0"
                Padding="20,10"
                Visibility="{Binding FooterVisibility}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0">
                    <TextBlock Text="{Binding FooterText}"
                               Foreground="{StaticResource Brush.Text.Secondary}"
                               FontSize="12" />
                    <ProgressBar Height="4" Margin="0,4,0,0"
                                 Value="{Binding ProgressPercent}" Maximum="100"
                                 Foreground="{StaticResource Brush.Accent}"
                                 Background="#2A2A30" BorderThickness="0" />
                </StackPanel>
                <Button Grid.Column="1"
                        Style="{StaticResource SecondaryButton}"
                        Content="Annuler"
                        VerticalAlignment="Center" Margin="12,0,0,0"
                        Command="{Binding CancelDownloadCommand}"
                        Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibility}}" />
            </Grid>
        </Border>
    </Grid>
</Window>
