<UserControl x:Class="LANCommander.PlaynitePlugin.Views.Authentication"
			 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"
             xmlns:ViewModels="clr-namespace:LANCommander.PlaynitePlugin.ViewModels"
			 mc:Ignorable="d"
			 d:DesignHeight="300" d:DesignWidth="275" d:DataContext="{d:DesignInstance Type=ViewModels:Authentication, IsDesignTimeCreatable=True}">
    <d:DesignerProperties.DesignStyle>
        <Style TargetType="UserControl">
            <Setter Property="Background" Value="White" />
        </Style>
    </d:DesignerProperties.DesignStyle>

    <Grid Margin="20">
        <Grid.Resources>
            <sys:Double x:Key="FontSizeSmall">12</sys:Double>
            <sys:Double x:Key="FontSize">14</sys:Double>
            <sys:Double x:Key="FontSizeLarge">15</sys:Double>
            <sys:Double x:Key="FontSizeLarger">20</sys:Double>
            <sys:Double x:Key="FontSizeLargest">29</sys:Double>
            <FontFamily x:Key="FontFamily">Trebuchet MS</FontFamily>
            <FontFamily x:Key="MonospaceFontFamily">Consolas</FontFamily>
            <Thickness x:Key="PopupBorderThickness">1</Thickness>
            <Thickness x:Key="ControlBorderThickness">1</Thickness>
            <sys:Double x:Key="EllipseBorderThickness">1</sys:Double>
            <CornerRadius x:Key="ControlCornerRadius">1</CornerRadius>
            <Thickness x:Key="SidebarItemPadding">8</Thickness>

            <Color x:Key="BlackColor">#FF000000</Color>
            <Color x:Key="WhiteColor">#FFFFFFFF</Color>
            <Color x:Key="TextColor">#f2f2f2</Color>
            <Color x:Key="TextColorDarker">#a3a3a3</Color>
            <Color x:Key="TextColorDark">#FF000000</Color>
            <Color x:Key="MainColor">#2C3A67</Color>
            <Color x:Key="MainColorDark">#0D1225</Color>
            <Color x:Key="HoverColor">#247BA0</Color>
            <Color x:Key="GlyphColor">#55CDFF</Color>
            <Color x:Key="HighlightGlyphColor">#8855CDFF</Color>
            <Color x:Key="PopupBackgroundColor">#171e26</Color>
            <Color x:Key="PopupBorderColor">#3e6184</Color>
            <Color x:Key="BackgroundToneColor">#2C3A67</Color>
            <Color x:Key="GridItemBackgroundColor">#151e3d</Color>
            <Color x:Key="PanelSeparatorColor">#662C3A67</Color>
            <Color x:Key="WindowPanelSeparatorColor">#3355CDFF</Color>
            <Color x:Key="DataChangeNotifColor">#ffa500</Color>

            <SolidColorBrush x:Key="ControlBackgroundBrush" Color="Transparent" />
            <SolidColorBrush x:Key="TextBrush" Color="{DynamicResource TextColor}" />
            <SolidColorBrush x:Key="TextBrushDarker" Color="{DynamicResource TextColorDarker}" />
            <SolidColorBrush x:Key="TextBrushDark" Color="{DynamicResource TextColorDark}" />
            <SolidColorBrush x:Key="NormalBrush" Color="{DynamicResource MainColor}" />
            <SolidColorBrush x:Key="NormalBrushDark" Color="{DynamicResource MainColorDark}" />
            <SolidColorBrush x:Key="NormalBorderBrush" Color="#5555CDFF" />
            <SolidColorBrush x:Key="HoverBrush" Color="{DynamicResource HighlightGlyphColor}" />
            <SolidColorBrush x:Key="GlyphBrush" Color="{DynamicResource GlyphColor}" />
            <SolidColorBrush x:Key="HighlightGlyphBrush" Color="{DynamicResource HighlightGlyphColor}" />
            <SolidColorBrush x:Key="PopupBorderBrush" Color="{DynamicResource PopupBorderColor}" />
            <SolidColorBrush x:Key="TooltipBackgroundBrush" Color="{DynamicResource BackgroundToneColor}" />
            <SolidColorBrush x:Key="ButtonBackgroundBrush" Color="#0a0e1e" />
            <SolidColorBrush x:Key="GridItemBackgroundBrush" Color="{DynamicResource GridItemBackgroundColor}" />
            <SolidColorBrush x:Key="PanelSeparatorBrush" Color="{DynamicResource PanelSeparatorColor}" />
            <SolidColorBrush x:Key="WindowPanelSeparatorBrush" Color="{DynamicResource WindowPanelSeparatorColor}" />
            <SolidColorBrush x:Key="PopupBackgroundBrush" Color="#1f2847" />
            <SolidColorBrush x:Key="CheckBoxCheckMarkBkBrush" Color="{DynamicResource MainColorDark}" />
            <SolidColorBrush x:Key="DataChangeNotifBrush" Color="{DynamicResource DataChangeNotifColor}" />

            <SolidColorBrush x:Key="PositiveRatingBrush" Color="#78ffa0" />
            <SolidColorBrush x:Key="NegativeRatingBrush" Color="#ff6b6b" />
            <SolidColorBrush x:Key="MixedRatingBrush" Color="#fffca1" />

            <SolidColorBrush x:Key="WarningBrush" Color="#ff6b6b" />

            <LinearGradientBrush x:Key="ExpanderBackgroundBrush" StartPoint="-0.1,0.5" EndPoint="1.2,1" >
                <GradientStop Color="#FF2C3A67" Offset="0"/>
                <GradientStop Color="#002C3A67" Offset="0.7"/>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="WindowBackgourndBrush" StartPoint="0.5,-0.2" EndPoint="0.4,1" >
                <GradientStop Color="#202b4d" Offset="0"/>
                <GradientStop Color="{DynamicResource MainColorDark}" Offset="0.4"/>
            </LinearGradientBrush>

            <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource BaseStyle}">
                <Setter Property="Margin" Value="0, 0, 0, 20" />
                <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
                <Setter Property="SnapsToDevicePixels" Value="True" />
                <Setter Property="AllowDrop" Value="True" />
                <Setter Property="CaretBrush" Value="{DynamicResource TextBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
                <Setter Property="BorderThickness" Value="{DynamicResource ControlBorderThickness}" />
                <Setter Property="Padding" Value="3" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TextBox}">
                            <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}"
                            Style="{DynamicResource HighlightBorder}" BorderBrush="{TemplateBinding BorderBrush}">
                                <ScrollViewer x:Name="PART_ContentHost"
                                      VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
                                      HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" TargetName="Border" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" />
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style TargetType="TextBlock">
                <Setter Property="Margin" Value="0, 0, 20, 20" />
                <Setter Property="FontSize" Value="{DynamicResource FontSize}" />
                <Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value="0.5" />
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource BaseStyle}">
                <Setter Property="Background" Value="{DynamicResource ButtonBackgroundBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource GlyphBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}" />
                <Setter Property="BorderThickness" Value="{DynamicResource ControlBorderThickness}" />
                <Setter Property="SnapsToDevicePixels" Value="True" />
                <Setter Property="Padding" Value="10,5,10,5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"                            
                            CornerRadius="{DynamicResource ControlCornerRadius}" Style="{DynamicResource HighlightBorder}"
                            BorderBrush="{TemplateBinding BorderBrush}">
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" TargetName="Border" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                        <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" />
                    </Trigger>
                    <Trigger Property="IsFocused" Value="True">
                        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                        <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style TargetType="{x:Type PasswordBox}">
                <Setter Property="Margin" Value="0, 0, 0, 20" />
                <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
                <Setter Property="SnapsToDevicePixels" Value="True" />
                <Setter Property="CaretBrush" Value="{DynamicResource TextBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
                <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
                <Setter Property="BorderThickness" Value="{DynamicResource ControlBorderThickness}" />
                <Setter Property="Padding" Value="3" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type PasswordBox}">
                            <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}"
                            BorderBrush="{TemplateBinding BorderBrush}">
                                <ScrollViewer x:Name="PART_ContentHost" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" TargetName="Border" />
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="BorderBrush" Value="{DynamicResource GlyphBrush}" TargetName="Border" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="Server Address" />
        <TextBox Grid.Row="0" Grid.Column="1" Name="ServerAddress" Text="{Binding ServerAddress}" KeyDown="TextBox_KeyDown" />
        <TextBlock Grid.Row="1" Grid.Column="0" Text="Username"/>
        <TextBox Grid.Row="1" Grid.Column="1" Name="Username" Text="{Binding UserName}" KeyDown="TextBox_KeyDown" />
        <TextBlock Grid.Row="2" Grid.Column="0" Text="Password" />
        <PasswordBox Grid.Row="2" Grid.Column="1" Name="Password" PasswordChanged="Password_PasswordChanged" KeyDown="TextBox_KeyDown" />

        <GridSplitter Grid.Row="4" />

        <Grid Grid.Row="5" Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Button Grid.Row="0" Grid.Column="0" Click="LoginButton_Click" x:Name="LoginButton">Login</Button>
            <Button Grid.Row="0" Grid.Column="1" Click="RegisterButton_Click" x:Name="RegisterButton">Register</Button>
        </Grid>
    </Grid>
</UserControl>