<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"
        mc:Ignorable="d" d:DesignWidth="520" d:DesignHeight="360"
        x:Class="PhotoboothUploader.MainWindow"
        Width="520" Height="360"
        Title="Fotospiel Photobooth Uploader">
    <Grid Margin="24" ColumnDefinitions="*,8,*">
        <StackPanel Grid.Column="0" Spacing="12" MaxWidth="420">
            <TextBlock Text="Fotospiel Photobooth Uploader" FontSize="20" FontWeight="SemiBold" />

            <Border Background="#1F000000" Padding="12" CornerRadius="8">
                <StackPanel Spacing="6">
                    <TextBlock Text="Schritte" FontWeight="SemiBold" />
                    <TextBlock x:Name="StepCodeText" Text="1. Code eingeben" />
                    <TextBlock x:Name="StepFolderText" Text="2. Upload-Ordner wählen" />
                    <TextBlock x:Name="StepReadyText" Text="3. Upload läuft" />
                </StackPanel>
            </Border>

            <TextBlock Text="Gib den 6-stelligen Verbindungscode ein." TextWrapping="Wrap" />
            <TextBox x:Name="CodeBox" MaxLength="6" Watermark="123456" />
            <Button x:Name="ConnectButton" Content="Verbinden" Click="ConnectButton_Click" />

            <StackPanel Spacing="6">
                <TextBlock Text="Upload-Ordner" FontWeight="SemiBold" />
                <TextBlock x:Name="FolderText" Text="Noch nicht ausgewählt." TextWrapping="Wrap" />
                <Button x:Name="PickFolderButton" Content="Ordner auswählen" Click="PickFolderButton_Click" IsEnabled="False" />
            </StackPanel>

            <ToggleSwitch x:Name="QuietToggle" Content="Ruhiger Modus (nur Fehler anzeigen)" />
        </StackPanel>

        <StackPanel Grid.Column="2" Spacing="12" MaxWidth="380">
            <Border Background="#1F000000" Padding="12" CornerRadius="8">
                <StackPanel Spacing="6">
                    <TextBlock Text="Status" FontWeight="SemiBold" />
                    <TextBlock x:Name="StatusText" Text="Nicht verbunden." TextWrapping="Wrap" />
                    <TextBlock x:Name="LastUploadText" Text="Letzter Upload: —" />
                </StackPanel>
            </Border>

            <StackPanel Spacing="6">
                <TextBlock Text="Letzte Uploads" FontWeight="SemiBold" />
                <ItemsControl x:Name="RecentUploadsList" ItemsSource="{Binding RecentUploads}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Border Background="#14000000" Padding="8" CornerRadius="6" Margin="0,0,0,6">
                                <Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto">
                                    <TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding FileName}" />
                                    <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding StatusLabel}" />
                                    <TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding UpdatedLabel}" Opacity="0.7" FontSize="11" />
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <Button x:Name="RetryFailedButton" Content="Fehlgeschlagene erneut senden" Click="RetryFailedButton_Click" IsEnabled="False" />
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>
