<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ForzaUI"
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <!-- Sizes -->
    <System:Double x:Key="A_Size_ColumnWidthSmall">70</System:Double>
    <System:Double x:Key="A_Size_ColumnWidth">123</System:Double>
    <System:Double x:Key="A_Size_ColumnWidthLarge">206</System:Double>
    <System:Double x:Key="A_Size_ColumnWidthXL">373</System:Double>
    <System:Double x:Key="A_Size_HeaderRowHeight">48</System:Double>
    <System:Double x:Key="A_Size_RowHeight">48</System:Double>
    <System:Double x:Key="A_Size_RowHeightWithSpacer">51</System:Double>
    <System:Double x:Key="A_Size_FooterRowHeight">48</System:Double>
    <GridLength x:Key="A_GridLength_Column_Spacer_Width">18</GridLength>

    <Thickness x:Key="A_Margin_Cell">26, 0</Thickness>


    <!-- Colors -->
    <Color x:Key="A_Color_DarkPanelHeader">#272d33</Color>
    <Color x:Key="A_Color_DarkPanelBackground">#99323a41</Color>
    <Color x:Key="A_Color_DarkPanelDividingLine">#00000000</Color>
    <Color x:Key="A_Color_ScrollBarBackground">#AAE0E2DC</Color>
    <Color x:Key="A_Color_LightGreyText">#AAAAAA</Color>


    <!-- Brushes -->
    <SolidColorBrush x:Key="A_Brush_DarkPanelHeader" Color="{StaticResource A_Color_DarkPanelHeader}" />
    <SolidColorBrush x:Key="A_Brush_DarkPanelBackground" Color="{StaticResource A_Color_DarkPanelBackground}" />
    <SolidColorBrush x:Key="A_Brush_ScrollBarBackground" Color="{StaticResource A_Color_ScrollBarBackground}" />

    <!-- Font Sizes -->
    <System:Double x:Key="A_CapHeight_DriverListHeading">15</System:Double>
    <System:Double x:Key="A_CapHeight_Cell">15</System:Double>

    <!-- Fonts -->
    <Style x:Key="A_Style_FZTextBlock_DriverListHeading" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}" >
        <Setter Property="CapHeight" Value="{StaticResource A_CapHeight_DriverListHeading}" />
        <Setter Property="Color" Value="{StaticResource A_Color_Header_Text}" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Left" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_LeaderboardRow" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}" >
        <Setter Property="CapHeight" Value="{StaticResource A_CapHeight_Cell}" />
        <Setter Property="Color" Value="{StaticResource A_Color_DriverListRowText}" />
        <Setter Property="Margin" Value="0" />
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding IsIt}" Value="True" />
                    <Condition Binding="{Binding ShowKing, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerListControl}}}" Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Color" Value="{StaticResource A_Color_King_Text}"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding InOnlineGame}" Value="True" />
                    <Condition Binding="{Binding IsIt}" Value="True" />
                    <Condition Binding="{Binding ShowInfected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerListControl}}}" Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Color" Value="{StaticResource A_Color_Infected_Text}"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding InOnlineGame}" Value="True" />
                    <Condition Binding="{Binding IsIt}" Value="False" />
                    <Condition Binding="{Binding ShowInfected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerListControl}}}" Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Color" Value="{StaticResource A_Color_Survivor_Text}"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Team}" Value="0" />
                    <Condition Binding="{Binding ShowTeams, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerListControl}}}" Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Color" Value="{StaticResource A_Color_TeamA_Text}"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Team}" Value="1" />
                    <Condition Binding="{Binding ShowTeams, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerListControl}}}" Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Color" Value="{StaticResource A_Color_TeamB_Text}"/>
            </MultiDataTrigger>
            <DataTrigger Binding="{Binding IsLocalPlayer}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_LocalPlayer_Text}" />
                <Setter Property="FontFamily"
                        Value="Horizon_C" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HighlightText}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_ClubTag" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_LeaderboardRow}" />

    <!-- ListBoxItem Style -->
    <Style x:Key="A_Style_ListBoxItem_DriverList" TargetType="ListBoxItem">
        <Setter Property="OverridesDefaultStyle"  Value="True" />
        <Setter Property="Height" Value="{StaticResource A_Size_RowHeightWithSpacer}" />
    </Style>


    <!-- Cell Styles -->
    <Style x:Key="A_Style_Cell" TargetType="Control">
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Width" Value="{StaticResource A_Size_ColumnWidth}" />
        <Setter Property="Margin" Value="{StaticResource A_Margin_Cell}" />
    </Style>


    <!-- Cell Templates -->
    <ControlTemplate x:Key="A_ControlTemplate_Cell_Header_Centered" TargetType="ContentControl">
        <Grid>
            <local:FZTextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Center"
                           Style="{StaticResource A_Style_FZTextBlock_DriverListHeading}" />
        </Grid>
    </ControlTemplate>
    
    <ControlTemplate x:Key="A_ControlTemplate_Cell_Header" TargetType="ContentControl">
        <local:FZTextBlock Text="{TemplateBinding Content}"
                           Style="{StaticResource A_Style_FZTextBlock_DriverListHeading}"
                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
    </ControlTemplate>


    <!-- Row Styles -->
    <Style x:Key="A_Style_HeaderRow" TargetType="FrameworkElement">
        <Setter Property="Height" Value="{StaticResource A_Size_HeaderRowHeight}" />
        <Setter Property="Margin" Value="0,0,0,3" />
        <Setter Property="Focusable" Value="False"/>
    </Style>

    <Style x:Key="A_Style_FooterRow" TargetType="Control">
        <Setter Property="Height" Value="{StaticResource A_Size_FooterRowHeight}" />
    </Style>

    <!-- Class Cell -->
    <Style x:Key="A_Style_Control_CarClassBadge_Small_Leaderboard" TargetType="{x:Type Control}" BasedOn="{StaticResource A_Style_Control_CarClassBadge_Small_Default}">
        <Setter Property="Height" Value="35"/>
        <Style.Resources>
            <Style x:Key="A_Style_CarClassPIText_Dynamic" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_IconText}">
                <Setter Property="Text" Value="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_PIConverter}, FallbackValue=?}"/>
                <Setter Property="FontFamily" Value="Horizon_A"/>
                <Setter Property="CapHeight" Value="15"/>
                <Setter Property="Color" Value="{StaticResource A_Color_DriverListRowText}"/>
            </Style>
            <Style x:Key="A_Style_CarClassText_Dynamic" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_CarClassPIText_Dynamic}">
                <Setter Property="CapHeight" Value="15"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Background}"/>
            </Style>
        </Style.Resources>
    </Style>

    <Style x:Key="A_Style_Control_AdvancedCarRestrictions_Leaderboard" TargetType="{x:Type Control}" BasedOn="{StaticResource A_Style_Control_CarClassBadge_Small_Leaderboard}">
        <Setter Property="Template" Value="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_CarClass_To_CarClassBadgeControlTemplate}, FallbackValue={StaticResource A_System_Int_InvalidCarClassRestriction}}" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_Cell_Class">
        <ContentControl Style="{StaticResource A_Style_Control_CarClassBadge_Small_Leaderboard}" local:BindingProxy.A="{Binding PerformanceIndex}" local:BindingProxy.B="{Binding ClassID}"/>
    </ControlTemplate>

    <Style x:Key="A_Style_ContentControl_EventNumberBlock"
           TargetType="ContentControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="66">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_ScreenTitleBlockIcon}" Panel.ZIndex="10">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TitleBlock_Event}"
                                               Text="{local:Loc InGame.IDS_Prerace_Event}"
                                               Margin="20,0,20,0"
                                               VerticalAlignment="Center"/>
                        </local:FZMaterial>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Right}">
                            <StackPanel Orientation="Horizontal" 
                                        VerticalAlignment="Center"
                                        Margin="20,0,20,0">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TitleBlock_CurrentEvent}" Color="{StaticResource A_Color_White}"
                                               Text="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Margin="0,0,5,0" />
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TitleBlock_CurrentEvent}"
                                                   Color="{StaticResource A_Color_White}"
                                                   Text="/" Margin="0,0,0,0" />
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TitleBlock_OfTotalEvents}" Color="{StaticResource A_Color_White}"
                                               Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Margin="5,0,0,0" />
                            </StackPanel>
                        </local:FZMaterial>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- Animations -->
    <Storyboard x:Key="A_Storyboard_LeaderboardItem_Selected">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                    Value="1.03">
            </DiscreteDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                    Value="1.03">
            </DiscreteDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>

    <Storyboard x:Key="A_Storyboard_LeaderboardItem_Unselected">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" >
            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1.0" EasingFunction="{local:CircleEasing}" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" >
            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1.0" EasingFunction="{local:CircleEasing}" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:ZPanel.ZOffset)">
            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" EasingFunction="{local:CircleEasing}"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</ResourceDictionary>