<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    mc:Ignorable="d">

    <DataTemplate x:Key="TopPanelGeneralViewSettingsTemplate">
        <TextBlock Text="&#xefe2;" FontFamily="{DynamicResource FontIcoFont}" FontSize="18"                   
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelFilterPresetsSelectionTemplate">
        <TextBlock Text="&#xeec0;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelGroupSettingsTemplate">
        <TextBlock Text="&#xee03;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSortSettingsTemplate">
        <TextBlock Text="&#xefee;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelViewSelectionTemplate">
        <TextBlock Text="&#xeec0;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSwitchDetailsViewTemplate">
        <TextBlock Text="&#xE145;" FontFamily="Segoe UI Symbol" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSwitchGridViewTemplate">
        <TextBlock Text="&#xE138;" FontFamily="Segoe UI Symbol" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSwitchListViewTemplate">
        <TextBlock Text="&#xE14C;" FontFamily="Segoe UI Symbol" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>
    
    <DataTemplate x:Key="TopPanelUpdateButtonTemplate">
        <TextBlock Foreground="{DynamicResource WarningBrush}"
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   Text="&#xef08;" FontSize="24" FontFamily="{DynamicResource FontIcoFont}"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelExplorerSwitchTemplate">
        <TextBlock Text="&#xeeed;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelSelectRandomGameButtonTemplate">
        <TextBlock Text="&#xef03;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="TopPanelViewSelectRandomGameButtonTemplate">
        <TextBlock Text="&#xefcf;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>
    
    <DataTemplate x:Key="TopPanelSearchButtonTemplate">
        <TextBlock Text="&#xed12;" FontFamily="{DynamicResource FontIcoFont}" FontSize="20"
                   VerticalAlignment="Center" HorizontalAlignment="Center"/>
    </DataTemplate>
    
    <Style x:Key="TopPanelMenu" TargetType="{x:Type ContextMenu}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Background" Value="{DynamicResource PopupBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource PopupBorderBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource PopupBorderThickness}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            Grid.IsSharedSizeScope="True">
                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                            <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle"/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TopPanelFilterToggle" TargetType="CheckBox">
        <Setter Property="MinWidth" Value="32" />
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="Background" Value="#25272d" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Margin" Value="10,0,0,0" />
        <Setter Property="Padding" Value="6,6,6,6" />
        <Setter Property="Foreground" Value="#808080" />
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Background="{TemplateBinding Background}"
                            VerticalAlignment="Center"
                            BorderThickness="0"
                            Padding="{TemplateBinding Padding}"
                            CornerRadius="2">
                        <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Viewbox Stretch="Uniform" Width="20" Height="20"
                                     VerticalAlignment="Center">
                                <Canvas Width="36" Height="36">
                                    <Path Fill="{TemplateBinding Foreground}"
                                          Data="M34 7V11H2V7H34ZM6 20H30V16H6V20ZM10 29H26V25H10V29Z"/>
                                </Canvas>
                            </Viewbox>

                            <TextBlock Text="{DynamicResource LOCFilterActiveLabel}"
                                       Style="{DynamicResource BaseTextBlockStyle}"
                                       Foreground="{TemplateBinding Foreground}"
                                       Margin="3,0,0,0" VerticalAlignment="Center"
                                       Name="TextFilter" />
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Tag" Value="{StaticResource True}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="TextFilter" />
                            <Setter Property="Foreground" Value="#ccffffff" />
                            <Setter Property="Background" Value="#1e90ff" />
                        </Trigger>
                        <Trigger Property="Tag" Value="{StaticResource False}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="TextFilter" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource TopPanelItemIsMouseOverForegroundBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="TopPanelNotificationsToggle" TargetType="ToggleButton">
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Margin" Value="10,0,0,0" />
        <Setter Property="Padding" Value="6,6,6,6" />
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="Background" Value="#5c7e10" />
        <Setter Property="Foreground" Value="#ffffff" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border x:Name="Border" CornerRadius="2"
                            VerticalAlignment="Center"
                            Padding="{TemplateBinding Padding}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Viewbox Stretch="Uniform" Width="20" Height="20"
                                     VerticalAlignment="Center" HorizontalAlignment="Center">
                                <Canvas Width="36" Height="36">
                                    <Path Fill="{TemplateBinding Foreground}"
                                          Data="M32 24V26H4V24L8 19V12C8 9.34784 9.05357 6.8043 10.9289 4.92893C12.8043 3.05357 15.3478 2 18 2C20.6522 2 23.1957 3.05357 25.0711 4.92893C26.9464 6.8043 28 9.34784 28 12V19L32 24Z"/>
                                    <Path Fill="{TemplateBinding Foreground}"
                                          Data="M18 34C19.2396 33.9986 20.4483 33.6133 21.46 32.897C22.4718 32.1807 23.2368 31.1687 23.65 30H12.35C12.7632 31.1687 13.5282 32.1807 14.54 32.897C15.5517 33.6133 16.7604 33.9986 18 34Z"/>
                                </Canvas>
                            </Viewbox>
                            <Border CornerRadius="3" MinWidth="15" Height="15"
                                    Margin="3,0,0,0" Background="OrangeRed" Padding="2"
                                    HorizontalAlignment="Left" VerticalAlignment="Center">
                                <TextBlock Text="{Api Notifications.Count}" FontSize="12"
                                           Foreground="{DynamicResource TextBrush}"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Border>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Api Notifications.Count}" Value="0">
                <Setter Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#7da44a" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type TopPanel}">
        <Setter Property="Background" Value="{DynamicResource TopPanelBackgroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TopPanel}">
                    <Border Height="50" BorderBrush="{DynamicResource PanelSeparatorBrush}"
                            Background="{TemplateBinding Background}"
                            d:DesignWidth="1280"
                            d:DataContext="{x:Static DesignMainViewModel.DesignIntance}">
                        <Border.Style>
                            <Style TargetType="Border">
                                <Setter Property="BorderThickness" Value="0,0,0,0" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Settings SidebarPosition}" Value="Top">
                                        <Setter Property="BorderThickness" Value="0,1,0,0" />
                                    </DataTrigger>
                                    <DataTrigger Binding="{Settings ShowPanelSeparators}" Value="False">
                                        <Setter Property="BorderThickness" Value="0" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                        <DockPanel Margin="0,3,110,3">
                            <Border x:Name="PART_ElemMainMenu" Background="Transparent"
                                    DockPanel.Dock="Left" Margin="5,0,0,0" Cursor="Hand"
                                    WindowChrome.IsHitTestVisibleInChrome="True">
                                <Image Source="{ThemeFile 'Images/applogo.png'}"
                                       Height="40" RenderOptions.BitmapScalingMode="Fant"
                                       Margin="10,0,10,0"/>
                            </Border>

                            <SearchBox x:Name="PART_TextMainSearch"
                                       Background="{DynamicResource TopPanelSearchBoxBackgroundBrush}"
                                       Margin="0,6,0,6" DockPanel.Dock="Left"
                                       WindowChrome.IsHitTestVisibleInChrome="True"
                                       Width="{DynamicResource TopPanelSearchBoxWidthHelium}"
                                       MaxWidth="{Settings DetailsListWitdh}" />

                            <Border Tag="{DynamicResource ShowNavigationButtons}"
                                    DockPanel.Dock="Left"
                                    Visibility="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                                <StackPanel Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin}"
                                            Margin="{Binding ElementName=PART_ToggleNotifications, Path=Margin}"
                                            Orientation="Horizontal">
                                    <Button Style="{DynamicResource TopPanelNavigateBackButtonStyle}" Command="{PluginSettings Plugin=ThemeExtras, Path=Commands.BackCommand, FallbackValue={x:Null}}" />
                                    <Button Style="{DynamicResource TopPanelNavigateForwardButtonStyle}" Command="{PluginSettings Plugin=ThemeExtras, Path=Commands.ForwardCommand, FallbackValue={x:Null}}" />
                                </StackPanel>
                            </Border>
                            
                            <StackPanel x:Name="PART_PanelMainItems" Orientation="Horizontal"
                                        VerticalAlignment="Stretch" Margin="0,6,0,6"/>

                            <CheckBox x:Name="PART_ToggleFilter" ToolTip="{DynamicResource LOCFilters}"
                                      Style="{DynamicResource TopPanelFilterToggle}"
                                      DockPanel.Dock="Left" />

                            <CheckBox x:Name="PART_ToggleNotifications"
                                      Style="{DynamicResource TopPanelNotificationsToggle}"
                                      DockPanel.Dock="Left" />

                            <StackPanel x:Name="PART_PanelMainPluginItems" Orientation="Horizontal"
                                        VerticalAlignment="Stretch" Margin="15,6,15,6"
                                        DockPanel.Dock="{Settings PluginTopPanelAlignment}"/>

                            <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"
                                        HorizontalAlignment="Center" Margin="0,5,0,5">
                                <Grid MaxWidth="600" MinWidth="300">
                                    <ProgressBar Name="PART_ProgressGlobal"
                                                 Background="{DynamicResource TopPanelSearchBoxBackgroundBrush}" />
                                    <TextBlock Name="PART_TextProgressText"
                                               VerticalAlignment="Center" HorizontalAlignment="Center"
                                               Style="{DynamicResource BaseTextBlockStyle}" Margin="5,0,5,0" />
                                </Grid>

                                <Button Name="PART_ButtonProgressCancel"
                                        Content="{DynamicResource LOCCancelLabel}"
                                        WindowChrome.IsHitTestVisibleInChrome="True"
                                        Margin="5,0,0,0" />
                            </StackPanel>                    
                        </DockPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>