<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="FFU Builder UI" FontSize="14" FontFamily="Segoe UI Variable, Segoe UI" WindowState="Maximized">

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

        <!-- Navigation + Content Layout -->
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!-- Navigation Sidebar -->
            <DockPanel Grid.Column="0" LastChildFill="True">
                <!-- Navigation item style defined per-ListBox to avoid leaking into ComboBox dropdowns -->
                <!-- Settings button at bottom -->
                <ListBox x:Name="lstNavSettings" DockPanel.Dock="Bottom" BorderThickness="0" Background="Transparent" Margin="0,4,0,0">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListBoxItem">
                                        <Grid>
                                            <!-- Content area with rounded background -->
                                            <Border x:Name="ContentBorder" Background="Transparent" CornerRadius="4" Padding="{TemplateBinding Padding}" Margin="4,2,4,2">
                                                <ContentPresenter VerticalAlignment="Center"/>
                                            </Border>
                                            <!-- Left accent indicator pill - overlaid, doesn't shift content -->
                                            <Rectangle x:Name="SelectionIndicator" Width="3" Height="16" RadiusX="2" RadiusY="2" Fill="{DynamicResource {x:Static SystemColors.AccentColorBrushKey}}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" Visibility="Collapsed"/>
                                        </Grid>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="ContentBorder" Property="Background">
                                                    <Setter.Value>
                                                        <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Opacity="0.1"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter TargetName="SelectionIndicator" Property="Visibility" Value="Visible"/>
                                                <Setter TargetName="ContentBorder" Property="Background">
                                                    <Setter.Value>
                                                        <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Opacity="0.15"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBoxItem x:Name="navSettings" Padding="12,8" Margin="4,0" Tag="Settings">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE713;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Settings" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                </ListBox>
                <!-- Separator above Settings -->
                <Separator DockPanel.Dock="Bottom" Margin="8,4"/>
                <!-- Main navigation items -->
                <ListBox x:Name="lstNavigation" BorderThickness="0" Background="Transparent" SelectedIndex="0">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListBoxItem">
                                        <Grid>
                                            <!-- Content area with rounded background -->
                                            <Border x:Name="ContentBorder" Background="Transparent" CornerRadius="4" Padding="{TemplateBinding Padding}" Margin="4,2,4,2">
                                                <ContentPresenter VerticalAlignment="Center"/>
                                            </Border>
                                            <!-- Left accent indicator pill - overlaid, doesn't shift content -->
                                            <Rectangle x:Name="SelectionIndicator" Width="3" Height="16" RadiusX="2" RadiusY="2" Fill="{DynamicResource {x:Static SystemColors.AccentColorBrushKey}}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" Visibility="Collapsed"/>
                                        </Grid>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="ContentBorder" Property="Background">
                                                    <Setter.Value>
                                                        <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Opacity="0.1"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter TargetName="SelectionIndicator" Property="Visibility" Value="Visible"/>
                                                <Setter TargetName="ContentBorder" Property="Background">
                                                    <Setter.Value>
                                                        <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" Opacity="0.15"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBoxItem x:Name="navHome" Padding="12,8" Margin="4,0" IsSelected="True" Tag="Home">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE80F;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Home" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navHyperV" Padding="12,8" Margin="4,0" Tag="Hyper-V Settings">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE7F8;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Hyper-V Settings" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navWindows" Padding="12,8" Margin="4,0" Tag="Windows Settings">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE7F4;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Windows Settings" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navUpdates" Padding="12,8" Margin="4,0" Tag="Updates">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE895;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Updates" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navApplications" Padding="12,8" Margin="4,0" Tag="Applications">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE71D;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Applications" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navOffice" Padding="12,8" Margin="4,0" Tag="M365 Apps/Office">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xED28;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="M365 Apps/Office" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navDrivers" Padding="12,8" Margin="4,0" Tag="Drivers">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE964;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Drivers" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navBuild" Padding="12,8" Margin="4,0" Tag="Build">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE943;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Build" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                    <ListBoxItem x:Name="navMonitor" Padding="12,8" Margin="4,0" Tag="Monitor">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE7FC;" FontFamily="Segoe Fluent Icons,Segoe MDL2 Assets" FontSize="16" VerticalAlignment="Center" Margin="0,0,12,0"/>
                            <TextBlock Text="Monitor" VerticalAlignment="Center"/>
                        </StackPanel>
                    </ListBoxItem>
                </ListBox>
            </DockPanel>

            <!-- Content Area -->
            <Grid Grid.Column="1" Margin="12,0,0,0">
                <!-- Shared page shell -->
                <Border Background="{DynamicResource ApplicationBackgroundBrush}" BorderThickness="0" CornerRadius="12">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <!-- Shared page title -->
                        <TextBlock x:Name="txtPageTitle" Grid.Row="0" Margin="16,16,16,12" FontSize="24" FontWeight="SemiBold" Text="Home"/>

                        <!-- Page host -->
                        <Grid Grid.Row="1">
                            <!-- PAGE: Home -->
                            <ScrollViewer x:Name="pageHome" VerticalScrollBarVisibility="Auto">
                                <Grid Margin="16,0,16,16">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <StackPanel Grid.Row="0" Margin="0,0,0,24">
                                        <TextBlock Text="Build Status" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" CornerRadius="4" Padding="16,12">
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="160"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                </Grid.RowDefinitions>

                                                <TextBlock Text="Current build" Grid.Row="0" Grid.Column="0" FontWeight="SemiBold" Margin="0,0,12,8"/>
                                                <TextBlock x:Name="txtHomeCurrentBuildValue" Text="Checking..." Grid.Row="0" Grid.Column="1" Margin="0,0,0,8" TextWrapping="Wrap"/>

                                                <TextBlock Text="Latest release" Grid.Row="1" Grid.Column="0" FontWeight="SemiBold" Margin="0,0,12,8"/>
                                                <TextBlock x:Name="txtHomeLatestReleaseValue" Text="Checking GitHub..." Grid.Row="1" Grid.Column="1" Margin="0,0,0,8" TextWrapping="Wrap"/>

                                                <TextBlock Text="Status" Grid.Row="2" Grid.Column="0" FontWeight="SemiBold" Margin="0,0,12,8"/>
                                                <TextBlock x:Name="txtHomeReleaseStatusValue" Text="Checking whether this build is current..." Grid.Row="2" Grid.Column="1" Margin="0,0,0,8" TextWrapping="Wrap"/>

                                                <TextBlock Text="What's New" Grid.Row="3" Grid.Column="0" FontWeight="SemiBold" Margin="0,0,12,0" VerticalAlignment="Top"/>
                                                <StackPanel x:Name="spHomeReleaseNotesSections" Grid.Row="3" Grid.Column="1"/>
                                            </Grid>
                                        </Border>
                                    </StackPanel>

                                    <StackPanel Grid.Row="1" Margin="0,0,0,24">
                                        <TextBlock Text="Environment Checks" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" CornerRadius="4" Padding="16,12">
                                            <StackPanel>
                                                <StackPanel Orientation="Horizontal" Margin="0,0,0,12">
                                                    <Ellipse x:Name="ellipseHomeDiskSpaceStatus" Width="14" Height="14" Fill="Gold" Margin="0,3,10,0" VerticalAlignment="Top"/>
                                                    <StackPanel>
                                                        <TextBlock Text="Free disk space" FontWeight="SemiBold"/>
                                                        <TextBlock x:Name="txtHomeDiskSpaceStatusValue" Text="Checking free disk space..." TextWrapping="Wrap"/>
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel Orientation="Horizontal">
                                                    <Ellipse x:Name="ellipseHomeHyperVStatus" Width="14" Height="14" Fill="Gold" Margin="0,3,10,0" VerticalAlignment="Top"/>
                                                    <StackPanel>
                                                        <TextBlock Text="Hyper-V status" FontWeight="SemiBold"/>
                                                        <TextBlock x:Name="txtHomeHyperVStatusValue" Text="Checking Hyper-V installation status..." TextWrapping="Wrap"/>
                                                    </StackPanel>
                                                </StackPanel>
                                            </StackPanel>
                                        </Border>
                                    </StackPanel>

                                    <StackPanel Grid.Row="2" Margin="0,0,0,24">
                                        <TextBlock Text="Latest Discussions" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" CornerRadius="4" Padding="16,12">
                                            <StackPanel>
                                                <TextBlock x:Name="txtHomeDiscussionsStatusValue" Text="Checking latest discussions..." Margin="0,0,0,12" TextWrapping="Wrap"/>
                                                <TextBlock x:Name="tbDiscussion1" Margin="0,0,0,8" Visibility="Collapsed">
                                                    <Hyperlink x:Name="linkDiscussion1" NavigateUri="https://github.com/rbalsleyMSFT/FFU/discussions">
                                                        <Run x:Name="runDiscussion1" Text=""/>
                                                    </Hyperlink>
                                                </TextBlock>
                                                <TextBlock x:Name="tbDiscussion2" Margin="0,0,0,8" Visibility="Collapsed">
                                                    <Hyperlink x:Name="linkDiscussion2" NavigateUri="https://github.com/rbalsleyMSFT/FFU/discussions">
                                                        <Run x:Name="runDiscussion2" Text=""/>
                                                    </Hyperlink>
                                                </TextBlock>
                                                <TextBlock x:Name="tbDiscussion3" Margin="0,0,0,8" Visibility="Collapsed">
                                                    <Hyperlink x:Name="linkDiscussion3" NavigateUri="https://github.com/rbalsleyMSFT/FFU/discussions">
                                                        <Run x:Name="runDiscussion3" Text=""/>
                                                    </Hyperlink>
                                                </TextBlock>
                                                <TextBlock x:Name="tbDiscussion4" Margin="0,0,0,8" Visibility="Collapsed">
                                                    <Hyperlink x:Name="linkDiscussion4" NavigateUri="https://github.com/rbalsleyMSFT/FFU/discussions">
                                                        <Run x:Name="runDiscussion4" Text=""/>
                                                    </Hyperlink>
                                                </TextBlock>
                                                <TextBlock x:Name="tbDiscussion5" Margin="0,0,0,8" Visibility="Collapsed">
                                                    <Hyperlink x:Name="linkDiscussion5" NavigateUri="https://github.com/rbalsleyMSFT/FFU/discussions">
                                                        <Run x:Name="runDiscussion5" Text=""/>
                                                    </Hyperlink>
                                                </TextBlock>
                                                <TextBlock x:Name="tbDiscussionsLink">
                                                    <Hyperlink x:Name="linkDiscussions" NavigateUri="https://github.com/rbalsleyMSFT/FFU/discussions">View all discussions</Hyperlink>
                                                </TextBlock>
                                            </StackPanel>
                                        </Border>
                                    </StackPanel>

                                    <StackPanel Grid.Row="3">
                                        <TextBlock Text="Resources" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" CornerRadius="4" Padding="16,12">
                                            <StackPanel>
                                                <TextBlock Margin="0,0,0,8">
                                                    <Hyperlink x:Name="linkQuickStart" NavigateUri="https://rbalsleymsft.github.io/FFU/quickstart.html">FFU Builder Quick Start</Hyperlink>
                                                </TextBlock>
                                                <TextBlock Margin="0,0,0,8">
                                                    <Hyperlink x:Name="linkDocs" NavigateUri="https://rbalsleymsft.github.io/FFU/">Documentation Home</Hyperlink>
                                                </TextBlock>
                                                <TextBlock Margin="0,0,0,8">
                                                    <Hyperlink x:Name="linkGitHub" NavigateUri="https://github.com/rbalsleyMSFT/FFU">GitHub Repository</Hyperlink>
                                                </TextBlock>
                                                <TextBlock Margin="0,0,0,8">
                                                    <Hyperlink x:Name="linkReleases" NavigateUri="https://github.com/rbalsleyMSFT/FFU/releases">GitHub Releases</Hyperlink>
                                                </TextBlock>
                                                <TextBlock Margin="0,0,0,8">
                                                    <Hyperlink x:Name="linkChangelog" NavigateUri="https://github.com/rbalsleyMSFT/FFU/blob/main/ChangeLog.md">Change Log</Hyperlink>
                                                </TextBlock>
                                                <TextBlock>
                                                    <Hyperlink x:Name="linkVideo1" NavigateUri="https://youtu.be/kOIK5OmDugc">FFU Builder Quick Start Video</Hyperlink>
                                                </TextBlock>
                                            </StackPanel>
                                        </Border>
                                    </StackPanel>
                                </Grid>
                            </ScrollViewer>

                            <!-- PAGE: Hyper-V Settings -->
                            <ScrollViewer x:Name="pageHyperV" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                <StackPanel Margin="16,0,16,16">
                                    <!-- Enable VM Networking -->
                                    <CheckBox x:Name="chkEnableVMNetworking" Content="Enable VM Networking (Experimental)" Margin="0,0,0,12" ToolTip="Connect the build VM to the selected Hyper-V switch during provisioning. Leave this off for the default offline build path because internet-connected Sysprep is still experimental."/>
                                    <StackPanel x:Name="spVMNetworkingSettings" Margin="0,0,0,20" IsEnabled="False">
                                        <!-- VM Switch Name -->
                                        <TextBlock Text="VM Switch Name" Margin="0,0,0,8" ToolTip="Select or enter the Hyper-V virtual switch to use when experimental VM networking is enabled."/>
                                        <ComboBox x:Name="cmbVMSwitchName" HorizontalAlignment="Stretch" Margin="0,0,0,20" ToolTip="Select or enter the Hyper-V virtual switch to use when experimental VM networking is enabled."/>
                                        <!-- Custom VM Switch Name -->
                                        <TextBox x:Name="txtCustomVMSwitchName" HorizontalAlignment="Stretch" Visibility="Collapsed" Margin="0,0,0,0" ToolTip="Enter your custom VM Switch Name if 'Other' is selected."/>
                                    </StackPanel>
                                    <!-- Memory (GB) -->
                                    <TextBlock Text="Memory (GB)" Margin="0,0,0,8" ToolTip="Amount of memory to allocate for the virtual machine. Recommended to use 8GB if possible, especially for Windows 11. Default is 4GB."/>
                                    <TextBox x:Name="txtMemory" HorizontalAlignment="Stretch" Text="4" Margin="0,0,0,20" ToolTip="Amount of memory to allocate for the virtual machine. Recommended to use 8GB if possible, especially for Windows 11. Default is 4GB."/>
                                    <!-- Processors -->
                                    <TextBlock Text="Processors" Margin="0,0,0,8" ToolTip="Number of virtual processors for the virtual machine. Recommended to use at least 4."/>
                                    <TextBox x:Name="txtProcessors" HorizontalAlignment="Stretch" Text="4" Margin="0,0,0,20" ToolTip="Number of virtual processors for the virtual machine. Recommended to use at least 4."/>
                                    <!-- VM Location -->
                                    <TextBlock Text="VM Location" Margin="0,0,0,8" ToolTip="Default is $FFUDevelopmentPath\VM. This is the location of the VHDX that gets created where Windows will be installed to."/>
                                    <TextBox x:Name="txtVMLocation" HorizontalAlignment="Stretch" Text="{x:Static sys:Environment.CurrentDirectory}" Margin="0,0,0,20" ToolTip="Default is $FFUDevelopmentPath\VM. This is the location of the VHDX that gets created where Windows will be installed to."/>
                                    <!-- VM Name Prefix -->
                                    <TextBlock Text="VM Name Prefix" Margin="0,0,0,8" ToolTip="Prefix for the VM Name. The default is _FFU."/>
                                    <TextBox x:Name="txtVMNamePrefix" HorizontalAlignment="Stretch" Margin="0,0,0,20" ToolTip="Prefix for the VM Name. The default is _FFU."/>
                                    <!-- Disk Layout -->
                                    <Expander Header="Disk Layout" Margin="0,0,0,20" IsExpanded="True">
                                        <StackPanel Margin="0,10,0,0">
                                            <TextBlock Text="FFU Builder defaults to using a 50GB VHDX. Below you can modify the disk size, add additional data/primary partitions, change the drive letters, and set the partition sizes for the Windows, Recovery, and data partitions. The total of the partition sizes must be less than or equal to the Disk Size. The Recovery partition will auto-size based on the size of WinRE.wim from the Windows media with additional buffer as per Microsoft recommendations. You can adjust the size of the recovery partition if needed (not recommended).&#x0a;&#x0a;You can only reorder the additional data partitions." TextWrapping="Wrap" Margin="0,0,0,16"/>
                                            <TextBlock Text="Disk Size (GB)" Margin="0,0,0,8" ToolTip="Size of the virtual hard disk for the virtual machine. Default is a 50GB dynamic disk."/>
                                            <TextBox x:Name="txtDiskSize" Width="160" HorizontalAlignment="Left" Text="50" Margin="0,0,0,16" ToolTip="Size of the virtual hard disk for the virtual machine. Default is a 50GB dynamic disk."/>

                                            <StackPanel Orientation="Horizontal" Margin="0,0,0,16">
                                                <Ellipse x:Name="ellipseDiskLayoutCapacityStatus" Width="14" Height="14" Fill="Gold" Margin="0,3,10,0" VerticalAlignment="Top"/>
                                                <StackPanel>
                                                    <TextBlock Text="Partition capacity" FontWeight="SemiBold"/>
                                                    <TextBlock x:Name="txtDiskLayoutCapacityStatusValue" Text="Checking disk layout capacity..." TextWrapping="Wrap"/>
                                                </StackPanel>
                                            </StackPanel>

                                            <StackPanel Visibility="Collapsed">
                                                <ComboBox x:Name="cmbSystemPartitionDriveLetter" SelectedIndex="18"><ComboBoxItem Content="A"/><ComboBoxItem Content="B"/><ComboBoxItem Content="C"/><ComboBoxItem Content="D"/><ComboBoxItem Content="E"/><ComboBoxItem Content="F"/><ComboBoxItem Content="G"/><ComboBoxItem Content="H"/><ComboBoxItem Content="I"/><ComboBoxItem Content="J"/><ComboBoxItem Content="K"/><ComboBoxItem Content="L"/><ComboBoxItem Content="M"/><ComboBoxItem Content="N"/><ComboBoxItem Content="O"/><ComboBoxItem Content="P"/><ComboBoxItem Content="Q"/><ComboBoxItem Content="R"/><ComboBoxItem Content="S"/><ComboBoxItem Content="T"/><ComboBoxItem Content="U"/><ComboBoxItem Content="V"/><ComboBoxItem Content="W"/><ComboBoxItem Content="X"/><ComboBoxItem Content="Y"/><ComboBoxItem Content="Z"/></ComboBox>
                                                <ComboBox x:Name="cmbWindowsPartitionDriveLetter" SelectedIndex="22"><ComboBoxItem Content="A"/><ComboBoxItem Content="B"/><ComboBoxItem Content="C"/><ComboBoxItem Content="D"/><ComboBoxItem Content="E"/><ComboBoxItem Content="F"/><ComboBoxItem Content="G"/><ComboBoxItem Content="H"/><ComboBoxItem Content="I"/><ComboBoxItem Content="J"/><ComboBoxItem Content="K"/><ComboBoxItem Content="L"/><ComboBoxItem Content="M"/><ComboBoxItem Content="N"/><ComboBoxItem Content="O"/><ComboBoxItem Content="P"/><ComboBoxItem Content="Q"/><ComboBoxItem Content="R"/><ComboBoxItem Content="S"/><ComboBoxItem Content="T"/><ComboBoxItem Content="U"/><ComboBoxItem Content="V"/><ComboBoxItem Content="W"/><ComboBoxItem Content="X"/><ComboBoxItem Content="Y"/><ComboBoxItem Content="Z"/></ComboBox>
                                                <ComboBox x:Name="cmbRecoveryPartitionDriveLetter" SelectedIndex="17"><ComboBoxItem Content="A"/><ComboBoxItem Content="B"/><ComboBoxItem Content="C"/><ComboBoxItem Content="D"/><ComboBoxItem Content="E"/><ComboBoxItem Content="F"/><ComboBoxItem Content="G"/><ComboBoxItem Content="H"/><ComboBoxItem Content="I"/><ComboBoxItem Content="J"/><ComboBoxItem Content="K"/><ComboBoxItem Content="L"/><ComboBoxItem Content="M"/><ComboBoxItem Content="N"/><ComboBoxItem Content="O"/><ComboBoxItem Content="P"/><ComboBoxItem Content="Q"/><ComboBoxItem Content="R"/><ComboBoxItem Content="S"/><ComboBoxItem Content="T"/><ComboBoxItem Content="U"/><ComboBoxItem Content="V"/><ComboBoxItem Content="W"/><ComboBoxItem Content="X"/><ComboBoxItem Content="Y"/><ComboBoxItem Content="Z"/></ComboBox>
                                                <TextBox x:Name="txtOSPartitionSizeGB"/>
                                                <TextBox x:Name="txtRecoveryPartitionSizeGB"/>
                                            </StackPanel>

                                            <TextBlock Text="Add Partition" FontWeight="SemiBold" Margin="0,0,0,8"/>

                                            <Grid Margin="0,0,0,12">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="2*"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="140"/>
                                                    <ColumnDefinition Width="130"/>
                                                    <ColumnDefinition Width="160"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                </Grid.RowDefinitions>
                                                <TextBlock Grid.Row="0" Grid.Column="0" Text="Name" Margin="0,0,8,8"/>
                                                <TextBlock Grid.Row="0" Grid.Column="1" Text="Drive Letter" Margin="0,0,8,8"/>
                                                <TextBlock Grid.Row="0" Grid.Column="2" Text="Size (GB)" Margin="0,0,8,8"/>
                                                <TextBlock Grid.Row="0" Grid.Column="3" Text="Fill Remaining" Margin="0,0,8,8"/>
                                                <TextBlock Grid.Row="0" Grid.Column="4" Text="Persist Drive Letter" Margin="0,0,8,8"/>
                                                <TextBlock Grid.Row="0" Grid.Column="5" Text=" " Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtDataPartitionName" Grid.Row="1" Grid.Column="0" Margin="0,0,8,0" ToolTip="Name and volume label for the data partition."/>
                                                <ComboBox x:Name="cmbDataPartitionDriveLetter" Grid.Row="1" Grid.Column="1" Margin="0,0,8,0" ToolTip="Configured data-partition drive letter. The build VM always uses it; physical devices use it when Persist Drive Letter is selected.">
                                                    <ComboBoxItem Content="D" IsSelected="True"/>
                                                    <ComboBoxItem Content="E"/>
                                                    <ComboBoxItem Content="F"/>
                                                    <ComboBoxItem Content="G"/>
                                                    <ComboBoxItem Content="H"/>
                                                    <ComboBoxItem Content="I"/>
                                                    <ComboBoxItem Content="J"/>
                                                    <ComboBoxItem Content="K"/>
                                                    <ComboBoxItem Content="L"/>
                                                    <ComboBoxItem Content="M"/>
                                                    <ComboBoxItem Content="N"/>
                                                    <ComboBoxItem Content="O"/>
                                                    <ComboBoxItem Content="P"/>
                                                    <ComboBoxItem Content="Q"/>
                                                    <ComboBoxItem Content="R"/>
                                                    <ComboBoxItem Content="S"/>
                                                    <ComboBoxItem Content="T"/>
                                                    <ComboBoxItem Content="U"/>
                                                    <ComboBoxItem Content="V"/>
                                                    <ComboBoxItem Content="W"/>
                                                    <ComboBoxItem Content="X"/>
                                                    <ComboBoxItem Content="Y"/>
                                                    <ComboBoxItem Content="Z"/>
                                                </ComboBox>
                                                <TextBox x:Name="txtDataPartitionSizeGB" Grid.Row="1" Grid.Column="2" Margin="0,0,8,0" ToolTip="Data partition size in GB. Leave blank only when Fill Remaining is selected."/>
                                                <CheckBox x:Name="chkDataPartitionFillRemaining" Grid.Row="1" Grid.Column="3" Margin="0,0,8,0" VerticalAlignment="Center" ToolTip="Use the remaining VHDX space for this data partition. Only one data partition can fill remaining space."/>
                                                <CheckBox x:Name="chkDataPartitionPersistDriveLetter" Grid.Row="1" Grid.Column="4" Margin="0,0,8,0" VerticalAlignment="Center" ToolTip="Use the configured letter on physical devices. If cleared, deployed Windows assigns the next available letter from D: upward. The build VM always uses the configured letter. FFU deployment USB letters may be shifted."/>
                                                <Button x:Name="btnAddDataPartition" Grid.Row="1" Grid.Column="5" Content="Add Data Partition" Width="160" ToolTip="Add the configured data partition to the build configuration."/>
                                            </Grid>

                                            <TextBlock Text="VHDX Partition Layout" FontWeight="SemiBold" Margin="0,0,0,8"/>

                                            <Grid Margin="0,0,0,12">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>
                                                <ListView x:Name="lstDataPartitions" Grid.Column="0" Height="220" Margin="0" SelectionMode="Single" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"/>
                                                <StackPanel Grid.Column="1" Margin="12,0,0,0" VerticalAlignment="Top">
                                                    <Button x:Name="btnMoveDataPartitionTop" Content="&#x2912;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" Margin="0,0,0,8" ToolTip="Move selected data partition to the top of the data partition group" />
                                                    <Button x:Name="btnMoveDataPartitionUp" Content="&#x2191;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" Margin="0,0,0,8" ToolTip="Move selected data partition up" />
                                                    <Button x:Name="btnMoveDataPartitionDown" Content="&#x2193;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" Margin="0,0,0,8" ToolTip="Move selected data partition down" />
                                                    <Button x:Name="btnMoveDataPartitionBottom" Content="&#x2913;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" ToolTip="Move selected data partition to the bottom of the data partition group" />
                                                </StackPanel>
                                            </Grid>

                                            <StackPanel Orientation="Horizontal" Margin="0,0,0,0">
                                                <Button x:Name="btnRemoveSelectedDataPartitions" Content="Remove Selected" Width="140" Margin="0,0,8,0" ToolTip="Remove checked data partitions or the Recovery partition from the list."/>
                                                <Button x:Name="btnClearDataPartitions" Content="Clear" Width="80" ToolTip="Clear all additional data partitions."/>
                                                <Button x:Name="btnResetDiskLayoutToDefaults" Content="Reset to Default" Width="140" Margin="8,0,0,0" ToolTip="Restore the default partition layout and remove all additional data partitions. Disk Size and Logical Sector Size are not changed."/>
                                                <Button x:Name="btnRestoreRecoveryPartition" Content="Restore Recovery" Width="140" Margin="8,0,0,0" Visibility="Collapsed" ToolTip="Restore the Windows Recovery partition after removing it."/>
                                            </StackPanel>
                                        </StackPanel>
                                    </Expander>
                                    <!-- Logical Sector Size -->
                                    <TextBlock Text="Logical Sector Size" Margin="0,0,0,8" ToolTip="Unit32 value of 512 or 4096. Useful for 4Kn drives or devices shipping with UFS drives. Default is 512."/>
                                    <ComboBox x:Name="cmbLogicalSectorSize" HorizontalAlignment="Left" ToolTip="Unit32 value of 512 or 4096. Useful for 4Kn drives or devices shipping with UFS drives. Default is 512.">
                                        <ComboBoxItem Content="512" IsSelected="True"/>
                                        <ComboBoxItem Content="4096"/>
                                    </ComboBox>
                                </StackPanel>
                            </ScrollViewer>

                            <!-- TAB: Windows Settings -->
                            <ScrollViewer x:Name="pageWindows" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                <StackPanel Margin="16,0,16,16">
                                    <!-- Windows Media Source -->
                                    <TextBlock Text="Windows Media Source" Margin="0,0,0,8" ToolTip="Choose whether to download Windows ESD from Microsoft or provide your own Windows ISO file."/>
                                    <StackPanel x:Name="cmbWindowsMediaSource" Margin="0,0,0,20">
                                        <RadioButton x:Name="rbDownloadESD" Content="Download Windows ESD" IsChecked="True" Margin="0,0,0,8" GroupName="WindowsMediaSource" ToolTip="Download the latest Windows ESD file from Microsoft."/>
                                        <RadioButton x:Name="rbProvideISO" Content="Provide Windows ISO" Margin="0" GroupName="WindowsMediaSource" ToolTip="Use your own Windows ISO file."/>
                                    </StackPanel>
                                    <!-- Windows ISO Path (visible only when "Provide Windows ISO" is selected) -->
                                    <StackPanel x:Name="isoPathPanel" Visibility="Collapsed">
                                        <TextBlock Text="Windows ISO Path" Margin="0,0,0,8" ToolTip="Path to the Windows ISO file."/>
                                        <Grid Margin="0,0,0,20">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtISOPath" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch" ToolTip="Path to the Windows ISO file."/>
                                            <Button x:Name="btnBrowseISO" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>
                                    <!-- Windows Release -->
                                    <TextBlock Text="Windows Release" Margin="0,0,0,8" ToolTip="Integer value of 10 or 11. This is used to identify which release of Windows to download. Default is 11."/>
                                    <ComboBox x:Name="cmbWindowsRelease" HorizontalAlignment="Stretch" Margin="0,0,0,20" ToolTip="Integer value of 10 or 11. This is used to identify which release of Windows to download. Default is 11."/>
                                    <!-- Windows Version -->
                                    <TextBlock Text="Windows Version" Margin="0,0,0,8" ToolTip="String value of the Windows version to download. This is used to identify which version of Windows to download. Default is '24h2'."/>
                                    <ComboBox x:Name="cmbWindowsVersion" Width="120" HorizontalAlignment="Left" IsEnabled="False" Margin="0,0,0,20" ToolTip="String value of the Windows version to download. This is used to identify which version of Windows to download. Default is '24h2'."/>
                                    <!-- Windows Architecture -->
                                    <TextBlock Text="Windows Architecture" Margin="0,0,0,8" ToolTip="String value of 'x86' or 'x64'. This is used to identify which architecture of Windows to download. Default is 'x64'."/>
                                    <ComboBox x:Name="cmbWindowsArch" Width="120" HorizontalAlignment="Left" Margin="0,0,0,20" ToolTip="String value of 'x86' or 'x64'. This is used to identify which architecture of Windows to download. Default is 'x64'."/>
                                    <!-- Windows Language -->
                                    <StackPanel x:Name="WindowsLangStackPanel" Margin="0,0,0,8">
                                        <TextBlock Text="Windows Language" ToolTip="String value in language-region format (e.g., 'en-us'). This is used to identify which language of media to download. Default is 'en-us'."/>
                                    </StackPanel>
                                    <ComboBox x:Name="cmbWindowsLang" Width="120" HorizontalAlignment="Left" Margin="0,0,0,20" ToolTip="String value in language-region format (e.g., 'en-us'). This is used to identify which language of media to download. Default is 'en-us'."/>
                                    <!-- Windows SKU -->
                                    <TextBlock Text="Windows SKU" Margin="0,0,0,8" ToolTip="Edition of Windows to be installed. Available SKUs depend on the selected Windows Release. Client (10/11): Home, Home N, Home Single Language, Education, Education N, Pro, Pro N, Pro Education, Pro Education N, Pro for Workstations, Pro N for Workstations, Enterprise, Enterprise N. LTSC (2016/2019/2021/2024): Enterprise 2016 LTSB, Enterprise N 2016 LTSB, Enterprise LTSC, Enterprise N LTSC, IoT Enterprise LTSC, IoT Enterprise N LTSC. Server (2016/2019/2022/2025): Standard, Standard (Desktop Experience), Datacenter, Datacenter (Desktop Experience)."/>
                                    <ComboBox x:Name="cmbWindowsSKU" HorizontalAlignment="Stretch" Margin="0,0,0,20" ToolTip="Edition of Windows to be installed. Available SKUs depend on the selected Windows Release. Client (10/11): Home, Home N, Home Single Language, Education, Education N, Pro, Pro N, Pro Education, Pro Education N, Pro for Workstations, Pro N for Workstations, Enterprise, Enterprise N. LTSC (2016-2024): Enterprise LTSC, Enterprise N LTSC, IoT Enterprise LTSC. Server (2016-2025): Standard, Standard (Desktop Experience), Datacenter, Datacenter (Desktop Experience)."/>
                                    <!-- Media Type -->
                                    <StackPanel x:Name="MediaTypeStackPanel" Margin="0,0,0,8">
                                        <TextBlock Text="Media Type" ToolTip="String value of either 'business' or 'consumer'. This is used to identify which media type to download. Default is 'consumer'."/>
                                    </StackPanel>
                                    <ComboBox x:Name="cmbMediaType" Width="120" HorizontalAlignment="Left" Margin="0,0,0,20" ToolTip="String value of either 'business' or 'consumer'. This is used to identify which media type to download. Default is 'consumer'."/>
                                    <!-- Product Key -->
                                    <TextBlock Text="Product Key" Margin="0,0,0,8" ToolTip="Product key for the Windows edition specified in WindowsSKU. This will overwrite whatever SKU is entered for WindowsSKU. Recommended to use if you want to use a MAK or KMS key to activate Enterprise or Education. If using VL media instead of consumer media, you'll want to enter a MAK or KMS key here."/>
                                    <TextBox x:Name="txtProductKey" HorizontalAlignment="Stretch" Margin="0,0,0,20" ToolTip="Product key for the Windows edition. Recommended for MAK or KMS keys."/>
                                    <!-- Optional Features -->
                                    <Expander x:Name="expOptionalFeatures" Header="Optional Features" IsExpanded="False" Margin="0" ExpandDirection="Down">
                                        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,8,0,0">
                                            <StackPanel x:Name="stackFeaturesContainer" Margin="32,0,0,0">
                                                <TextBlock Text="Selected features (semicolon):" Margin="0,0,0,8" FontStyle="Italic"/>
                                            </StackPanel>
                                        </ScrollViewer>
                                    </Expander>
                                </StackPanel>
                            </ScrollViewer>

                            <!-- TAB: Updates -->
                            <ScrollViewer x:Name="pageUpdates" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                <StackPanel Margin="16,0,16,16">
                                    <CheckBox x:Name="chkUpdateLatestCU" Content="Update Latest Cumulative Update" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest cumulative update for Windows. Default is $false."/>
                                    <CheckBox x:Name="chkUpdateLatestNet" Content="Update .NET" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest .NET Framework for Windows. Default is $false."/>
                                    <CheckBox x:Name="chkUpdateLatestDefender" Content="Update Defender" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest Windows Defender definitions and Defender platform update. Default is $false."/>
                                    <CheckBox x:Name="chkUpdateEdge" Content="Update Edge" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest Microsoft Edge for Windows. Default is $false."/>
                                    <CheckBox x:Name="chkUpdateOneDrive" Content="Update OneDrive (Per-Machine)" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest OneDrive for Windows and install it as a per-machine installation instead of per-user. Default is $false."/>
                                    <CheckBox x:Name="chkUpdateLatestMSRT" Content="Update Microsoft Software Removal Tool (MSRT)" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest Windows Malicious Software Removal Tool. Default is $false."/>
                                    <CheckBox x:Name="chkUpdateLatestMicrocode" Content="Update Latest Microcode (for LTSC/Server 2016/2019)" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will download and install the latest microcode updates for applicable Windows releases (e.g., Windows Server 2016/2019, Windows 10 LTSC 2016/2019) into the FFU."/>
                                    <CheckBox x:Name="chkUpdatePreviewCU" Content="Update Preview Cumulative Update" Margin="0" VerticalAlignment="Center" ToolTip="When set to $true, will download and install the latest Preview cumulative update for Windows. Default is $false."/>
                                </StackPanel>
                            </ScrollViewer>

                            <!-- TAB: Applications -->
                            <ScrollViewer x:Name="pageApplications" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                    <Grid Margin="16,0,16,16">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
    
                                        <!-- Regular Applications Section -->
                                        <StackPanel Grid.Row="0" Margin="0">
                                            <CheckBox x:Name="chkInstallApps" Content="Install Applications" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="Enable to install regular applications during the build process"/>
    
                                            <!-- Application Path - Shows only when Install Applications is checked -->
                                            <StackPanel x:Name="applicationPathPanel" Visibility="Collapsed" Margin="24,0,0,20">
                                                <TextBlock Text="Application Path:" Margin="0,0,0,8" ToolTip="Path where applications will be downloaded and stored"/>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox x:Name="txtApplicationPath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path where applications will be downloaded and stored"/>
                                                    <Button x:Name="btnBrowseApplicationPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                                </Grid>
                                            </StackPanel>
    
                                            <!-- Winget AppList Path - Shows only when Install Applications is checked -->
                                            <StackPanel x:Name="appListJsonPathPanel" Visibility="Collapsed" Margin="24,0,0,20">
                                                <TextBlock Text="Winget AppList Path:" Margin="0,0,0,8" ToolTip="Path to the Winget AppList JSON file"/>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox x:Name="txtAppListJsonPath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the Winget AppList JSON file (AppList.json)"/>
                                                    <Button x:Name="btnBrowseAppListJsonPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                                </Grid>
                                            </StackPanel>
    
                                            <!-- BYO AppList Path - Shows only when Install Applications is checked -->
                                            <StackPanel x:Name="userAppListPathPanel" Visibility="Collapsed" Margin="24,0,0,20">
                                                <TextBlock Text="BYO AppList Path:" Margin="0,0,0,8" ToolTip="Path to the Bring Your Own applications JSON file (UserAppList.json)"/>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox x:Name="txtUserAppListPath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the Bring Your Own applications JSON file (UserAppList.json)"/>
                                                    <Button x:Name="btnBrowseUserAppListPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                                </Grid>
                                            </StackPanel>
    
                                            <!-- Winget Applications Section - Indented under Install Applications -->
                                            <CheckBox x:Name="chkInstallWingetApps" Content="Install Winget Applications" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="Enable to install applications using Windows Package Manager (winget)"/>
    
                                            <!-- Winget Status Panel -->
                                            <StackPanel x:Name="wingetPanel" Visibility="Collapsed" Margin="24,0,0,20">
    
                                                <TextBlock Text="Winget Status" FontWeight="SemiBold" Margin="0,0,0,8"/>
    
                                                <Grid Margin="0">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="150"/>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                    </Grid.RowDefinitions>
    
                                                    <!-- Winget CLI Version Display -->
                                                    <TextBlock Text="Winget Version:" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" ToolTip="Current version of the Winget CLI installed on the system"/>
                                                    <TextBlock x:Name="txtWingetVersion" Text="Not checked" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
    
                                                    <!-- Winget PowerShell Module Version Display -->
                                                    <TextBlock Text="Module Version:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" ToolTip="Current version of the Microsoft.WinGet.Client PowerShell module"/>
                                                    <TextBlock x:Name="txtWingetModuleVersion" Text="Not checked" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"/>
    
                                                    <!-- Check/Install Button -->
                                                    <Button x:Name="btnCheckWingetModule" Content="Check Winget Status" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,8,0,0" Padding="12,4" HorizontalAlignment="Left" ToolTip="Check installation status and version of Winget CLI and PowerShell module. Will install or update if needed."/>
                                                </Grid>
                                            </StackPanel>
    
                                            <!-- Winget Search Panel -->
                                            <StackPanel x:Name="wingetSearchPanel" Visibility="Collapsed" Margin="24,0,0,20">
    
                                                <TextBlock Text="Winget Search" FontWeight="SemiBold" Margin="0,0,0,8"/>
    
                                                <Grid Margin="0,0,0,8">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="100"/>
                                                    </Grid.ColumnDefinitions>
    
                                                    <TextBox x:Name="txtWingetSearch" Grid.Column="0" Margin="0,0,8,0" VerticalContentAlignment="Center" VerticalAlignment="Center" ToolTip="Enter an application name to search for"/>
    
                                                    <Button x:Name="btnWingetSearch" Grid.Column="1" Content="Search" Padding="12,4" VerticalAlignment="Center" ToolTip="Search for applications using Windows Package Manager"/>
                                                </Grid>
    
                                                <!-- Results ListView -->
                                                <ListView x:Name="lstWingetResults" Height="300" Margin="0,0,0,8" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"/>
    
                                                <!-- Save/Import/Clear Buttons -->
                                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                                    <Button x:Name="btnSaveWingetList" Content="Save Winget AppList" Padding="12,4" Margin="0,0,8,0" ToolTip="Save selected applications to a JSON file"/>
                                                    <Button x:Name="btnImportWingetList" Content="Import Winget AppList" Padding="12,4" Margin="0,0,8,0" ToolTip="Import applications from a JSON file"/>
                                                    <Button x:Name="btnDownloadSelected" Content="Download Selected" Padding="12,4" Margin="0,0,8,0" ToolTip="Download all selected applications"/>
                                                    <Button x:Name="btnClearWingetList" Content="Clear List" Padding="12,4" ToolTip="Clear all applications from the list"/>
                                                </StackPanel>
                                            </StackPanel>
    
                                            <CheckBox x:Name="chkBringYourOwnApps" Content="Bring Your Own Applications" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="Enable to bring your own applications during the build process"/>
    
                                            <!-- Application Information Section -->
                                            <StackPanel x:Name="byoApplicationPanel" Visibility="Collapsed" Margin="24,0,0,20">
                                                <TextBlock Text="Application Information" FontWeight="SemiBold" Margin="0,0,0,8"/>
    
                                                <!-- Name -->
                                                <TextBlock Text="Name:" Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtAppName" Margin="0,0,0,20" ToolTip="Enter the name of the application"/>
    
                                                <!-- Command Line -->
                                                <TextBlock Text="Command Line:" Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtAppCommandLine" Margin="0,0,0,20" ToolTip="Enter the full path to the command line to install the application. Use %FFUAppsRoot%\Win32 for exe, cmd, etc types of deployments (e.g. %FFUAppsRoot%\Win32\Mozilla FireFox\setup.exe). Legacy D:\Win32 paths are still supported. For MSI installs, use msiexec and then fill in the rest of the arguments in the arguments field."/>
    
                                                <!-- Arguments -->
                                                <TextBlock Text="Arguments:" Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtAppArguments" Margin="0,0,0,20" ToolTip="Enter the arguments for the command line. If the application is an msi, the command line should only contain msiexec and the rest of the command line arguments would go here (e.g. /i &quot;%FFUAppsRoot%\Win32\Mozilla firefox\setup.msi&quot; /qn /norestart). Legacy D:\Win32 paths are still supported."/>
    
                                                <!-- Source -->
                                                <TextBlock Text="Source:" Margin="0,0,0,8"/>
                                                <Grid Margin="0,0,0,20">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox x:Name="txtAppSource" Grid.Column="0" VerticalAlignment="Center" ToolTip="Optional: Enter the source folder path of the application installation files. This is used to copy the files to the $AppsPath\Win32 directory by clicking the Copy Apps button"/>
                                                    <Button x:Name="btnBrowseAppSource" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                                </Grid>
    
                                                <!-- Additional Exit Codes -->
                                                <TextBlock Text="Additional Exit Codes:" Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtAppAdditionalExitCodes" Margin="0,0,0,20" ToolTip="Enter a comma-separated list of additional success exit codes."/>
    
                                                <!-- Ignore Non-Zero Exit Codes Checkbox -->
                                                <CheckBox x:Name="chkIgnoreExitCodes" Content="Ignore all non-zero exit codes" Margin="0,0,0,20" ToolTip="If checked, any non-zero exit code will be considered a success."/>

                                                <!-- Add Application Button -->
                                                <Button x:Name="btnAddApplication" Content="Add Application" HorizontalAlignment="Left" Margin="0,0,0,8" Padding="12,4" ToolTip="Add the application to the list"/>

                                                <!-- Grid to hold ListView and Reorder Buttons -->
                                                <Grid Margin="0,0,0,8">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>

                                                    <!-- Applications ListView -->
                                                    <ListView x:Name="lstApplications" Grid.Column="0" Height="200" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                                    </ListView>

                                                    <!-- Reorder Buttons -->
                                                    <StackPanel Grid.Column="1" VerticalAlignment="Bottom" Margin="8,0,0,0">
                                                        <Button x:Name="btnMoveTop" Content="&#x2912;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" Margin="0,0,0,8" ToolTip="Move selected application to the top" />
                                                        <Button x:Name="btnMoveUp" Content="&#x2191;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" Margin="0,0,0,8" ToolTip="Move selected application up" />
                                                        <Button x:Name="btnMoveDown" Content="&#x2193;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" Margin="0,0,0,8" ToolTip="Move selected application down" />
                                                        <Button x:Name="btnMoveBottom" Content="&#x2913;" Width="40" Height="40" FontSize="28" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0" ToolTip="Move selected application to the bottom" />
                                                    </StackPanel>

                                                </Grid>

                                                <!-- Save/Import/Clear Buttons -->
                                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0">
                                                    <Button x:Name="btnSaveBYOApplications" Content="Save BYO AppList" Margin="0,0,8,0" Padding="12,4" ToolTip="Save application list to JSON file"/>
                                                    <Button x:Name="btnLoadBYOApplications" Content="Import BYO AppList" Margin="0,0,8,0" Padding="12,4" ToolTip="Import application list from JSON file"/>
                                                    <Button x:Name="btnEditApplication" Content="Edit Application" IsEnabled="False" Margin="0,0,8,0" Padding="12,4" ToolTip="Edit the selected application's details"/>
                                                    <Button x:Name="btnCopyBYOApps" Content="Copy Apps" IsEnabled="False" Margin="0,0,8,0" Padding="12,4" ToolTip="Copy applications with a specified source path to the AppsPath\Win32 folder"/>
                                                    <Button x:Name="btnRemoveSelectedBYOApps" Content="Remove Selected" IsEnabled="False" Margin="0,0,8,0" Padding="12,4" ToolTip="Remove selected applications from the list"/>
                                                    <Button x:Name="btnClearBYOApplications" Content="Clear List" Padding="12,4" ToolTip="Clear all applications from the list"/>
                                                </StackPanel>
                                            </StackPanel>
    
                                            <!-- AppsScriptVariables Section -->
                                            <CheckBox x:Name="chkDefineAppsScriptVariables" Content="Define Apps Script Variables" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="Enable to define key-value pairs for Apps Script Variables"/>
                                            <StackPanel x:Name="appsScriptVariablesPanel" Visibility="Collapsed" Margin="24,0,0,0">
                                                <TextBlock Text="Apps Script Variables" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                                <!-- Key Input -->
                                                <TextBlock Text="Key:" Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtAppsScriptKey" Margin="0,0,0,20" ToolTip="Enter the variable key"/>
    
                                                <!-- Value Input -->
                                                <TextBlock Text="Value:" Margin="0,0,0,8"/>
                                                <TextBox x:Name="txtAppsScriptValue" Margin="0,0,0,20" ToolTip="Enter the variable value"/>
    
                                                <!-- Add Variable Button -->
                                                <Button x:Name="btnAddAppsScriptVariable" Content="Add Variable" HorizontalAlignment="Left" Margin="0,0,0,20" Padding="12,4" ToolTip="Add the key-value pair to the list"/>
    
                                                <!-- ListView for AppsScriptVariables -->
                                                <ListView x:Name="lstAppsScriptVariables" Height="150" Margin="0,0,0,20" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                                    <ListView.View>
                                                        <GridView>
                                                            <GridViewColumn Header="Key" DisplayMemberBinding="{Binding Key}" Width="200"/>
                                                            <GridViewColumn Header="Value" DisplayMemberBinding="{Binding Value}" Width="300"/>
                                                        </GridView>
                                                    </ListView.View>
                                                </ListView>
    
                                                <!-- Action Buttons for ListView -->
                                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                                    <Button x:Name="btnRemoveSelectedAppsScriptVariables" Content="Remove Selected" Margin="0,0,8,0" Padding="12,4" ToolTip="Remove the selected variable(s) from the list"/>
                                                    <Button x:Name="btnClearAppsScriptVariables" Content="Clear All" Padding="12,4" ToolTip="Clear all variables from the list"/>
                                                </StackPanel>
                                            </StackPanel>
                                            <!-- End AppsScriptVariables Section -->
                                        </StackPanel>
                                    </Grid>
                                </ScrollViewer>
    
                                <!-- TAB: M365 Apps/Office -->
                                <ScrollViewer x:Name="pageOffice" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                    <StackPanel Margin="16,0,16,16">
                                        <!-- Install Office -->
                                        <CheckBox x:Name="chkInstallOffice" Content="Install Office" Margin="0,0,0,8" ToolTip="Install Microsoft Office if set to $true. The script will download the latest ODT and Office files in the $FFUDevelopmentPath\Apps\Office folder and install Office in the FFU via VM."/>
                                        <!-- Office Path -->
                                        <StackPanel x:Name="OfficePathStackPanel" Margin="24,0,0,8">
                                            <TextBlock Text="Office Path" ToolTip="Path to the Office directory that contains the DownloadFFU.xml and DeployFFU.xml files. This is where Office will be downloaded to from the ODT."/>
                                        </StackPanel>
                                        <Grid x:Name="OfficePathGrid" Margin="24,0,0,20">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtOfficePath" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch" ToolTip="Path to the Office directory that contains the DownloadFFU.xml and DeployFFU.xml files. This is where Office will be downloaded to from the ODT."/>
                                            <Button x:Name="btnBrowseOfficePath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                        <!-- Copy Office Configuration XML -->
                                        <StackPanel x:Name="CopyOfficeConfigXMLStackPanel" Margin="24,0,0,8">
                                            <CheckBox x:Name="chkCopyOfficeConfigXML" Content="Copy Office Configuration XML" ToolTip="Enable to copy an Office configuration XML file to the Office folder."/>
                                        </StackPanel>
                                        <!-- Office Configuration XML File -->
                                        <StackPanel x:Name="OfficeConfigurationXMLFileStackPanel" Margin="32,0,0,8" Visibility="Collapsed">
                                            <TextBlock Text="Office Configuration XML File" ToolTip="Specify the path to an Office configuration XML file. This file will be copied into the Office folder and used for the deployment of Office."/>
                                        </StackPanel>
                                        <Grid x:Name="OfficeConfigurationXMLFileGrid" Margin="32,0,0,20" Visibility="Collapsed">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtOfficeConfigXMLFilePath" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch" ToolTip="Specify the path to the Office configuration XML file."/>
                                            <Button x:Name="btnBrowseOfficeConfigXMLFile" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>
                                </ScrollViewer>

                            <!-- TAB: Drivers -->
                            <ScrollViewer x:Name="pageDrivers" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                <Grid Margin="16,0,16,16">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <!-- Drivers Folder -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- PE Drivers Folder -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Drivers.json Path -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Download Drivers Checkbox -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Make Section (Indented) -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Get Models Button (Indented) -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Model Filter Section (Indented) -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Driver Models ListView (Indented) -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Driver Action Buttons (Indented) -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Install Drivers to FFU -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Copy Drivers to USB -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Compress Driver Model Folder to WIM -->
                                        <RowDefinition Height="*"/>
                                        <!-- Copy PE Drivers Checkbox & Spacer/Remaining -->
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <!-- Span full width for StackPanels -->
                                    </Grid.ColumnDefinitions>

                                    <!-- Row 0: Drivers Folder -->
                                    <StackPanel Grid.Row="0" Margin="0,0,0,20">
                                        <TextBlock Text="Drivers Folder:" VerticalAlignment="Center" ToolTip="Path to the drivers folder. Default is $FFUDevelopmentPath\Drivers." Margin="0,0,0,8"/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtDriversFolder" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch" ToolTip="Path to the drivers folder. Default is $FFUDevelopmentPath\Drivers."/>
                                            <Button x:Name="btnBrowseDriversFolder" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>

                                    <!-- Row 1: PE Drivers Folder -->
                                    <StackPanel Grid.Row="1" Margin="0,0,0,20">
                                        <TextBlock Text="PE Drivers Folder:" VerticalAlignment="Center" ToolTip="Path to the PE drivers folder. Default is $FFUDevelopmentPath\PEDrivers." Margin="0,0,0,8"/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtPEDriversFolder" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch" ToolTip="Path to the PE drivers folder. Default is $FFUDevelopmentPath\PEDrivers."/>
                                            <Button x:Name="btnBrowsePEDriversFolder" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>

                                    <!-- Row 2: Drivers.json Path -->
                                    <StackPanel Grid.Row="2" Margin="0,0,0,20">
                                        <TextBlock Text="Drivers.json Path:" VerticalAlignment="Center" ToolTip="Path to the Drivers.json file. Default is $FFUDevelopmentPath\Drivers\Drivers.json." Margin="0,0,0,8"/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtDriversJsonPath" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch" ToolTip="Path to the Drivers.json file. Default is $FFUDevelopmentPath\Drivers\Drivers.json."/>
                                            <Button x:Name="btnBrowseDriversJsonPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>

                                    <!-- Row 3: Download Drivers Checkbox -->
                                    <StackPanel Grid.Row="3" Margin="0,0,0,8">
                                        <CheckBox x:Name="chkDownloadDrivers" Content="Download Drivers" Margin="0" VerticalAlignment="Center" ToolTip="Download the drivers and put them in the Drivers folder."/>
                                    </StackPanel>

                                    <!-- Row 4: Make Section (Indented) -->
                                    <StackPanel x:Name="spMakeSection" Grid.Row="4" Visibility="Collapsed" Margin="24,0,0,20">
                                        <TextBlock Text="Make:" Margin="0,0,0,8" ToolTip="Make of the device to download drivers. Accepted values are: 'Microsoft', 'Dell', 'HP', 'Lenovo'."/>
                                        <ComboBox x:Name="cmbMake" Margin="0" HorizontalAlignment="Left" Width="200"/>
                                        <!-- Model TextBox is removed from here, filtering will be done below -->
                                    </StackPanel>

                                    <!-- Row 5: Get Models Button (Indented) -->
                                    <Button x:Name="btnGetModels" Grid.Row="5" Content="Get Models" Margin="24,0,0,20" HorizontalAlignment="Left" ToolTip="Retrieve available models for the selected Make." Visibility="Collapsed" Padding="12,4"/>

                                    <!-- Row 6: Model Filter Section (Indented) -->
                                    <StackPanel x:Name="spModelFilterSection" Grid.Row="6" Visibility="Collapsed" Margin="24,0,0,20">
                                        <TextBlock Text="Model Filter" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <!-- Removed Search button column -->
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtModelFilter" Grid.Row="1" Margin="0" VerticalContentAlignment="Center" Tag="Type to filter models by name" ToolTip="Type to filter driver models by name"/>
                                            <!-- Search button removed, filtering is real-time -->
                                        </Grid>
                                    </StackPanel>

                                    <!-- Row 7: Driver Models ListView (Indented) -->
                                    <ListView x:Name="lstDriverModels" Grid.Row="7" Margin="24,0,0,20" Height="300" Visibility="Collapsed" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                    </ListView>

                                    <!-- Row 8: Driver Action Buttons (Indented) -->
                                    <StackPanel x:Name="spDriverActionButtons" Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Left" Margin="24,0,0,20" Visibility="Collapsed">
                                        <Button x:Name="btnSaveDriversJson" Content="Save Drivers.json" Padding="12,4" Margin="0,0,8,0" ToolTip="Save selected drivers to a JSON file (Not Implemented)"/>
                                        <Button x:Name="btnImportDriversJson" Content="Import Drivers.json" Padding="12,4" Margin="0,0,8,0" ToolTip="Import drivers from a JSON file (Not Implemented)"/>
                                        <Button x:Name="btnDownloadSelectedDrivers" Content="Download Selected" Padding="12,4" Margin="0,0,8,0" ToolTip="Download all selected drivers"/>
                                        <Button x:Name="btnClearDriverList" Content="Clear List" Padding="12,4" ToolTip="Clear all drivers from the list (Not Implemented)"/>
                                    </StackPanel>

                                    <!-- Row 9: Install Drivers to FFU -->
                                    <StackPanel Grid.Row="9" Margin="0,0,0,8">
                                        <CheckBox x:Name="chkInstallDrivers" Content="Install Drivers to FFU" Margin="0" VerticalAlignment="Center" ToolTip="Install device drivers from the specified $FFUDevelopmentPath\Drivers folder if set to $true. Download the drivers and put them in the Drivers folder. The script will recurse the drivers folder and add the drivers to the FFU."/>
                                    </StackPanel>

                                    <!-- Row 10: Copy Drivers to USB -->
                                    <StackPanel Grid.Row="10" Margin="0,0,0,8">
                                        <CheckBox x:Name="chkCopyDrivers" Content="Copy Drivers to USB drive" Margin="0" VerticalAlignment="Center" ToolTip="When set to $true, will copy the drivers from the $FFUDevelopmentPath\Drivers folder to the Drivers folder on the deploy partition of the USB drive. Default is $false."/>
                                    </StackPanel>

                                    <!-- Row 11: Compress Driver Model Folder to WIM -->
                                    <StackPanel Grid.Row="11" Margin="0,0,0,8">
                                        <CheckBox x:Name="chkCompressDriversToWIM" Content="Compress Driver Model Folder to WIM" Margin="0" VerticalAlignment="Center" ToolTip="When set to $true, will compress each downloaded driver model folder into a separate WIM file within the Drivers folder. This is useful with Copy Drivers to USB drive."/>
                                    </StackPanel>

                                    <!-- Row 12: PE Driver Options (UseDriversAsPEDrivers is a dependent sub-option) -->
                                    <StackPanel Grid.Row="12" Margin="0">
                                        <CheckBox x:Name="chkCopyPEDrivers" Content="Copy PE Drivers" Margin="0,0,0,8" VerticalAlignment="Center" ToolTip="When set to $true, will copy the drivers from the $FFUDevelopmentPath\PEDrivers folder to the WinPE deployment media. Default is $false."/>
                                        <CheckBox x:Name="chkUseDriversAsPEDrivers" Content="Use Drivers Folder as PE Drivers Source" Margin="24,0,0,0" VerticalAlignment="Center" Visibility="Collapsed" ToolTip="When set to $true (and Copy PE Drivers is also checked), bypasses the PE Drivers Folder path and instead scans the Drivers folder to gather only required WinPE drivers. Hidden unless Copy PE Drivers is checked."/>
                                    </StackPanel>
                                </Grid>
                            </ScrollViewer>

                            <!-- TAB: Build -->
                            <ScrollViewer x:Name="pageBuild" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                <Grid Margin="16,0,16,16">
                                    <!-- Define 12 rows for the Build tab -->
                                    <Grid.RowDefinitions>
                                        <!-- Row 0: Header -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 1: FFU Development Path -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 2: Custom FFU Name Template -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 3: FFU Capture Location -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 4: Threads -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 5: BITS Priority -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 6: Max USB Drives -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 7: Build USB Drive -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 8: General Build Options Header -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 9: General Build Options Checkboxes -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 10: Unattend.xml Options -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 11: Device Naming -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 12: Build USB Drive Section -->
                                        <RowDefinition Height="Auto"/>
                                        <!-- Row 13: Post-Build Cleanup -->
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <!-- Hidden internal header so the shared page shell owns the page title -->
                                    <TextBlock Grid.Row="0" Text="FFU Build Settings" FontSize="20" FontWeight="SemiBold" Margin="0,0,0,8" Visibility="Collapsed"/>
                                    <!-- Row 1: FFU Development Path -->
                                    <StackPanel Grid.Row="1" Margin="0,0,0,20">
                                        <TextBlock Text="FFU Development Path" Margin="0,0,0,8" ToolTip="Path to the FFU development folder."/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtFFUDevPath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the FFU development folder."/>
                                            <Button x:Name="btnBrowseFFUDevPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>
                                    <!-- Row 2: Custom FFU Name Template -->
                                    <StackPanel Grid.Row="2" Margin="0,0,0,20">
                                        <TextBlock Text="Custom FFU Name Template" Margin="0,0,0,8" ToolTip="Sets a custom FFU output name with placeholders. Allowed placeholders are: {WindowsRelease}, {WindowsVersion}, {SKU}, {BuildDate}, {yyyy}, {MM}, {dd}, {H}, {hh}, {mm}, {tt}."/>
                                        <TextBox x:Name="txtCustomFFUNameTemplate" VerticalAlignment="Center" ToolTip="Sets a custom FFU output name with placeholders. Allowed placeholders are: {WindowsRelease}, {WindowsVersion}, {SKU}, {BuildDate}, {yyyy}, {MM}, {dd}, {H}, {hh}, {mm}, {tt}."/>
                                    </StackPanel>
                                    <!-- Row 3: FFU Capture Location -->
                                    <StackPanel Grid.Row="3" Margin="0,0,0,20">
                                        <TextBlock Text="FFU Capture Location" Margin="0,0,0,8" ToolTip="Path to the folder where the captured FFU will be stored."/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBox x:Name="txtFFUCaptureLocation" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the folder where the captured FFU will be stored."/>
                                            <Button x:Name="btnBrowseFFUCaptureLocation" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center"/>
                                        </Grid>
                                    </StackPanel>
                                    <!-- Row 6: Threads -->
                                    <StackPanel Grid.Row="6" Margin="0,0,0,20">
                                        <TextBlock Text="Threads" Margin="0,0,0,8" ToolTip="Controls the number of parallel threads used by ForEach-Object -Parallel and sets the value of the -ThrottleLimit parameter. Default is 5. Used in Winget, Application Copy, and driver downloads"/>
                                        <TextBox x:Name="txtThreads" Width="80" HorizontalAlignment="Left" Text="5" ToolTip="Controls the number of parallel threads used by ForEach-Object -Parallel and sets the value of the -ThrottleLimit parameter. Default is 5. Used in Winget, Application Copy, and driver downloads"/>
                                    </StackPanel>
                                    <!-- Row 7: BITS Priority -->
                                    <StackPanel Grid.Row="7" Margin="0,0,0,20">
                                        <TextBlock Text="BITS Priority" Margin="0,0,0,8" ToolTip="Controls the BITS download priority used by the UI and BuildFFUVM.ps1. Switch to Foreground to maximize download speed if needed."/>
                                        <ComboBox x:Name="cmbBitsPriority" Width="150" HorizontalAlignment="Left" ToolTip="Controls the BITS download priority used by the UI and BuildFFUVM.ps1. Switch to Foreground to maximize download speed if needed.">
                                            <sys:String>Foreground</sys:String>
                                            <sys:String>High</sys:String>
                                            <sys:String>Normal</sys:String>
                                            <sys:String>Low</sys:String>
                                        </ComboBox>
                                    </StackPanel>
                                    <!-- Row 8-9: General Build Options -->
                                    <Expander Grid.Row="8" Grid.RowSpan="2" Header="General Build Options" IsExpanded="False" Margin="0,0,0,20" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                        <StackPanel Margin="0,8,0,0">
                                            <CheckBox x:Name="chkCompactOS" Content="Compact OS" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will compact the OS when building the FFU."/>
                                            <CheckBox x:Name="chkUpdateADK" Content="Update ADK" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, the script will check for and install/update to the latest Windows ADK and WinPE add-on."/>
                                            <CheckBox x:Name="chkOptimize" Content="Optimize" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will optimize the OS when building the FFU."/>
                                            <CheckBox x:Name="chkAllowVHDXCaching" Content="Allow VHDX Caching" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will cache the VHDX file to cache folder and create a config json file to track Windows build information."/>
                                            <CheckBox x:Name="chkCreateDeploymentMedia" Content="Create Deployment Media" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, this will create WinPE deployment media for use when deploying to a physical device."/>
                                            <CheckBox x:Name="chkVerbose" Content="Verbose" Margin="0" VerticalAlignment="Center" Tag="When set to $true, will enable write-verbose output to the console for the build script."/>
                                        </StackPanel>
                                    </Expander>

                                    <!-- Row 10: Unattend.xml Options -->
                                    <Expander Grid.Row="10" Header="Unattend.xml Options" IsExpanded="False" Margin="0,0,0,20" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                        <StackPanel Margin="0,8,0,0">
                                            <TextBlock Text="Choose how unattend content is staged and which architecture-specific source files are used." Margin="0,0,0,12" TextWrapping="Wrap"/>
                                            <TextBlock Text="x64 Unattend File Path" Margin="0,0,0,8" TextWrapping="Wrap"/>
                                            <Grid Margin="0,0,0,16">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBox x:Name="txtUnattendX64FilePath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the x64 unattend XML source file. You can use any file name."/>
                                                <Button x:Name="btnBrowseUnattendX64FilePath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center" ToolTip="Browse to the x64 unattend XML source file."/>
                                            </Grid>
                                            <TextBlock Text="arm64 Unattend File Path" Margin="0,0,0,8" TextWrapping="Wrap"/>
                                            <Grid Margin="0,0,0,16">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBox x:Name="txtUnattendArm64FilePath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the arm64 unattend XML source file. You can use any file name."/>
                                                <Button x:Name="btnBrowseUnattendArm64FilePath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center" ToolTip="Browse to the arm64 unattend XML source file."/>
                                            </Grid>
                                            <CheckBox x:Name="chkInjectUnattend" Content="Inject Unattend.xml" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true and Install Apps is enabled, uses the selected architecture-specific unattend XML file and copies it into Apps\Unattend\Unattend.xml to be used by sysprep."/>
                                            <CheckBox x:Name="chkCopyUnattend" Content="Copy Unattend.xml" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, uses the selected architecture-specific unattend XML file and copies it to the USB drive as Unattend.xml."/>
                                        </StackPanel>
                                    </Expander>

                                    <!-- Row 11: Device Naming -->
                                    <Expander Grid.Row="11" x:Name="deviceNamingSection" Header="Device Naming" IsExpanded="False" Margin="0,0,0,20" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                        <StackPanel Margin="0,8,0,0">
                                            <TextBlock Text="Choose how the device should be named when unattend is applied." Margin="0,0,0,12" TextWrapping="Wrap"/>
                                            <RadioButton x:Name="rbDeviceNamingNone" Content="No Device Name" GroupName="DeviceNamingMode" IsChecked="True" Margin="0,0,0,8" ToolTip="Apply unattend without setting a specific computer name."/>
                                            <RadioButton x:Name="rbDeviceNamingPrompt" Content="Prompt for Device Name" GroupName="DeviceNamingMode" Margin="0,0,0,8" ToolTip="Prompt the technician to enter a device name during deployment. This option requires Copy Unattend.xml."/>
                                            <RadioButton x:Name="rbDeviceNamingTemplate" Content="Specify Device Name" GroupName="DeviceNamingMode" Margin="0,0,0,8" ToolTip="Use a static device name or the %serial% variable when Copy Unattend.xml is selected."/>
                                            <StackPanel x:Name="deviceNameTemplatePanel" Margin="32,0,0,16" Visibility="Collapsed">
                                                <TextBlock Text="Use static text, %serial%, or both together, for example Comp-%serial%." Margin="0,0,0,4" TextWrapping="Wrap"/>
                                                <TextBlock Text="Choose Copy Unattend.xml or Inject Unattend.xml for static names. %serial% requires Copy Unattend.xml." Margin="0,0,0,8" TextWrapping="Wrap" Opacity="0.75"/>
                                                <TextBox x:Name="txtDeviceNameTemplate" VerticalAlignment="Center" ToolTip="Examples: KIOSK-01 or Comp-%serial%"/>
                                            </StackPanel>
                                            <RadioButton x:Name="rbDeviceNamingPrefixes" Content="Specify a list of Prefixes" GroupName="DeviceNamingMode" Margin="0,0,0,8" ToolTip="Enter one prefix per line or import an existing prefixes file. This option requires Copy Unattend.xml."/>
                                            <StackPanel x:Name="deviceNamePrefixesPanel" Margin="32,0,0,0" Visibility="Collapsed">
                                                <TextBlock Text="Prefixes File Path" Margin="0,0,0,8" TextWrapping="Wrap"/>
                                                <Grid Margin="0,0,0,8">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox x:Name="txtDeviceNamePrefixesPath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the prefixes source file. You can use any file name."/>
                                                    <Button x:Name="btnBrowseDeviceNamePrefixesPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center" ToolTip="Browse to a prefixes source file path."/>
                                                </Grid>
                                                <TextBlock Text="Enter one prefix per line. Each prefix is combined with the device serial number during deployment." Margin="0,0,0,4" TextWrapping="Wrap"/>
                                                <TextBlock Text="If you enter a single prefix, it is used automatically. If you enter multiple prefixes, the technician is prompted to choose one during deployment." Margin="0,0,0,8" TextWrapping="Wrap" Opacity="0.75"/>
                                                <TextBox x:Name="txtDeviceNamePrefixes" MinHeight="120" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ToolTip="Each line becomes a prefix option in prefixes.txt."/>
                                                <StackPanel Orientation="Horizontal" Margin="0,8,0,0" HorizontalAlignment="Left">
                                                    <Button x:Name="btnSaveDeviceNamePrefixes" Content="Save Prefixes" Padding="12,4" ToolTip="Save the current prefixes list to the Prefixes File Path."/>
                                                </StackPanel>
                                            </StackPanel>
                                            <RadioButton x:Name="rbDeviceNamingSerialComputerNames" Content="Specify Serial to Device Name Mapping" GroupName="DeviceNamingMode" Margin="0,8,0,8" ToolTip="Create or import a SerialComputerNames.csv file. This option requires Copy Unattend.xml."/>
                                            <StackPanel x:Name="deviceNameSerialComputerNamesPanel" Margin="32,0,0,0" Visibility="Collapsed">
                                                <TextBlock Text="Serial Computer Names CSV Mapping File Path" Margin="0,0,0,8" TextWrapping="Wrap"/>
                                                <Grid Margin="0,0,0,8">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox x:Name="txtDeviceNameSerialComputerNamesPath" Grid.Column="0" VerticalAlignment="Center" ToolTip="Path to the serial-to-device-name mapping CSV file. You can use any file name."/>
                                                    <Button x:Name="btnBrowseDeviceNameSerialComputerNamesPath" Grid.Column="1" Content="Browse..." Padding="12,4" Margin="8,0,0,0" VerticalAlignment="Center" ToolTip="Browse to the serial-to-device-name mapping CSV source file path."/>
                                                </Grid>
                                                <TextBlock Text="Enter CSV content with SerialNumber and ComputerName headers. Each row maps one BIOS serial number to one computer name during deployment." Margin="0,0,0,4" TextWrapping="Wrap"/>
                                                <TextBlock Text="Example: SerialNumber,ComputerName" Margin="0,0,0,8" TextWrapping="Wrap" Opacity="0.75"/>
                                                <TextBox x:Name="txtDeviceNameSerialComputerNames" MinHeight="120" AcceptsReturn="True" TextWrapping="NoWrap" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ToolTip="Each CSV row maps a serial number to a computer name."/>
                                                <StackPanel Orientation="Horizontal" Margin="0,8,0,0" HorizontalAlignment="Left">
                                                    <Button x:Name="btnSaveDeviceNameSerialComputerNames" Content="Save Serial Mapping" Padding="12,4" ToolTip="Save the current serial-to-device-name mapping to the CSV file path."/>
                                                </StackPanel>
                                            </StackPanel>
                                        </StackPanel>
                                    </Expander>

                                    <!-- Row 12: Build USB Drive Section -->
                                    <Expander Grid.Row="12" x:Name="usbDriveSection" Header="Build USB Drive Options" IsExpanded="False" Margin="0,0,0,20" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                        <StackPanel Margin="0,8,0,0">
                                            <CheckBox x:Name="chkBuildUSBDriveEnable" Content="Build USB Drive" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will partition and format a USB drive and copy the captured FFU to the drive."/>
                                            <CheckBox x:Name="chkAllowExternalHardDiskMedia" Content="Allow External Hard Disk Media" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will allow the use of external hard disk media."/>
                                            <CheckBox x:Name="chkPromptExternalHardDiskMedia" Content="Prompt for External Hard Disk Media" Margin="0,0,0,8" IsEnabled="False" VerticalAlignment="Center" Tag="When set to $true, will prompt before using external hard disk media."/>
                                            <CheckBox x:Name="chkSelectSpecificUSBDrives" Content="Select Specific USB Drives" Margin="0,0,0,8" VerticalAlignment="Center" Tag="Enable to select specific USB drives for building"/>
                                            <!-- Added Missing Checkboxes -->
                                            <CheckBox x:Name="chkCopyAutopilot" Content="Copy Autopilot Profile" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will copy the Autopilot profile to the USB drive."/>
                                            <CheckBox x:Name="chkCopyPPKG" Content="Copy Provisioning Package" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will copy the provisioning package to the USB drive."/>
                                            <CheckBox x:Name="chkCopyAdditionalFFUFiles" Content="Copy Additional FFU Files" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, allows selecting existing FFU files in the capture folder to also copy to the USB drive."/>

                                            <!-- Additional FFU Selection Section -->
                                            <Grid x:Name="additionalFFUPanel" Margin="32,0,0,20" Visibility="Collapsed">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="*"/>
                                                </Grid.RowDefinitions>
                                                <!-- Header row -->
                                                <DockPanel Grid.Row="0" Margin="0,0,0,8" LastChildFill="False">
                                                    <TextBlock Text="Additional FFU Files" DockPanel.Dock="Left" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,8,0"/>
                                                    <Button x:Name="btnRefreshAdditionalFFUs" Content="Refresh" DockPanel.Dock="Left" Padding="12,4" ToolTip="Refresh the list of FFU files from the capture folder"/>
                                                </DockPanel>
                                                <!-- ListView row -->
                                                <ListView x:Name="lstAdditionalFFUs" Grid.Row="1" Margin="0" Height="150" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                                    <ListView.View>
                                                        <GridView>
                                                            <GridViewColumn Header="FFU Name" DisplayMemberBinding="{Binding Name}" Width="300"/>
                                                            <GridViewColumn Header="Last Modified" DisplayMemberBinding="{Binding LastModified}" Width="200"/>
                                                        </GridView>
                                                    </ListView.View>
                                                </ListView>
                                            </Grid>

                                            <!-- Max USB Drives -->
                                            <StackPanel Margin="0,0,0,20">
                                                <TextBlock Text="Max USB Drives" Margin="0,0,0,8" ToolTip="Maximum number of USB drives to build at once. Enter 0 to process all discovered (or all selected) drives."/>
                                                <TextBox x:Name="txtMaxUSBDrives" Width="80" HorizontalAlignment="Left" Text="5" ToolTip="Maximum number of USB drives to build at once. Enter 0 to process all discovered (or all selected) drives."/>
                                            </StackPanel>

                                            <!-- USB Drive Selection Section -->
                                            <Grid x:Name="usbDriveSelectionPanel" Margin="32,0,0,0">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="*"/>
                                                </Grid.RowDefinitions>
                                                <!-- Button and Select All row -->
                                                <DockPanel Grid.Row="0" Margin="0,0,0,8" LastChildFill="False">
                                                    <Button x:Name="btnCheckUSBDrives" Content="Check USB drives" DockPanel.Dock="Left" Padding="12,4"/>
                                                </DockPanel>
                                                <!-- ListView row -->
                                                <ListView x:Name="lstUSBDrives" Grid.Row="1" Margin="0" Height="150" BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                                    <ListView.View>
                                                        <GridView>

                                                            <GridViewColumn Header="Model" DisplayMemberBinding="{Binding Model}" Width="200"/>
                                                            <GridViewColumn Header="Unique ID" DisplayMemberBinding="{Binding UniqueId}" Width="300"/>
                                                            <GridViewColumn Header="Size (GB)" DisplayMemberBinding="{Binding Size}" Width="80"/>
                                                        </GridView>
                                                    </ListView.View>
                                                </ListView>
                                            </Grid>
                                        </StackPanel>
                                    </Expander>

                                    <!-- Row 13: Post-Build Cleanup -->
                                    <Expander Grid.Row="13" Header="Post-Build Cleanup" IsExpanded="False" Margin="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                        <StackPanel Margin="0,8,0,0">
                                            <CheckBox x:Name="chkCleanupAppsISO" Content="Cleanup Apps ISO" Margin="0,0,0,8" VerticalAlignment="Center" Tag="Remove Apps ISO after FFU capture."/>
                                            <CheckBox x:Name="chkCleanupDeployISO" Content="Cleanup Deploy ISO" Margin="0,0,0,8" VerticalAlignment="Center" Tag="Remove WinPE deployment ISO after FFU capture."/>
                                            <CheckBox x:Name="chkCleanupDrivers" Content="Cleanup Drivers" Margin="0,0,0,8" VerticalAlignment="Center" Tag="Remove drivers folder after FFU capture."/>
                                            <CheckBox x:Name="chkRemoveFFU" Content="Remove FFU" Margin="0,0,0,8" VerticalAlignment="Center" Tag="Remove FFU after copying to USB drive."/>
                                            <CheckBox x:Name="chkRemoveApps" Content="Remove Apps Folder Content" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will remove the application content in the Apps folder after the FFU has been captured."/>
                                            <CheckBox x:Name="chkRemoveUpdates" Content="Remove Downloaded Update Files" Margin="0,0,0,8" VerticalAlignment="Center" Tag="When set to $true, will remove downloaded CU, .NET, MSRT, Defender, Edge, and OneDrive files after being applied/included."/>
                                            <CheckBox x:Name="chkRemoveDownloadedESD" Content="Remove Downloaded ESD file(s)" Margin="0" VerticalAlignment="Center" Tag="When set to $true, will remove downloaded Windows ESD file(s) after they are used."/>
                                        </StackPanel>
                                    </Expander>
                                </Grid>
                            </ScrollViewer>

                            <!-- PAGE: Monitor -->
                            <Grid x:Name="pageMonitor" Margin="16,0,16,16" Visibility="Collapsed">
                                <ListBox x:Name="lstLogOutput" SelectionMode="Extended" Background="Transparent" BorderThickness="0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" HorizontalContentAlignment="Stretch"/>
                            </Grid>

                            <!-- PAGE: Settings -->
                            <ScrollViewer x:Name="pageSettings" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
                                <Grid Margin="16,0,16,16">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <!-- Hidden internal header so the shared page shell owns the page title -->
                                    <TextBlock Text="Settings" FontSize="20" FontWeight="SemiBold" Grid.Row="0" Margin="0,0,0,16" Visibility="Collapsed"/>

                                    <!-- Appearance Section -->
                                    <StackPanel Grid.Row="1" Margin="0,0,0,24">
                                        <TextBlock Text="Appearance" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" CornerRadius="4" Padding="16,12">
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                </Grid.ColumnDefinitions>
                                                <StackPanel Grid.Column="0" VerticalAlignment="Center">
                                                    <TextBlock Text="App theme" FontWeight="SemiBold"/>
                                                    <TextBlock Text="Select which app theme to display" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                                </StackPanel>
                                                <ComboBox x:Name="cmbThemeMode" Grid.Column="1" Width="120" VerticalAlignment="Center" Tag="Select the UI theme. System follows your Windows theme setting.">
                                                    <sys:String>Light</sys:String>
                                                    <sys:String>Dark</sys:String>
                                                    <sys:String>System</sys:String>
                                                </ComboBox>
                                            </Grid>
                                        </Border>
                                    </StackPanel>

                                    <!-- About Section -->
                                    <StackPanel Grid.Row="2" Margin="0,0,0,24">
                                        <TextBlock Text="About" FontWeight="SemiBold" Margin="0,0,0,8"/>
                                        <Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" CornerRadius="4" Padding="16,12">
                                            <StackPanel>
                                                <TextBlock Text="FFU Builder" FontWeight="SemiBold" FontSize="16"/>
                                                <TextBlock Text="Build and deploy Full Flash Update (FFU) images for Windows" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" Margin="0,0,0,12"/>
                                            </StackPanel>
                                        </Border>
                                    </StackPanel>
                                </Grid>
                            </ScrollViewer>
                        </Grid>
                    </Grid>
                </Border>
            </Grid>
        </Grid>

        <!-- Progress Bar -->
        <ProgressBar x:Name="progressBar" Height="20" Margin="0,8,0,0" Grid.Row="1" Visibility="Collapsed"/>
        <!-- Status Text -->
        <TextBlock x:Name="txtStatus" Grid.Row="2" Margin="0,4,0,0"/>
        <!-- Buttons (Build Config File / Load Config File / Build FFU) -->
        <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,20,20">
            <Button x:Name="btnRestoreDefaults" Content="Restore Defaults" Margin="0,0,8,0" Padding="12,4"/>
            <Button x:Name="btnBuildConfig" Content="Save Config File" Margin="0,0,8,0" Padding="12,4"/>
            <Button x:Name="btnLoadConfig" Content="Load Config File" Margin="0,0,8,0" Padding="12,4"/>
            <Button x:Name="btnRun" Content="Build FFU" Padding="12,4"/>
        </StackPanel>
    </Grid>
</Window>
