<!--
    Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
    the MIT License. See LICENSE in the project root for license information.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:local="using:Microsoft.Terminal.Settings.Editor"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
                    mc:Ignorable="d">

    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Light">
            <Style x:Key="SecondaryTextBlockStyle"
                   TargetType="TextBlock">
                <Setter Property="Foreground" Value="{ThemeResource SystemBaseMediumColor}" />
            </Style>
            <SolidColorBrush x:Key="SubgroupHeaderBrush"
                             Color="{StaticResource SystemBaseMediumColor}" />
            <Color x:Key="CardStrokeColorDefault">#0F000000</Color>
            <SolidColorBrush x:Key="CardStrokeColorDefaultBrush"
                             Color="{StaticResource CardStrokeColorDefault}" />
            <StaticResource x:Key="ExpanderHeaderBorderBrush"
                            ResourceKey="CardStrokeColorDefaultBrush" />
        </ResourceDictionary>
        <ResourceDictionary x:Key="HighContrast">
            <Style x:Key="SecondaryTextBlockStyle"
                   TargetType="TextBlock" />
            <!--  Do not mess with the foreground color for High Contrast. Let it ride as is.  -->
            <SolidColorBrush x:Key="SubgroupHeaderBrush"
                             Color="{ThemeResource SystemColorWindowTextColor}" />
            <StaticResource x:Key="ExpanderHeaderBorderBrush"
                            ResourceKey="SystemColorButtonTextColorBrush" />
        </ResourceDictionary>
        <ResourceDictionary x:Key="Dark">
            <Style x:Key="SecondaryTextBlockStyle"
                   TargetType="TextBlock">
                <Setter Property="Foreground" Value="{ThemeResource SystemBaseMediumColor}" />
            </Style>
            <SolidColorBrush x:Key="SubgroupHeaderBrush"
                             Color="{StaticResource SystemBaseMediumColor}" />
            <Color x:Key="CardStrokeColorDefault">#19000000</Color>
            <SolidColorBrush x:Key="CardStrokeColorDefaultBrush"
                             Color="{StaticResource CardStrokeColorDefault}" />
            <StaticResource x:Key="ExpanderHeaderBorderBrush"
                            ResourceKey="CardStrokeColorDefaultBrush" />
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>

    <Style x:Key="StackPanelInExpanderStyle"
           TargetType="StackPanel">
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Padding" Value="0,12,0,12" />
    </Style>

    <Style x:Key="SettingContainerResetButtonStyle"
           TargetType="Button">
        <Setter Property="Margin" Value="5,0,0,0" />
        <Setter Property="Height" Value="19" />
        <Setter Property="Width" Value="19" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Background" Value="Transparent" />
    </Style>

    <Style x:Key="SettingContainerFontIconStyle"
           TargetType="FontIcon">
        <Setter Property="Foreground" Value="{StaticResource SystemAccentColor}" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
    </Style>

    <Style x:Key="NonExpanderGrid"
           TargetType="Grid">
        <Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}" />
        <Setter Property="MinWidth" Value="{ThemeResource FlyoutThemeMinWidth}" />
        <Setter Property="MinHeight" Value="64" />
        <Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" />
        <Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" />
        <Setter Property="Padding" Value="16,0,8,0" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
    </Style>

    <Style x:Key="SettingsPageItemHeaderStyle"
           BasedOn="{StaticResource BodyTextBlockStyle}"
           TargetType="TextBlock">
        <Setter Property="LineHeight" Value="20" />
        <Setter Property="TextWrapping" Value="WrapWholeWords" />
    </Style>

    <Style x:Key="SettingsPageItemDescriptionStyle"
           BasedOn="{StaticResource CaptionTextBlockStyle}"
           TargetType="TextBlock">
        <Setter Property="Margin" Value="0,0,24,0" />
        <Setter Property="LineHeight" Value="16" />
        <Setter Property="Foreground" Value="{ThemeResource SubgroupHeaderBrush}" />
        <Setter Property="TextWrapping" Value="WrapWholeWords" />
    </Style>

    <Style TargetType="local:SettingContainer">
        <Setter Property="Margin" Value="0,4,0,0" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="MaxWidth" Value="1000" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SettingContainer">
                    <Grid AutomationProperties.Name="{TemplateBinding Header}"
                          Style="{StaticResource NonExpanderGrid}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <StackPanel Style="{StaticResource StackPanelInExpanderStyle}">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource SettingsPageItemHeaderStyle}"
                                           Text="{TemplateBinding Header}" />
                                <Button x:Name="ResetButton"
                                        Style="{StaticResource SettingContainerResetButtonStyle}">
                                    <FontIcon Glyph="&#xE845;"
                                              Style="{StaticResource SettingContainerFontIconStyle}" />
                                </Button>
                            </StackPanel>
                            <TextBlock x:Name="HelpTextBlock"
                                       Style="{StaticResource SettingsPageItemDescriptionStyle}"
                                       Text="{TemplateBinding HelpText}" />
                        </StackPanel>
                        <ContentPresenter Grid.Column="1"
                                          HorizontalAlignment="Right"
                                          VerticalAlignment="Center"
                                          Content="{TemplateBinding Content}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ExpanderSettingContainerStyle"
           TargetType="local:SettingContainer">
        <Setter Property="MaxWidth" Value="1000" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SettingContainer">
                    <muxc:Expander x:Name="Expander"
                                   Margin="0,4,0,0"
                                   HorizontalAlignment="Stretch"
                                   HorizontalContentAlignment="Stretch"
                                   Content="{TemplateBinding Content}"
                                   IsExpanded="{TemplateBinding StartExpanded}">
                        <muxc:Expander.Header>
                            <Grid MinHeight="64">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <StackPanel Style="{StaticResource StackPanelInExpanderStyle}">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource SettingsPageItemHeaderStyle}"
                                                   Text="{TemplateBinding Header}" />
                                        <Button x:Name="ResetButton"
                                                Style="{StaticResource SettingContainerResetButtonStyle}">
                                            <FontIcon Glyph="&#xE845;"
                                                      Style="{StaticResource SettingContainerFontIconStyle}" />
                                        </Button>
                                    </StackPanel>
                                    <TextBlock x:Name="HelpTextBlock"
                                               Style="{StaticResource SettingsPageItemDescriptionStyle}"
                                               Text="{TemplateBinding HelpText}" />
                                </StackPanel>
                                <TextBlock Grid.Column="1"
                                           MaxWidth="250"
                                           Margin="0,0,-16,0"
                                           HorizontalAlignment="Right"
                                           VerticalAlignment="Center"
                                           FontFamily="Segoe UI, Segoe Fluent Icons, Segoe MDL2 Assets"
                                           Style="{StaticResource SettingsPageItemDescriptionStyle}"
                                           Text="{TemplateBinding CurrentValue}" />
                            </Grid>
                        </muxc:Expander.Header>
                    </muxc:Expander>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
