<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:RelhaxModpack.Windows"
                    xmlns:ui="clr-namespace:RelhaxModpack.UI">
    <!-- dark theme done in a way that's actually good. uses all the WPF -->
    <!-- add some static colors -->
    <Color x:Key="DarkThemeHighlightColor" A="255" R="134" B="134" G="134"/>
    <Color x:Key="DarkThemeSelectedColor" A="255" R="150" B="150" G="150"/>
    <Color x:Key="DarkThemeButtonColor" A="255" R="42" B="42" G="42"/>
    <SolidColorBrush x:Key="DarkThemeTextColor" Color="White"/>
    <SolidColorBrush x:Key="DarkThemeBackground" Color="#1A1A1A"/>
    <SolidColorBrush x:Key="DarkThemeButton" Color="{StaticResource DarkThemeButtonColor}"/>
    <SolidColorBrush x:Key="DarkThemeActiveTab" Color="#646464"/>
    <SolidColorBrush x:Key="DarkThemeImageButtonBackground" Color="#AFAFAF"/>
    <LinearGradientBrush x:Key="DarkThemeProgressBarForeground" StartPoint="0.25, 0" EndPoint="0.75, 1">
        <GradientStop Color="#5F5F5F5F" Offset="0"/>
        <GradientStop Color="#0000FF" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="DarkThemeCheckboxHighlight" Color="{StaticResource DarkThemeHighlightColor}"/>
    <SolidColorBrush x:Key="DarkThemeRadioButtonHighlight" Color="{StaticResource DarkThemeHighlightColor}"/>
    <SolidColorBrush x:Key="DarkThemeButtonHighlight" Color="{StaticResource DarkThemeHighlightColor}"/>
    <SolidColorBrush x:Key="DarkThemeTabItemHighlightColorBrush" Color="{StaticResource DarkThemeHighlightColor}"/>
    <SolidColorBrush x:Key="DarkThemeTabItemSelectedColorBrush" Color="{StaticResource DarkThemeSelectedColor}"/>
    <SolidColorBrush x:Key="DarkThemeDisabledTabItem" Color="#424242"/>

    <SolidColorBrush x:Key="DefaultGridColorInTabItem" Color="#FFE5E5E5"/>
    <SolidColorBrush x:Key="PackageUiComponentHighlightBrush" Color="Blue"/>

    <!-- Re-usable styles for multiple components -->
    <Style x:Key="OptionMarkFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="FocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Looks like this can be used for panel & border (and others) -->
    <Style x:Key="DarkThemeStyleBackground">
        <Style.Triggers>
            <DataTrigger Binding="{Binding DarkTheme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:RelhaxWindow}}}" Value="True">
                <Setter Property="Control.Background" Value="{StaticResource DarkThemeBackground}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <!-- used for the grids with that color when in the tabItem -->
    <Style x:Key="DarkThemeStyleBackgroundGridInTabItem">
        <Setter Property="Control.Background" Value="{StaticResource DefaultGridColorInTabItem}"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding DarkTheme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:RelhaxWindow}}}" Value="True">
                <Setter Property="Control.Background" Value="{StaticResource DarkThemeBackground}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="DarkThemeStyleBackgroundForeground" BasedOn="{StaticResource DarkThemeStyleBackground}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding DarkTheme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:RelhaxWindow}}}" Value="True">
                <Setter Property="Control.Foreground" Value="{StaticResource DarkThemeTextColor}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="DarkThemeGrid" TargetType="Grid" BasedOn="{StaticResource DarkThemeStyleBackground}">

    </Style>

    <!-- direct application of {DarkThemeStyleBackground(Foreground)} to components based on type -->
    <Style TargetType="TextBlock" BasedOn="{StaticResource DarkThemeStyleBackgroundForeground}">
        
    </Style>
    <Style TargetType="TextBox" BasedOn="{StaticResource DarkThemeStyleBackgroundForeground}">

    </Style>
    <Style TargetType="TabControl" BasedOn="{StaticResource DarkThemeStyleBackground}">
        
    </Style>

    <!-- I don't do anything fancy with the progressBar so just modifying the properties will do -->
    <Style TargetType="ProgressBar">
        <Style.Triggers>
            <DataTrigger Binding="{Binding DarkTheme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:RelhaxWindow}}}" Value="True">
                <Setter Property="ProgressBar.Background" Value="{StaticResource DarkThemeButton}"/>
                <Setter Property="ProgressBar.Foreground" Value="{StaticResource DarkThemeProgressBarForeground}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <!-- Custom border definition with IsChildPackageChecked property to use for checked style triggers -->
    <Style TargetType="ui:RelhaxBorder" BasedOn="{StaticResource DarkThemeStyleBackground}">
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="Background" Value="White"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding DarkTheme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:RelhaxWindow}}}" Value="True">
                <Setter Property="BorderBrush" Value="White"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding IsChildPackageChecked, RelativeSource={RelativeSource Self}}" Value="True">
                <Setter Property="Background" Value="BlanchedAlmond"/>
            </DataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding DarkTheme, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:RelhaxWindow}}}" Value="True"/>
                    <Condition Binding="{Binding IsChildPackageChecked, RelativeSource={RelativeSource Self}}" Value="True"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Background" Value="{StaticResource DarkThemeActiveTab}"/>
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>