<UserControl
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d"
    x:Class="Nebula.Launcher.Views.MainView"
    x:DataType="viewModels:MainViewModel"
    xmlns="https://github.com/avaloniaui"
    xmlns:converters="clr-namespace:Nebula.Launcher.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:models="clr-namespace:Nebula.Shared.Models;assembly=Nebula.Shared"
    xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Design.DataContext>
        <viewModels:MainViewModel />
    </Design.DataContext>
    <UserControl.Background>
        <LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
            <GradientStop Color="#121212" Offset="0.0" />
            <GradientStop Color="#181212" Offset="1.0" />
        </LinearGradientBrush>
    </UserControl.Background>

    <Panel>
        <Grid
            ColumnDefinitions="65,*"
            IsEnabled="{Binding IsEnabled}"
            Margin="0"
            RowDefinitions="*,30">

            <TransitioningContentControl
                Content="{Binding CurrentPage}"
                Grid.Column="1"
                Grid.Row="0" />

            <SplitView
                CompactPaneLength="70"
                DisplayMode="CompactInline"
                Grid.Column="0"
                Grid.ColumnSpan="2"
                Grid.Row="0"
                IsPaneOpen="{Binding IsPaneOpen}"
                PaneBackground="Transparent">
                <SplitView.Pane>
                    <Border
                        BoxShadow="0 0 15 -2 #121212"
                        CornerRadius="0,0,0,0"
                        Grid.Column="0"
                        Grid.Row="0"
                        Margin="0,0,5,0"
                        Padding="0,0,-4,0">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
                                <GradientStop Color="#221f1f" Offset="0.0" />
                                <GradientStop Color="#282222" Offset="0.2" />
                                <GradientStop Color="#232222" Offset="1.0" />
                            </LinearGradientBrush>
                        </Border.Background>
                        <Grid ColumnDefinitions="*" RowDefinitions="*,40">
                            <ListBox
                                Background="Transparent"
                                ItemsSource="{Binding Items}"
                                Padding="0"
                                SelectedItem="{Binding SelectedListItem}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate DataType="{x:Type models:ListItemTemplate}">
                                        <StackPanel Orientation="Horizontal" Spacing="19">
                                            <Svg
                                                Height="40"
                                                Path="{Binding IconKey, Converter={x:Static converters:TypeConverters.IconConverter}}"
                                                Width="40" />
                                            <TextBlock Text="{Binding Label}" VerticalAlignment="Center" />
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                            <Button
                                Classes="ViewSelectButton"
                                Command="{Binding TriggerPaneCommand}"
                                Grid.Row="1"
                                HorizontalAlignment="Stretch"
                                Padding="5,0,5,0"
                                VerticalAlignment="Stretch">
                                <Label HorizontalAlignment="Center" VerticalAlignment="Center">|||</Label>
                            </Button>
                        </Grid>
                    </Border>
                </SplitView.Pane>
            </SplitView>

            <Border
                Background="{StaticResource DefaultGrad}"
                BorderThickness="0,2,0,0"
                CornerRadius="0,0,0,0"
                Grid.Column="0"
                Grid.ColumnSpan="2"
                Grid.Row="1"
                Margin="0,0,0,0"
                Padding="5">
                <Border.BorderBrush>
                    <LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
                        <GradientStop Color="#222222" Offset="0.0" />
                        <GradientStop Color="#442222" Offset="1.0" />
                    </LinearGradientBrush>
                </Border.BorderBrush>
                <Label FontSize="10" Foreground="#777777">
                    <Panel>
                        <Button
                            Background="#00000000"
                            Command="{Binding OpenLink}"
                            CornerRadius="0"
                            HorizontalAlignment="Left"
                            Margin="0"
                            Padding="0"
                            VerticalAlignment="Center">
                            <TextBlock
                                Foreground="#777777"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center">
                                https://cinka.ru/nebula-launcher/
                            </TextBlock>
                        </Button>
                        <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">v0.08-a</TextBlock>
                    </Panel>
                </Label>
            </Border>
        </Grid>

        <Panel IsVisible="{Binding Popup}">
            <Border Background="#111" Opacity="50" />
            <Border
                Background="{StaticResource DefaultBackground}"
                CornerRadius="10"
                Margin="40">
                <Grid RowDefinitions="35,*,20">
                    <Border
                        BorderBrush="{StaticResource DefaultForeground}"
                        BoxShadow="0 2 15 -2 #121212"
                        CornerRadius="10,10,0,0"
                        Grid.Row="0">
                        <Panel Margin="12,0,0,0" VerticalAlignment="Center">
                            <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center">
                                <Label Content="{Binding CurrentTitle}" VerticalAlignment="Center" />
                            </StackPanel>
                            <Button
                                Command="{Binding ClosePopupCommand}"
                                Content="X"
                                CornerRadius="0,10,0,0"
                                HorizontalAlignment="Right"
                                IsVisible="{Binding IsPopupClosable}"
                                Margin="0"
                                Padding="10,8,10,8"
                                VerticalAlignment="Stretch" />
                        </Panel>
                    </Border>

                    <TransitioningContentControl Content="{Binding CurrentPopup}" Grid.Row="1" />

                    <Border
                        BorderBrush="{StaticResource DefaultForeground}"
                        BoxShadow="0 -2 15 -2 #121212"
                        CornerRadius="0,0,10,10"
                        Grid.Row="2">
                        <Panel Margin="12,0,12,0" VerticalAlignment="Center">
                            <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center">
                                <Label
                                    FontSize="8"
                                    Foreground="#666666"
                                    VerticalAlignment="Center">
                                    Дальше бога нет...
                                </Label>
                            </StackPanel>
                        </Panel>
                    </Border>
                </Grid>
            </Border>
        </Panel>
    </Panel>
</UserControl>