<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CubeKit.UI.Styles"
    xmlns:icons="using:CubeKit.UI.Icons" 
    xmlns:ToolkitControls="using:CommunityToolkit.WinUI.UI.Controls">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///CubeKit.UI/Styles/CubeThemeDictionary.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="CloseButton" TargetType="Button">
        <Setter Property="Foreground" Value="{ThemeResource SplitButtonForeground}" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="{ThemeResource SplitButtonBorderThemeThickness}" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
        <Setter Property="FocusVisualMargin" Value="-3" />
        <Setter Property="CornerRadius" Value="4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="RootGrid" Background="Transparent" Height="32" Width="40">

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="CloseButtonIconBrush" 
        Storyboard.TargetProperty="Color"
        To="{ThemeResource HvidSortColor}" From="#e96e60" Duration="0:0:0.3"/>
                                        <DoubleAnimation Storyboard.TargetName="Pipe" Storyboard.TargetProperty="Width" EnableDependentAnimation="True" Duration="0:0:0.12" To="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="CloseButtonIconBrush" 
        Storyboard.TargetProperty="Color"
        To="#e96e60" From="{ThemeResource HvidSortColor}" Duration="0:0:0.3"/>
                                        <DoubleAnimation Storyboard.TargetName="Pipe" Storyboard.TargetProperty="Width" EnableDependentAnimation="True" Duration="0:0:0.12" To="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="CloseButtonIconBrush" 
        Storyboard.TargetProperty="Color"
        To="DarkRed" From="#e96e60" Duration="0:0:0.3"/>
                                        <DoubleAnimation Storyboard.TargetName="Pipe" Storyboard.TargetProperty="Width" EnableDependentAnimation="True" Duration="0:0:0.12" To="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <VisualState.Setters>
                                        <Setter Target="ContentPresenter.Foreground" Value="{ThemeResource SplitButtonForegroundDisabled}"/>
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <ContentPresenter x:Name="ContentPresenter"
                                                    BorderBrush="{TemplateBinding BorderBrush}"
                                                    BorderThickness="{TemplateBinding BorderThickness}"
                                                    Content="{TemplateBinding Content}"
                                                    ContentTransitions="{TemplateBinding ContentTransitions}"
                                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                                    Padding="{TemplateBinding Padding}"
                                                    CornerRadius="4"
                                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                    AutomationProperties.AccessibilityView="Raw"/>
                        <icons:FluentSymbolIcon Symbol="Dismiss16" Margin="0, 0, 2, 2" VerticalAlignment="Center">
                            <icons:FluentSymbolIcon.Foreground>
                                <SolidColorBrush x:Name="CloseButtonIconBrush" Color="{ThemeResource HvidSortColor}" />
                            </icons:FluentSymbolIcon.Foreground>
                        </icons:FluentSymbolIcon>
                        <ToolkitControls:DropShadowPanel CornerRadius="2" Margin="2,0,2,2" x:Name="Glow" Color="{ThemeResource SystemAccentColorLight2}" ShadowOpacity="0.93" Grid.Row="0" VerticalAlignment="Bottom"
                HorizontalAlignment="Center">
                            <Grid x:Name="Pipe"
                Height="2" Width="0.1" CornerRadius="2"
                VerticalAlignment="Bottom" 
                HorizontalAlignment="Center">
                                <Grid.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                        <GradientStop Color="{ThemeResource SystemAccentColorLight3}" Offset="0.0" />
                                        <GradientStop Color="{ThemeResource SystemAccentColorLight2}" Offset="0.5" />
                                        <GradientStop Color="{ThemeResource SystemAccentColorLight3}" Offset="1.0" />
                                    </LinearGradientBrush>
                                </Grid.Background>
                            </Grid>
                        </ToolkitControls:DropShadowPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
