<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="HobbitSpeedrunTools.WindowTitle">
    <SolidColorBrush Color="#101010" x:Key="dark1"/>
    <SolidColorBrush Color="#1f1f1f" x:Key="dark2"/>
    <SolidColorBrush Color="White" x:Key="light1"/>
    <SolidColorBrush Color="#343434" x:Key="light2"/>
    <SolidColorBrush Color="#FF5900" x:Key="accent1"/>
    <SolidColorBrush Color="#884000" x:Key="accent2"/>
    <FontFamily x:Key="text">../../resources/#Titillium Web</FontFamily>
    <FontFamily x:Key="header">../../resources/#Titillium Web SemiBold</FontFamily>
    
    <Style x:Key="CustomWindowStyle" TargetType="Window">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="WindowChrome.WindowChrome">
            <Setter.Value>
                <WindowChrome CaptionHeight="30"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Window">
                    <Border Background="{StaticResource dark1}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="1*"/>
                            </Grid.RowDefinitions>
                            <ContentPresenter Grid.Row="1" Margin="0"/>
                            <Grid Grid.Column="0" Height="30" Name="titleBar" Background="Black" VerticalAlignment="Top" Margin="0">
                                <DockPanel Margin="0,0,130,0">
                                    <Image HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,0,0"
                                               Source="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" Height="20" />
                                    <TextBlock Margin="5,3" VerticalAlignment="Center" HorizontalAlignment="Stretch" TextWrapping="NoWrap" FontSize="16" Width="Auto"
                                                   Foreground="{StaticResource light1}" Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}"   
                                                   FontFamily="{StaticResource text}" Grid.Column="1" TextAlignment="Left"/>
                                </DockPanel>

                                <StackPanel Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Right">
                                    <Button Name="btnMinimize" Template="{DynamicResource ResizeWindowButton}" Width="40" VerticalContentAlignment="Bottom"
                                                WindowChrome.IsHitTestVisibleInChrome="True" Click="Minimize_Event" Height="auto">
                                        <Rectangle Width="10" VerticalAlignment="Center" Margin="1 1 0 0" Fill="{StaticResource dark2}" Stroke="{StaticResource light1}" StrokeThickness="1"/>
                                    </Button>

                                    <Button Name="btnClose" Template="{DynamicResource CloseWindowButton}" Width="40" WindowChrome.IsHitTestVisibleInChrome="True"
                                                Click="CloseWindow_Event" Height="auto">
                                        <Grid Margin="0 1 0 0">
                                            <Line X1="0" Y1="0" X2="11" Y2="11" Stroke="{StaticResource light1}" StrokeThickness="1" />
                                            <Line X1="0" Y2="0" Y1="11" X2="11" Stroke="{StaticResource light1}" StrokeThickness="1" />
                                        </Grid>
                                    </Button>
                                </StackPanel>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="WindowState" Value="Maximized">
                <Setter Property="BorderThickness" Value="7"/>
            </Trigger>
            <Trigger Property="WindowState" Value="Normal">
                <Setter Property="BorderThickness" Value="0"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="ResizeWindowButton" TargetType="Button">
        <Border Name="border" Background="Black" SnapsToDevicePixels="true" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <ContentPresenter Name="contentPresenter" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Background" TargetName="border" Value="{StaticResource dark2}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="Background" TargetName="border" Value="{StaticResource dark1}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="CloseWindowButton" TargetType="Button">
        <Border Name="border" Background="Black" SnapsToDevicePixels="true" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <ContentPresenter Name="contentPresenter" Focusable="False" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Background" TargetName="border" Value="#DD0A1D"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="Background" TargetName="border" Value="#FF940A14"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="Label">
        <Setter Property="FontFamily" Value="{StaticResource text}" />
        <Setter Property="Foreground" Value="{StaticResource light1}" />
        <Setter Property="Padding" Value="0,2,0,2" />
    </Style>

    <Style TargetType="ToolTip">
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Background" Value="{StaticResource dark1}" />
        <Setter Property="FontFamily" Value="{StaticResource text}" />
        <Setter Property="FontSize" Value="14" />
    </Style>

    <Style TargetType="TextBlock">
        <Setter Property="FontFamily" Value="{StaticResource text}" />
        <Setter Property="Foreground" Value="{StaticResource light1}" />
        <Setter Property="Padding" Value="0,0,0,0" />
    </Style>

    <Style TargetType="TextBox">
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Background" Value="{StaticResource dark1}" />
        <Setter Property="FontFamily" Value="{StaticResource text}" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="Padding" Value="5,0,5,0" />
        <Setter Property="Height" Value="25" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border x:Name="Border" 
						BorderBrush="{StaticResource light2}" 
						BorderThickness="2"
                        CornerRadius="4"
                        Background="{TemplateBinding Background}">
                        <ScrollViewer x:Name="PART_ContentHost" 
						    Focusable="false" 
						    HorizontalScrollBarVisibility="Hidden" 
						    VerticalScrollBarVisibility="Hidden"
                        >
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{DynamicResource dark2}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="GroupBox">
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="1*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Border CornerRadius="5,5,0,0" Background="{DynamicResource dark2}" BorderBrush="{DynamicResource dark2}">
                            <ContentPresenter Margin="10,0,10,0"
                                ContentSource="Header"
                                RecognizesAccessKey="True" TextBlock.FontSize="16" TextBlock.FontFamily="{StaticResource header}"/>
                        </Border>
                        <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,-1,0,0">
                            <Border BorderThickness="0" CornerRadius="0,5,5,5" Background="{DynamicResource dark2}" BorderBrush="{DynamicResource light1}">
                                <ContentPresenter Margin="10,10,10,10"/>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Button">
        <Setter Property="Background" Value="{StaticResource dark1}" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="FontFamily" Value="{DynamicResource text}" />
        <Setter Property="Height" Value="25" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="Border" BorderBrush="{DynamicResource light2}" Background="{TemplateBinding Background}" BorderThickness="2" CornerRadius="4">
                        <ContentPresenter x:Name="Content" 
                                          Content="{TemplateBinding Content}"
                                          Margin="10 0 10 0"
                                          HorizontalAlignment="Center" 
                                          VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource accent2}"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource accent1}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource accent1}"/>
                            <Setter Property="Background" Value="{DynamicResource accent2}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{DynamicResource dark2}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CheckBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle Margin="15,0,0,0" StrokeThickness="1" Stroke="#60000000" StrokeDashArray="1 2"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type CheckBox}" TargetType="CheckBox">
        <Setter Property="FocusVisualStyle"	Value="{StaticResource CheckBoxFocusVisual}"/>
        <Setter Property="FontFamily" Value="{StaticResource text}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <BulletDecorator>
                        <BulletDecorator.Bullet>
                            <Border x:Name="Border" Width="16" Height="16" CornerRadius="4" Background="{StaticResource dark1}"
                                    BorderThickness="2" BorderBrush="{StaticResource light2}">
                            </Border>
                        </BulletDecorator.Bullet>
                        <ContentPresenter Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" RecognizesAccessKey="True"/>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource accent2}"/>
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource accent1}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource accent2}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource accent1}"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource accent2}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource dark1}"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource light2}"/>
                            <Setter Property="Foreground" Value="{StaticResource light2}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="25" />
            </Grid.ColumnDefinitions>
            <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="4" Background="{StaticResource dark1}"
                    BorderBrush="{StaticResource light2}" BorderThickness="2" />
            <Border x:Name="Separator" Grid.Column="0" CornerRadius="2,0,0,2"  Margin="1" Background="Transparent" 
                    BorderBrush="{StaticResource light2}" BorderThickness="0,0,2,0" />
            <Path x:Name="Arrow" Grid.Column="1" Fill="{StaticResource light1}" HorizontalAlignment="Center" Margin="0,0,4,0"
                  VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="ToggleButton.IsMouseOver" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource accent2}" />
                <Setter TargetName="Border" Property="BorderBrush"  Value="{StaticResource accent1}" />
                <Setter TargetName="Separator" Property="BorderBrush"  Value="{StaticResource accent1}" />
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource accent2}" />
                <Setter TargetName="Border" Property="BorderBrush"  Value="{StaticResource accent1}" />
                <Setter TargetName="Separator" Property="BorderBrush"  Value="{StaticResource accent1}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource light2}" />
                <Setter TargetName="Border" Property="Background" Value="{StaticResource dark2}" />
                <Setter Property="Foreground" Value="{StaticResource light2}"/>
                <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource light2}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
        <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
    </ControlTemplate>

    <Style x:Key="{x:Type ComboBox}" TargetType="ComboBox">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="Foreground" Value="{StaticResource light1}" />
        <Setter Property="FontFamily" Value="{StaticResource text}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <ToggleButton Name="ToggleButton" Template="{StaticResource ComboBoxToggleButton}" Grid.Column="2" 
                                      Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                                      ClickMode="Press">
                        </ToggleButton>
                        <ContentPresenter Name="ContentSite" IsHitTestVisible="False"  Content="{TemplateBinding SelectionBoxItem}"
                                          ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                          Margin="10,3,23,3" VerticalAlignment="Center" HorizontalAlignment="Left" />
                        <TextBox x:Name="PART_EditableTextBox" Style="{x:Null}" Template="{StaticResource ComboBoxTextBox}" 
                                 HorizontalAlignment="Left" VerticalAlignment="Center" Margin="15,3,15,3" Focusable="True" 
                                Background="Transparent" Visibility="Hidden" IsReadOnly="{TemplateBinding IsReadOnly}"/>
                        <Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
                               AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
                            <Grid Name="DropDown" MinWidth="{TemplateBinding ActualWidth}"
                                  MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border x:Name="DropDownBorder" Background="{StaticResource dark1}" BorderThickness="2"
                                        BorderBrush="{StaticResource light2}"/>
                                <ScrollViewer Margin="0" Padding="5">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource accent2}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
                            <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4"/>
                            <Setter TargetName="DropDownBorder" Property="Margin" Value="0,0,0,0"/>
                        </Trigger>
                        <Trigger Property="IsEditable" Value="true">
                            <Setter Property="IsTabStop" Value="false"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility"	Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Border Name="Border" Padding="2" CornerRadius="4">
                        <ContentPresenter />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource accent2}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource light2}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>