<Application x:Class="AutoDarkModeApp.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:AutoDarkModeApp"
             xmlns:control="clr-namespace:AutoDarkModeApp.Controls"
             xmlns:ui="http://schemas.modernwpf.com/2019"
             Startup="Application_Startup">

    <Application.Resources>
        <ResourceDictionary>
            <Style TargetType="control:Card">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="control:Card">
                            <Border BorderThickness="1"
                                    BorderBrush="{DynamicResource Win11Border}"
                                    CornerRadius="5"
                                    Padding="{TemplateBinding Padding}"
                                    Margin="{TemplateBinding Margin}">
                                <ContentControl Focusable="False"
                                                Content="{TemplateBinding Content}" />
                                <Border.Style>
                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="Background"
                                                Value="{DynamicResource Win11Background}" />
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver"
                                                     Value="True">
                                                <Setter Property="Background"
                                                        Value="{DynamicResource Win11BackgroundHover}" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Border.Style>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="{x:Static SystemParameters.FocusVisualStyleKey}">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <!-- Remove until fix is found -->
                            <!-- https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/styling-for-focus-in-controls-and-focusvisualstyle?redirectedfrom=MSDN&view=netframeworkdesktop-4.8 -->
                            <!--<Border CornerRadius="4"
                                    BorderBrush="Black"
                                    BorderThickness="2" />-->
                            <Rectangle StrokeThickness="0"
                                       Stroke="Black"
                                       SnapsToDevicePixels="true" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <ResourceDictionary.MergedDictionaries>
                <!--  FluentWPF Controls  -->
                <ResourceDictionary Source="pack://application:,,,/FluentWPF;component/Styles/Controls.xaml" />
                <!-- ModernWPF Controls -->
                <ui:ThemeResources>
                    <ui:ThemeResources.ThemeDictionaries>
                        <ResourceDictionary x:Key="Light">
                            <SolidColorBrush x:Key="NavbarFill"
                                             Color="#f7f7f7">
                            </SolidColorBrush>
                            <Color x:Key="NavbarBackground">#f9f9f9</Color>
                            <SolidColorBrush x:Key="Win11Background"
                                             Opacity="0.75"
                                             Color="#fffbfbfb"></SolidColorBrush>
                            <SolidColorBrush x:Key="Win11Border"
                                             Color="#e5e5e5"></SolidColorBrush>
                            <SolidColorBrush x:Key="AltHighClone"
                                             Color="#f3f3f3"></SolidColorBrush>
                            <SolidColorBrush x:Key="Win11BackgroundHover"
                                             Color="#fff6f6f6"
                                             Opacity="0.6" />
                            <ResourceDictionary.MergedDictionaries>
                                <ui:ColorPaletteResources TargetTheme="Light"
                                                          AltHigh="#f3f3f3" />
                            </ResourceDictionary.MergedDictionaries>
                        </ResourceDictionary>
                        <ResourceDictionary x:Key="Dark">
                            <ResourceDictionary.MergedDictionaries>
                                <ui:ColorPaletteResources TargetTheme="Dark"
                                                          AltHigh="#202020"
                                                          BaseMediumHigh="White" />
                            </ResourceDictionary.MergedDictionaries>

                            <SolidColorBrush x:Key="NavbarFill"
                                             Color="#2b2b2b">
                            </SolidColorBrush>

                            <Color x:Key="NavbarBackground">#2b2b2b</Color>
                            <SolidColorBrush x:Key="Win11Background"
                                             Opacity="0.05"
                                             Color="#fffbfbfb"></SolidColorBrush>
                            <SolidColorBrush x:Key="Win11Border"
                                             Color="#1d1d1d"></SolidColorBrush>
                            <SolidColorBrush x:Key="AltHighClone"
                                             Color="#202020"></SolidColorBrush>
                            <SolidColorBrush x:Key="Win11BackgroundHover"
                                             Color="#fff6f6f6"
                                             Opacity="0.09" />
                        </ResourceDictionary>
                    </ui:ThemeResources.ThemeDictionaries>
                </ui:ThemeResources>
                <ui:XamlControlsResources />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
