<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="clr-namespace:ServerSelector.ViewModels"
             mc:Ignorable="d" d:DesignWidth="370" d:DesignHeight="300"
             x:Class="ServerSelector.Views.MainView"
			 xmlns:ui="using:FluentAvalonia.UI.Controls"
			 >
    <UserControl.Styles>
        <!-- Modern Utility Button Style -->
        <Style Selector="Button.utility">
            <Setter Property="Width" Value="32"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="Background" Value="#3E3E42"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="FontWeight" Value="DemiBold"/>
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="Foreground" Value="#FFFFFF"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="CornerRadius" Value="4"/>
            <Setter Property="Content" Value="•••"/>
            <Setter Property="Transitions">
                <Transitions>
                    <BrushTransition Property="Background" Duration="0:0:0.2" Easing="CubicEaseOut"/>
                    <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut"/>
                    <DoubleTransition Property="Opacity" Duration="0:0:0.2"/>
                </Transitions>
            </Setter>
            <Setter Property="Template">
                <ControlTemplate>
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding CornerRadius}">
                        <ContentPresenter Name="PART_ContentPresenter"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        Padding="{TemplateBinding Padding}"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter>
        </Style>
        <Style Selector="Button.utility:pointerover">
            <Setter Property="Background" Value="#4b4b4e"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="RenderTransform" Value="translateY(-1px)"/>
            <Setter Property="Opacity" Value="0.9"/>
        </Style>
        <Style Selector="Button.utility:pressed">
            <Setter Property="Background" Value="#505054"/>
            <Setter Property="RenderTransform" Value="translateY(1px)"/>
            <Setter Property="Opacity" Value="0.8"/>
        </Style>

        <!-- Modern Save Button Style -->
        <Style Selector="Button.save-button">
            <Setter Property="Width" Value="120"/>
            <Setter Property="Height" Value="38"/>
            <Setter Property="Background" Value="#3CB371"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Padding" Value="16,8"/>
            <Setter Property="CornerRadius" Value="4"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Transitions">
                <Transitions>
                    <BrushTransition Property="Background" Duration="0:0:0.2" Easing="CubicEaseOut"/>
                    <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut"/>
                    <DoubleTransition Property="Opacity" Duration="0:0:0.2"/>
                </Transitions>
            </Setter>
        </Style>
        <Style Selector="Button.save-button:pointerover">
            <Setter Property="Background" Value="#45C67D"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Opacity" Value="0.95"/>
        </Style>
        <Style Selector="Button.save-button:pressed">
            <Setter Property="Background" Value="#318F5A"/>
            <Setter Property="Opacity" Value="0.9"/>
            <Setter Property="RenderTransform" Value="scale(0.98)"/>
        </Style>
    </UserControl.Styles>

	<Grid>
		<TabControl x:Name="MainUI">
			<TabItem Header="PC" x:Name="TabPc">
				<Grid Margin="5">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="auto"></ColumnDefinition>
						<ColumnDefinition Width="*"></ColumnDefinition>
						<ColumnDefinition Width="auto"></ColumnDefinition>
					</Grid.ColumnDefinitions>

					<Grid.RowDefinitions>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
					</Grid.RowDefinitions>


					<TextBlock VerticalAlignment="Center" Margin="5" Grid.Row="0" Grid.Column="0" ToolTip.Tip="The folder with the game and launcher folders.">Game root path: </TextBlock>
					<TextBox x:Name="txtGamePath" Grid.Row="0" Grid.Column="1" TextChanged="GamePath_TextChanged" ToolTip.Tip="The folder with the game and launcher folders.">C:\NIKKE\</TextBox>
					<Button x:Name="btnSelectGamePath" Grid.Row="0" Grid.Column="2" Classes="utility" Click="BtnSelectGamePath_Click">...</Button>

					<TextBlock VerticalAlignment="Center" Margin="5" Grid.Row="4" Grid.Column="0">Server: </TextBlock>

					<ComboBox SelectedIndex="0" x:Name="CmbServerSelection" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" SelectionChanged="CmbServerSelection_SelectionChanged" HorizontalAlignment="Stretch">
						<ComboBox.Items>
							<ComboBoxItem>Official</ComboBoxItem>
							<ComboBoxItem>Local</ComboBoxItem>
						</ComboBox.Items>
					</ComboBox>

					<TextBlock x:Name="LblIp" VerticalAlignment="Center" Margin="5" Grid.Row="6" Grid.Column="0">IP: </TextBlock>
					<TextBox x:Name="TxtIpAddress" Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2">127.0.0.1</TextBox>

					<CheckBox x:Name="ChkOffline" VerticalAlignment="Center" Margin="5" Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="3" ToolTip.Tip="Enables the ability to run the game offline by making the game download the assets from the server, and not the official server. This only works if enableOffline is enabled on the server. Please note that this should not be enabled on public servers due to copyright issues, as assets are downloaded through said server. This is required if you want to use an older version of the game.">Enable offline mode</CheckBox>

					<TextBlock Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" TextWrapping="WrapWithOverflow" VerticalAlignment="Center" Margin="5" x:Name="LblStatus" ToolTip.Tip="Shows the status of the patches to the game. All patches are reverted when server is set to official.">Status: OK</TextBlock>
					<Button HorizontalAlignment="Right"
                            Margin="5"
                            Click="Save_Click"
                            Grid.Row="10"
                            Grid.Column="1"
                            Grid.ColumnSpan="2"
                            Classes="save-button">
                        Save Changes
                    </Button>
				</Grid>
			</TabItem>
			<TabItem Header="Android">
				<Grid Margin="5">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="auto"></ColumnDefinition>
						<ColumnDefinition Width="*"></ColumnDefinition>
						<ColumnDefinition Width="auto"></ColumnDefinition>
					</Grid.ColumnDefinitions>

					<Grid.RowDefinitions>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition Height="5"></RowDefinition>
						<RowDefinition Height="auto"></RowDefinition>
					</Grid.RowDefinitions>


					<TextBlock Grid.Row="0" Grid.Column="0"  VerticalAlignment="Center" Margin="5">APK path: </TextBlock>
					<TextBox x:Name="txtApkPath" Grid.Row="0" Grid.Column="1"></TextBox>
					<Button x:Name="btnSelectApkPath" Grid.Row="0" Grid.Column="2" Classes="utility">...</Button>


					<TextBlock VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Margin="5">IP: </TextBlock>
					<TextBox x:Name="TxtAndroidIpAddress" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2">127.0.0.1</TextBox>

					<Button HorizontalAlignment="Right" Margin="5" Click="Save_Click" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Classes="accent" IsEnabled="False">Coming soon!</Button>
				</Grid>
			</TabItem>
		</TabControl>

		<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="LoadingUI" IsVisible="False">
			<ui:ProgressRing Height="48" Width="48"></ui:ProgressRing>
			<TextBlock>Please wait...</TextBlock>
		</StackPanel>
	</Grid>
</UserControl>
