<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="Sonex.Client.AppWindows.AboutWindow"
    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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="using:Sonex.Client.AppWindows"
    mc:Ignorable="d"
    
    Title="About Sonex">
    <Window.SystemBackdrop>
        <MicaBackdrop />
    </Window.SystemBackdrop>
    <Grid x:Name="RootGrid" MinWidth="400" >
        <!-- Background -->
        <Image
            x:Name="BackgroundImage"
            Stretch="UniformToFill" 
            />

        <!-- Overlay -->
        <Rectangle x:Name="BackgroundOverlay" />

        <!-- Centered content -->
        <Grid 
            MaxWidth="800"
            MinWidth="400"
            
            HorizontalAlignment="Center"
            >

            <Grid.RowDefinitions>
                <RowDefinition Height="44" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!-- Title bar -->
            <Grid
                x:Name="AppTitleBar"
                Grid.Row="0"
                Height="44"
                Background="Transparent">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition x:Name="LeftInsetColumn" Width="0" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition x:Name="RightInsetColumn" Width="0" />
                </Grid.ColumnDefinitions>

                <Grid Grid.Column="1" Padding="24,0,16,0">
                    <!--<TextBlock
                        Text="About Sonex"
                        FontSize="16"
                        FontWeight="SemiBold"
                        VerticalAlignment="Center"
                        Opacity="0.9" />-->
                </Grid>
            </Grid>

            <!-- Header About Sonex -->
            <TextBlock
                Grid.Row="1"
                Margin="24,0,24,0"
                Text="About Sonex"
                FontSize="20"
                FontWeight="SemiBold"
                VerticalAlignment="Center" />

            <!-- Sonex description -->
            <Border
                Grid.Row="2"
                Margin="24,16,24,0"
                Padding="18"
                CornerRadius="10"
                Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
                BorderThickness="1">

                <TextBlock
                    Text="Sonex is an internal application developed to support warehouse operations and the continuous improvement of operational processes. It combines practical tools, integrations, and enhancements that help users perform daily tasks faster, more conveniently, and more effectively."
                    TextWrapping="WrapWholeWords"
                    Opacity="0.92" />
            </Border>

            <!-- Roles header -->
            <Grid
                Grid.Row="3"
                Margin="24,24,24,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBlock
                    Text="Roles within the Sonex project"
                    FontSize="20"
                    FontWeight="SemiBold"
                    VerticalAlignment="Center" />

                <TextBlock
                    Grid.Column="1"
                    Text="{x:Bind ContributorCountText, Mode=OneWay}"
                    VerticalAlignment="Center"
                    Opacity="0.60" />
            </Grid>

            <!-- List -->
            <ScrollViewer
                Grid.Row="4"
                Margin="24,12,24,16"
                VerticalScrollBarVisibility="Auto"
                HorizontalScrollBarVisibility="Disabled">

                <ItemsControl ItemsSource="{x:Bind Contributors, Mode=OneWay}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate x:DataType="local:ContributorInfo">
                            <Border
                                Margin="0,0,0,12"
                                Padding="18"
                                CornerRadius="10"
                                Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                                BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
                                BorderThickness="1">

                                <Grid ColumnSpacing="20">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="1" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>

                                    <!-- Left -->
                                    <StackPanel
                                        Grid.Column="0"
                                        Spacing="6"
                                        VerticalAlignment="Top">

                                        <TextBlock
                                            Text="{x:Bind Name}"
                                            FontSize="20"
                                            FontWeight="SemiBold"
                                            TextWrapping="WrapWholeWords" />

                                        <TextBlock
                                            Text="{x:Bind Role}"
                                            Opacity="0.76"
                                            TextWrapping="WrapWholeWords" />

                                        <HyperlinkButton
                                            Content="{x:Bind Email}"
                                            NavigateUri="{x:Bind MailToUri}"
                                            HorizontalAlignment="Left"
                                            Padding="0"
                                            Margin="0,4,0,0" />
                                    </StackPanel>

                                    <!-- Divider -->
                                    <Border
                                        Grid.Column="1"
                                        Margin="0,2"
                                        Background="{ThemeResource CardStrokeColorDefaultBrush}" />

                                    <!-- Right -->
                                    <StackPanel
                                        Grid.Column="2"
                                        Spacing="6"
                                        VerticalAlignment="Top">

                                        <TextBlock
                                            Text="Responsibilities"
                                            FontWeight="SemiBold"
                                            Opacity="0.82" />

                                        <TextBlock
                                            Text="{x:Bind Description}"
                                            TextWrapping="WrapWholeWords"
                                            Opacity="0.88" />
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

            <!-- Footer -->
            <Border
                Grid.Row="5"
                Margin="24,0,24,24"
                Padding="0,14,0,0"
                BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
                BorderThickness="0,1,0,0">

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Spacing="4">
                        <TextBlock
                            Text="{x:Bind VersionText, Mode=OneWay}"
                            Opacity="0.72" />

                        <TextBlock
                            Text="© Xenos B.V. All rights reserved."
                            Opacity="0.72" />
                    </StackPanel>

                    <Button
                        Grid.Column="1"
                        Content="Close"
                        MinWidth="96"
                        VerticalAlignment="Center"
                        Click="CloseButton_Click" />
                </Grid>
            </Border>
        </Grid>
    </Grid>
</Window>