<Window x:Class="NexusShell.Views.NexusSetupFlowWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Nexus Installation"
        Width="560" Height="640"
        WindowStartupLocation="CenterScreen"
        WindowStyle="None"
        ResizeMode="NoResize"
        Background="#020712"
        FontFamily="Segoe UI Variable Display, Segoe UI">
    <Grid Background="{StaticResource NexusDesktopBackgroundBrush}">
        <Border VerticalAlignment="Bottom" Height="220" Background="{StaticResource NexusHorizonGlowBrush}" Opacity="0.45"/>
        <Border Style="{StaticResource NexusGlassPanelStyle}"
                MaxWidth="480"
                VerticalAlignment="Center"
                HorizontalAlignment="Center"
                Padding="32">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <!-- Progress -->
                <StackPanel Grid.Row="0" Margin="0,0,0,20">
                    <TextBlock Text="{Binding StepProgressLabel}"
                               Foreground="{StaticResource NexusTextSecondaryBrush}"
                               FontSize="12"
                               HorizontalAlignment="Center"/>
                    <UniformGrid Rows="1" Columns="5" Margin="0,10,0,0">
                        <Border Height="4" CornerRadius="2" Margin="3,0">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#338A4FFF"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsStepActive1}" Value="True">
                                            <Setter Property="Background" Value="#CC00D9FF"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                        <Border Height="4" CornerRadius="2" Margin="3,0">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#338A4FFF"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsStepActive2}" Value="True">
                                            <Setter Property="Background" Value="#CC00D9FF"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                        <Border Height="4" CornerRadius="2" Margin="3,0">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#338A4FFF"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsStepActive3}" Value="True">
                                            <Setter Property="Background" Value="#CC00D9FF"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                        <Border Height="4" CornerRadius="2" Margin="3,0">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#338A4FFF"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsStepActive4}" Value="True">
                                            <Setter Property="Background" Value="#CC00D9FF"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                        <Border Height="4" CornerRadius="2" Margin="3,0">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#338A4FFF"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsStepActive5}" Value="True">
                                            <Setter Property="Background" Value="#CC00D9FF"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                    </UniformGrid>
                </StackPanel>

                <!-- Header -->
                <StackPanel Grid.Row="1" Margin="0,0,0,16">
                    <Border Width="64" Height="64" CornerRadius="18" Background="{StaticResource NexusLogoGradientBrush}" HorizontalAlignment="Center" Margin="0,0,0,12">
                        <TextBlock Text="N" FontSize="34" FontWeight="Bold" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <TextBlock Text="{Binding StepTitle}"
                               FontSize="22"
                               FontWeight="SemiBold"
                               Foreground="{StaticResource NexusTextPrimaryBrush}"
                               HorizontalAlignment="Center"
                               TextAlignment="Center"/>
                    <TextBlock Text="{Binding StepDescription}"
                               Foreground="{StaticResource NexusTextSecondaryBrush}"
                               HorizontalAlignment="Center"
                               TextAlignment="Center"
                               TextWrapping="Wrap"
                               Margin="0,8,0,0"/>
                </StackPanel>

                <!-- Step content -->
                <StackPanel Grid.Row="2" MinHeight="180">
                    <StackPanel Visibility="{Binding IsWelcomeStep, Converter={StaticResource BoolToVisibility}}">
                        <Border Background="#12081428" BorderBrush="#3800D9FF" BorderThickness="1" CornerRadius="12" Padding="16">
                            <StackPanel>
                                <TextBlock Text="Dette flow gør:" Foreground="{StaticResource NexusTextPrimaryBrush}" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                <TextBlock Foreground="{StaticResource NexusTextSecondaryBrush}" TextWrapping="Wrap" LineHeight="22"
                                           Text="• Registrerer enhed i Nexus Identity&#x0a;• Tildeler Device ID og tillidsstatus&#x0a;• Låser Windows — Nexus ejer skrivebordet&#x0a;• Forbereder Agent og Control Center"/>
                            </StackPanel>
                        </Border>
                    </StackPanel>

                    <StackPanel Visibility="{Binding IsOrganizationStep, Converter={StaticResource BoolToVisibility}}">
                        <TextBlock Text="Organisation" Foreground="{StaticResource NexusTextSecondaryBrush}" Margin="0,0,0,4"/>
                        <ComboBox ItemsSource="{Binding Organizations}"
                                  SelectedItem="{Binding SelectedOrganization, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                  DisplayMemberPath="Name"
                                  IsEnabled="{Binding AreInputsEnabled}"
                                  Style="{StaticResource NexusComboBoxStyle}"/>
                        <TextBlock Text="{Binding OrganizationStatusMessage}"
                                   Foreground="{StaticResource NexusTextSecondaryBrush}"
                                   FontSize="12" Margin="0,6,0,0"
                                   Visibility="{Binding ShowOrganizationStatus, Converter={StaticResource BoolToVisibility}}"/>
                    </StackPanel>

                    <StackPanel Visibility="{Binding IsUserStep, Converter={StaticResource BoolToVisibility}}">
                        <TextBlock Text="Bruger" Foreground="{StaticResource NexusTextSecondaryBrush}" Margin="0,0,0,4"/>
                        <TextBox Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                 IsReadOnly="False" IsEnabled="{Binding AreInputsEnabled}"
                                 Style="{StaticResource NexusFormTextBoxStyle}"/>
                    </StackPanel>

                    <StackPanel Visibility="{Binding IsDeviceStep, Converter={StaticResource BoolToVisibility}}">
                        <TextBlock Text="Enhedsnavn" Foreground="{StaticResource NexusTextSecondaryBrush}" Margin="0,0,0,4"/>
                        <TextBox Text="{Binding DeviceFriendlyName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                 IsReadOnly="False" IsEnabled="{Binding AreInputsEnabled}"
                                 Style="{StaticResource NexusFormTextBoxStyle}"/>
                        <TextBlock Margin="0,10,0,0" Foreground="{StaticResource NexusTextSecondaryBrush}" FontSize="12">
                            <Run Text="Windows-navn:"/>
                            <Run Text="{Binding ComputerName}" Foreground="{StaticResource NexusCyanBrush}"/>
                        </TextBlock>
                    </StackPanel>

                    <StackPanel Visibility="{Binding IsSecurityStep, Converter={StaticResource BoolToVisibility}}">
                        <Border Background="#12081428" BorderBrush="#3800D9FF" BorderThickness="1" CornerRadius="12" Padding="14" Margin="0,0,0,12">
                            <StackPanel>
                                <TextBlock Text="Opsummering" Foreground="{StaticResource NexusTextPrimaryBrush}" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                <TextBlock Foreground="{StaticResource NexusTextSecondaryBrush}">
                                    <Run Text="Organisation: "/><Run Text="{Binding SummaryOrganization}" Foreground="#FFFFFF"/>
                                </TextBlock>
                                <TextBlock Foreground="{StaticResource NexusTextSecondaryBrush}" Margin="0,4,0,0">
                                    <Run Text="Bruger: "/><Run Text="{Binding SummaryUser}" Foreground="#FFFFFF"/>
                                </TextBlock>
                                <TextBlock Foreground="{StaticResource NexusTextSecondaryBrush}" Margin="0,4,0,0">
                                    <Run Text="Enhed: "/><Run Text="{Binding SummaryDevice}" Foreground="#FFFFFF"/>
                                </TextBlock>
                            </StackPanel>
                        </Border>
                        <Border Background="#22100828" BorderBrush="#668A4FFF" BorderThickness="1" CornerRadius="12" Padding="14">
                            <TextBlock Foreground="{StaticResource NexusTextSecondaryBrush}" TextWrapping="Wrap" LineHeight="20"
                                       Text="Efter installation skjules Windows taskbar. Lockdown er aktiv. POC: Brug Ctrl+Shift+Alt+U med admin-PIN for midlertidig oplåsning."/>
                        </Border>
                    </StackPanel>
                </StackPanel>

                <TextBlock Grid.Row="3"
                           Text="{Binding ErrorMessage}"
                           Foreground="{StaticResource NexusCyanBrush}"
                           TextWrapping="Wrap"
                           Margin="0,8,0,0"
                           MinHeight="18"/>

                <!-- Footer -->
                <Grid Grid.Row="4" Margin="0,16,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"
                            Content="Annuller"
                            Command="{Binding CancelCommand}"
                            Style="{StaticResource NexusGlassButtonStyle}"
                            HorizontalAlignment="Left"/>
                    <Button Grid.Column="1"
                            Content="Tilbage"
                            Command="{Binding BackCommand}"
                            Style="{StaticResource NexusGlassButtonStyle}"
                            Margin="0,0,8,0"/>
                    <Button Grid.Column="2"
                            Content="{Binding NextButtonLabel}"
                            Command="{Binding NextCommand}"
                            IsEnabled="{Binding CanGoNext}"
                            Style="{StaticResource NexusPrimaryActionButtonStyle}"
                            MinWidth="160"/>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</Window>
