<Window 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:views="using:OF_DL.Gui.Views"
        x:Class="OF_DL.Gui.Views.AboutWindow"
        x:DataType="views:AboutWindow"
        Width="600"
        Height="520"
        MinWidth="550"
        MinHeight="420"
        Title="About OF DL"
        Background="{DynamicResource WindowBackgroundBrush}"
        mc:Ignorable="d">
    <Window.Styles>
        <Style Selector="Button.link">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Foreground" Value="{DynamicResource PrimaryButtonBackgroundBrush}" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Cursor" Value="Hand" />
        </Style>
        <Style Selector="Button.link:pointerover">
            <Setter Property="Foreground" Value="{DynamicResource PrimaryButtonBackgroundHoverBrush}" />
        </Style>
    </Window.Styles>

    <Grid Margin="24"
          RowDefinitions="Auto,*">
        <TextBlock Grid.Row="0"
                   FontSize="28"
                   FontWeight="Bold"
                   Foreground="{DynamicResource TextPrimaryBrush}"
                   Text="About OF DL"
                   Margin="0,0,0,20" />

        <ScrollViewer Grid.Row="1">
            <StackPanel Spacing="16">
                <!-- Application Info Section -->
                <Border Background="{DynamicResource SurfaceBackgroundBrush}"
                        BorderBrush="{DynamicResource SurfaceBorderBrush}"
                        BorderThickness="1"
                        CornerRadius="12"
                        Padding="24"
                        BoxShadow="0 1 3 0 #0F000000, 0 1 2 -1 #0F000000">
                    <StackPanel Spacing="12">
                        <TextBlock FontSize="16"
                                   FontWeight="Bold"
                                   Foreground="{DynamicResource TextPrimaryBrush}"
                                   Text="Application" />

                        <Grid ColumnDefinitions="140,*" RowDefinitions="Auto,Auto">
                            <TextBlock Grid.Row="0" Grid.Column="0"
                                       FontWeight="SemiBold"
                                       Foreground="{DynamicResource TextSecondaryBrush}"
                                       Text="Version" />
                            <TextBlock Grid.Row="0" Grid.Column="1"
                                       Foreground="{DynamicResource TextPrimaryBrush}"
                                       Text="{Binding ProgramVersion}" />

                            <TextBlock Grid.Row="1" Grid.Column="0"
                                       Margin="0,10,0,0"
                                       FontWeight="SemiBold"
                                       Foreground="{DynamicResource TextSecondaryBrush}"
                                       Text="Source Code" />
                            <Button Grid.Row="1" Grid.Column="1"
                                    Margin="0,10,0,0"
                                    Classes="link"
                                    HorizontalAlignment="Left"
                                    Content="{Binding SourceCodeUrl}"
                                    Click="OnOpenSourceCodeClick" />
                        </Grid>
                    </StackPanel>
                </Border>

                <!-- FFmpeg Info Section -->
                <Border Background="{DynamicResource SurfaceBackgroundBrush}"
                        BorderBrush="{DynamicResource SurfaceBorderBrush}"
                        BorderThickness="1"
                        CornerRadius="12"
                        Padding="24"
                        BoxShadow="0 1 3 0 #0F000000, 0 1 2 -1 #0F000000">
                    <StackPanel Spacing="12">
                        <TextBlock FontSize="16"
                                   FontWeight="Bold"
                                   Foreground="{DynamicResource TextPrimaryBrush}"
                                   Text="External Tools" />

                        <StackPanel Spacing="12">
                            <!-- FFmpeg -->
                            <TextBlock Foreground="{DynamicResource TextPrimaryBrush}"
                                       Text="FFmpeg" />
                            <Grid ColumnDefinitions="120,*" RowDefinitions="Auto,Auto" Margin="20,0,0,0">
                                <TextBlock Grid.Row="0" Grid.Column="0"
                                           FontWeight="SemiBold"
                                           Foreground="{DynamicResource TextSecondaryBrush}"
                                           Text="Version" />
                                <TextBlock Grid.Row="0" Grid.Column="1"
                                           Foreground="{DynamicResource TextPrimaryBrush}"
                                           Text="{Binding FfmpegVersion}"
                                           TextWrapping="Wrap" />

                                <TextBlock Grid.Row="1" Grid.Column="0"
                                           Margin="0,8,0,0"
                                           FontWeight="SemiBold"
                                           Foreground="{DynamicResource TextSecondaryBrush}"
                                           Text="License" />
                                <Button Grid.Row="1" Grid.Column="1"
                                        Margin="0,8,0,0"
                                        Classes="link"
                                        HorizontalAlignment="Left"
                                        Content="{Binding FfmpegLicenseUrl}"
                                        Click="OnOpenFfmpegLicenseClick" />
                            </Grid>

                            <!-- FFprobe -->
                            <TextBlock Foreground="{DynamicResource TextPrimaryBrush}"
                                       Text="FFprobe"
                                       Margin="0,4,0,0" />
                            <Grid ColumnDefinitions="120,*" RowDefinitions="Auto,Auto" Margin="20,0,0,0">
                                <TextBlock Grid.Row="0" Grid.Column="0"
                                           FontWeight="SemiBold"
                                           Foreground="{DynamicResource TextSecondaryBrush}"
                                           Text="Version" />
                                <TextBlock Grid.Row="0" Grid.Column="1"
                                           Foreground="{DynamicResource TextPrimaryBrush}"
                                           Text="{Binding FfprobeVersion}"
                                           TextWrapping="Wrap" />

                                <TextBlock Grid.Row="1" Grid.Column="0"
                                           Margin="0,8,0,0"
                                           FontWeight="SemiBold"
                                           Foreground="{DynamicResource TextSecondaryBrush}"
                                           Text="License" />
                                <Button Grid.Row="1" Grid.Column="1"
                                        Margin="0,8,0,0"
                                        Classes="link"
                                        HorizontalAlignment="Left"
                                        Content="{Binding FfprobeLicenseUrl}"
                                        Click="OnOpenFfprobeLicenseClick" />
                            </Grid>
                        </StackPanel>
                    </StackPanel>
                </Border>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Window>
