<Window x:Class="TeamsNetphoneLink.WPF.UpdateWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Update verfügbar" Height="514" Width="833"
        Background="#FF1E1E1E" FontFamily="Segoe UI"
        WindowStyle="ToolWindow" ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen" Closing="Window_Closing">

    <!-- Dark Mode Resources -->
    <Window.Resources>
        <!-- Button Style -->
        <Style TargetType="Button">
            <Setter Property="Background" Value="#FF0078D4"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="Padding" Value="10,5"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Background="{TemplateBinding Background}" 
                                CornerRadius="4" 
                                Padding="{TemplateBinding Padding}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
        </Style>

        <!-- Special Style for Markdown TextBox -->
        <Style x:Key="MarkdownTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
            <Setter Property="FontFamily" Value="Consolas"/>
            <Setter Property="Foreground" Value="#FFD4D4D4"/>
            <Setter Property="Background" Value="#FF1E1E1E"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="IsReadOnly" Value="True"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
            <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/>
        </Style>

        <!-- TextBox Style -->
        <Style TargetType="TextBox">
            <Setter Property="Background" Value="#FF252526"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="#FF3E3E40"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="5"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Border Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                CornerRadius="4">
                            <ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- ProgressBar Style -->
        <Style TargetType="ProgressBar">
            <Setter Property="Background" Value="#FF252526"/>
            <Setter Property="BorderBrush" Value="#FF3E3E40"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Foreground" Value="#FF0078D4"/>
            <Setter Property="Height" Value="10"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ProgressBar">
                        <Grid x:Name="Root">
                            <Border x:Name="PART_Track"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="5"/>
                            <Border x:Name="PART_Indicator"
                                CornerRadius="5"
                                HorizontalAlignment="Left">
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                        <GradientStop Color="#FF0078D4" Offset="0"/>
                                        <GradientStop Color="#FF00B4FF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- TextBlock Style -->
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>

        <!-- Title TextBlock Style -->
        <Style x:Key="TitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Margin" Value="10,10,10,20"/>
        </Style>

        <!-- Status TextBlock Style -->
        <Style x:Key="StatusTextStyle" TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
            <Setter Property="Margin" Value="10,0,10,5"/>
            <Setter Property="Foreground" Value="#FFD4D4D4"/>
        </Style>

    </Window.Resources>

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

        <!-- Title -->
        <TextBlock x:Name="TitleText" 
                   Text="Es ist ein neues Update verfügbar" 
                   Style="{StaticResource TitleTextStyle}"
                   Grid.Row="0"/>

        <!-- Markdown Release Notes -->
        <Border Grid.Row="1" 
                Margin="10,0,10,10" 
                Background="#FF252526" 
                CornerRadius="4"

                BorderBrush="#FF3E3E40"
                BorderThickness="1">
            <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"  Padding="5">
                <TextBox x:Name="ReleaseNotesTextBox" 
                             Style="{StaticResource MarkdownTextBoxStyle}"
                             HorizontalContentAlignment="Left"
                             VerticalContentAlignment="Top"
                             Text="Lade Release Notes..."/>
            </ScrollViewer>
        </Border>

        <!-- Progress Status -->
        <TextBlock x:Name="ProgressStatusText" 
                   Text="" 
                   Style="{StaticResource StatusTextStyle}"
                   Grid.Row="2"/>

        <!-- Progress Bar -->
        <ProgressBar x:Name="UpdateProgress" 
                     Margin="10,0,10,10" 
                     Grid.Row="3"/>

        <!-- Buttons -->
        <StackPanel Grid.Row="4" 
                    HorizontalAlignment="Right" 
                    Orientation="Horizontal" 
                    Margin="0,10,0,0">
            <Button x:Name="CloseButton" 
                    Content="Schließen" 
                    Width="100" 
                    Margin="0,0,10,0" 
                    Click="CloseButton_Click"/>
            <Button x:Name="UpdateButton" 
                    Content="Update durchführen" 
                    Width="150" 
                    Background="Green" 
                    Click="UpdateButton_Click"/>
        </StackPanel>
    </Grid>
</Window>