<Application x:Class="XLAB2.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             ShutdownMode="OnMainWindowClose">
    <Application.Resources>
        <LinearGradientBrush x:Key="AppWindowBackgroundBrush" StartPoint="0,0" EndPoint="1,1">
            <GradientStop Color="#FFDCE5EE" Offset="0" />
            <GradientStop Color="#FFC9D6E3" Offset="1" />
        </LinearGradientBrush>
        <SolidColorBrush x:Key="AppPanelBrush" Color="#FFF1F6FB" />
        <SolidColorBrush x:Key="AppSurfaceBrush" Color="#FFFCFEFF" />
        <SolidColorBrush x:Key="AppAccentBrush" Color="#FF5C7FA8" />
        <SolidColorBrush x:Key="AppAccentSoftBrush" Color="#FFD6E3F0" />
        <SolidColorBrush x:Key="AppBorderBrush" Color="#FFAABBCD" />
        <SolidColorBrush x:Key="AppTextBrush" Color="#FF263645" />
        <SolidColorBrush x:Key="AppMutedTextBrush" Color="#FF6B7B88" />
        <SolidColorBrush x:Key="AppButtonBrush" Color="#FFF7FAFD" />
        <SolidColorBrush x:Key="AppButtonHoverBrush" Color="#FFE7F0F9" />
        <SolidColorBrush x:Key="AppSelectionBrush" Color="#FFD8E6F4" />
        <SolidColorBrush x:Key="AppSelectionTextBrush" Color="#FF17324A" />
        <SolidColorBrush x:Key="OpenDocumentTenDaysBrush" Color="#FFF2F8EA" />
        <SolidColorBrush x:Key="OpenDocumentTwentyDaysBrush" Color="#FFFCF4E3" />
        <SolidColorBrush x:Key="OpenDocumentOverdueBrush" Color="#FFFBE7E7" />
        <SolidColorBrush x:Key="OpenDocumentTenDaysIndicatorBrush" Color="#FFB7D79F" />
        <SolidColorBrush x:Key="OpenDocumentTwentyDaysIndicatorBrush" Color="#FFF0C87A" />
        <SolidColorBrush x:Key="OpenDocumentOverdueIndicatorBrush" Color="#FFE2A0A0" />

        <Style TargetType="{x:Type Window}">
            <Setter Property="Background" Value="{StaticResource AppWindowBackgroundBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type GroupBox}">
            <Setter Property="Background" Value="{StaticResource AppPanelBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppAccentBrush}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GroupBox}">
                        <Grid SnapsToDevicePixels="True">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Border Grid.Row="1"
                                    Margin="0,2,0,0"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="1"
                                    CornerRadius="3">
                                <ContentPresenter ContentSource="Content" />
                            </Border>
                            <Border Grid.Row="0"
                                    Margin="12,0,12,0"
                                    Padding="8,0"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Center"
                                    Background="{StaticResource AppWindowBackgroundBrush}">
                                <ContentPresenter ContentSource="Header"
                                                  RecognizesAccessKey="True" />
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type Button}">
            <Setter Property="Background" Value="{StaticResource AppButtonBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
            <Setter Property="Padding" Value="10,4" />
        </Style>

        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Background" Value="{StaticResource AppSurfaceBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
            <Setter Property="Padding" Value="6,3" />
        </Style>

        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="Background" Value="{StaticResource AppSurfaceBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type DatePicker}">
            <Setter Property="Background" Value="{StaticResource AppSurfaceBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type CheckBox}">
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type RadioButton}">
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type Menu}">
            <Setter Property="Background" Value="{StaticResource AppPanelBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type ContextMenu}">
            <Setter Property="Background" Value="{StaticResource AppSurfaceBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
        </Style>

        <Style TargetType="{x:Type MenuItem}">
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
            <Setter Property="Background" Value="Transparent" />
        </Style>

        <Style TargetType="{x:Type ListBox}">
            <Setter Property="Background" Value="{StaticResource AppSurfaceBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
            <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="True" />
            <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
            <Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
        </Style>

        <Style TargetType="{x:Type ListBoxItem}">
            <Setter Property="Padding" Value="0" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="{StaticResource AppSelectionBrush}" />
                    <Setter Property="Foreground" Value="{StaticResource AppSelectionTextBrush}" />
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type DataGrid}">
            <Setter Property="Background" Value="{StaticResource AppSurfaceBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
            <Setter Property="HorizontalGridLinesBrush" Value="#FFD9E3ED" />
            <Setter Property="VerticalGridLinesBrush" Value="#FFD9E3ED" />
            <Setter Property="RowBackground" Value="#FFFEFFFF" />
            <Setter Property="AlternatingRowBackground" Value="#FFF6FAFD" />
            <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
            <Setter Property="EnableRowVirtualization" Value="True" />
            <Setter Property="EnableColumnVirtualization" Value="True" />
            <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
            <Setter Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="True" />
            <Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
            <Setter Property="ColumnHeaderStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type DataGridColumnHeader}">
                        <Setter Property="Background" Value="#FFE4EDF6" />
                        <Setter Property="Foreground" Value="{StaticResource AppAccentBrush}" />
                        <Setter Property="BorderBrush" Value="{StaticResource AppBorderBrush}" />
                        <Setter Property="FontWeight" Value="SemiBold" />
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type DataGridRow}">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Foreground" Value="{StaticResource AppTextBrush}" />
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="{StaticResource AppSelectionBrush}" />
                    <Setter Property="Foreground" Value="{StaticResource AppSelectionTextBrush}" />
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type DataGridCell}">
            <Setter Property="BorderBrush" Value="#FFDCE5EE" />
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="{StaticResource AppSelectionBrush}" />
                    <Setter Property="Foreground" Value="{StaticResource AppSelectionTextBrush}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Application.Resources>
</Application>
