<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:res="clr-namespace:PSLauncher.App.Resources">

    <BooleanToVisibilityConverter x:Key="BoolToVisibility" />

    <!-- Custom font Pirulen pour les titres de marque -->
    <FontFamily x:Key="Font.Brand">pack://application:,,,/Resources/#Pirulen</FontFamily>

    <!-- Inverse bool : utilisé pour griser un bouton pendant qu'une opération est en cours -->
    <res:InverseBoolConverter x:Key="InverseBoolToBool" />

    <!-- Fond fenêtre : noir pur pour ne pas délaver le bitmap overlay -->
    <SolidColorBrush x:Key="Brush.Bg.Window"   Color="#000000" />
    <!-- Cards & sidebar : très légère teinte bleutée pour le contraste -->
    <SolidColorBrush x:Key="Brush.Bg.Sidebar"  Color="#0E1218" />
    <SolidColorBrush x:Key="Brush.Bg.Card"     Color="#161B23" />
    <SolidColorBrush x:Key="Brush.Bg.Footer"   Color="#050709" />
    <SolidColorBrush x:Key="Brush.Border"      Color="#2A2F3A" />
    <SolidColorBrush x:Key="Brush.Text.Primary"   Color="#F2F2F2" />
    <SolidColorBrush x:Key="Brush.Text.Secondary" Color="#A0A0A8" />
    <SolidColorBrush x:Key="Brush.Accent"      Color="#0078D4" />
    <SolidColorBrush x:Key="Brush.AccentHover" Color="#1A8CE0" />
    <SolidColorBrush x:Key="Brush.Play"        Color="#0CA84B" />
    <SolidColorBrush x:Key="Brush.PlayHover"   Color="#10C257" />

    <!-- Status colors -->
    <SolidColorBrush x:Key="Brush.Status.Installed"     Color="#16A34A" />  <!-- vert vif -->
    <SolidColorBrush x:Key="Brush.Status.InstalledBg"   Color="#0E2A1B" />  <!-- vert très sombre -->
    <SolidColorBrush x:Key="Brush.Status.Available"     Color="#3B82F6" />  <!-- bleu vif -->
    <SolidColorBrush x:Key="Brush.Status.AvailableBg"   Color="#13243F" />  <!-- bleu très sombre -->
    <SolidColorBrush x:Key="Brush.Status.Busy"          Color="#F59E0B" />  <!-- ambre -->
    <SolidColorBrush x:Key="Brush.Status.BusyBg"        Color="#3A2A0E" />

    <Style TargetType="Window">
        <Setter Property="Background" Value="{StaticResource Brush.Bg.Window}" />
        <Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="FontSize" Value="13" />
    </Style>

    <Style TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
    </Style>

    <Style x:Key="SidebarItem" TargetType="RadioButton">
        <Setter Property="Foreground" Value="{StaticResource Brush.Text.Secondary}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="20,10" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            Padding="{TemplateBinding Padding}">
                        <ContentPresenter VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="#2C2C32" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="#2C2C32" />
                            <Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="PrimaryButton" TargetType="Button">
        <Setter Property="Background" Value="{StaticResource Brush.Play}" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="FontSize" Value="18" />
        <Setter Property="FontWeight" Value="SemiBold" />
        <Setter Property="Padding" Value="48,14" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            CornerRadius="4"
                            Padding="{TemplateBinding Padding}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Brush.PlayHover}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Bd" Property="Background" Value="#444" />
                            <Setter Property="Foreground" Value="#888" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SecondaryButton" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
        <Setter Property="Background" Value="#3A3A40" />
        <Setter Property="FontSize" Value="13" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="Padding" Value="14,8" />
    </Style>

    <Style x:Key="AccentButton" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
        <Setter Property="Background" Value="{StaticResource Brush.Accent}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            CornerRadius="4"
                            Padding="{TemplateBinding Padding}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Brush.AccentHover}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Bd" Property="Background" Value="#444" />
                            <Setter Property="Foreground" Value="#888" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="IconButton" TargetType="Button">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{StaticResource Brush.Text.Secondary}" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Padding" Value="8,4" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            CornerRadius="4"
                            Padding="{TemplateBinding Padding}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="#2C2C32" />
                            <Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Style ContextMenu sombre, cohérent avec le thème.
         On retemplatise complètement pour virer la "icon column" claire que WPF
         dessine par défaut sur le bord gauche du popup. -->
    <Style TargetType="ContextMenu">
        <Setter Property="Background" Value="{StaticResource Brush.Bg.Card}" />
        <Setter Property="BorderBrush" Value="{StaticResource Brush.Border}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
        <Setter Property="Padding" Value="4" />
        <Setter Property="HasDropShadow" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContextMenu">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            CornerRadius="4">
                        <StackPanel IsItemsHost="True"
                                    KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- MenuItem dark : on retemplatise pour virer la "icon column" claire à gauche
         que WPF dessine par défaut. -->
    <Style TargetType="MenuItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
        <Setter Property="Padding" Value="12,8" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="MenuItem">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            CornerRadius="3"
                            Padding="{TemplateBinding Padding}">
                        <ContentPresenter ContentSource="Header"
                                          VerticalAlignment="Center"
                                          RecognizesAccessKey="True" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Brush.Accent}" />
                            <Setter Property="Foreground" Value="White" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource Brush.Text.Secondary}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Separator">
        <Setter Property="Height" Value="1" />
        <Setter Property="Background" Value="{StaticResource Brush.Border}" />
        <Setter Property="Margin" Value="4,4" />
    </Style>

    <Style x:Key="VersionPill" TargetType="Border">
        <Setter Property="Background" Value="#2C2C32" />
        <Setter Property="CornerRadius" Value="12" />
        <Setter Property="Padding" Value="10,4" />
    </Style>

</ResourceDictionary>
