<Window x:Class="ClaudeDo.Installer.Views.SettingsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:views="clr-namespace:ClaudeDo.Installer.Views"
        xmlns:loc="clr-namespace:ClaudeDo.Installer.Localization"
        Title="ClaudeDo Settings"
        Icon="/ClaudeTaskSetup.ico"
        Width="720" Height="520"
        MinWidth="620" MinHeight="460"
        WindowStartupLocation="CenterScreen"
        Background="{StaticResource WindowBgBrush}"
        Foreground="{StaticResource TextPrimaryBrush}"
        FontFamily="Segoe UI"
        FontSize="13"
        d:DataContext="{d:DesignInstance views:SettingsViewModel}"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">

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

        <!-- Main content area -->
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="180"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!-- Sidebar -->
            <Border Grid.Column="0" Background="{StaticResource SidebarBgBrush}"
                    Padding="8,12">
                <ListBox ItemsSource="{Binding Pages}"
                         SelectedItem="{Binding SelectedPage}"
                         HorizontalContentAlignment="Stretch">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Icon}" FontSize="14" Margin="0,0,8,0"
                                           VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding Title}" FontSize="13"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Border>

            <!-- Separator -->
            <Border Grid.Column="1" Width="1" Background="{StaticResource BorderSubtleBrush}"/>

            <!-- Page content -->
            <Border Grid.Column="2" Padding="24,20">
                <ContentControl Content="{Binding SelectedPage.View}"/>
            </Border>
        </Grid>

        <!-- Bottom Bar -->
        <Border Grid.Row="1" Background="{StaticResource IslandBgBrush}"
                BorderBrush="{StaticResource BorderSubtleBrush}" BorderThickness="0,1,0,0"
                Padding="20,12">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <!-- Status message / version label -->
                <StackPanel Grid.Column="0" VerticalAlignment="Center">
                    <TextBlock Text="{Binding VersionLabel}" FontSize="11" Opacity="0.7"/>
                    <TextBlock Text="{Binding StatusMessage}" FontSize="12">
                        <TextBlock.Style>
                            <Style TargetType="TextBlock">
                                <Setter Property="Foreground" Value="{StaticResource AccentBrush}"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsStatusError}" Value="True">
                                        <Setter Property="Foreground" Value="{StaticResource ErrorBrush}"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBlock.Style>
                    </TextBlock>
                </StackPanel>

                <CheckBox Grid.Column="1" IsChecked="{Binding RemoveAppData}"
                          Content="{loc:Tr installer.settings.removeUserData}"
                          Margin="0,0,12,0" VerticalAlignment="Center"/>
                <Button Grid.Column="2" Content="{loc:Tr installer.settings.uninstall}" Margin="0,0,8,0"
                        Command="{Binding UninstallCommand}"/>
                <Button Grid.Column="3" Content="{loc:Tr installer.settings.repair}" Margin="0,0,8,0"
                        Command="{Binding RepairCommand}"/>
                <Button Grid.Column="4" Content="{loc:Tr installer.settings.save}" Margin="0,0,8,0"
                        Command="{Binding SaveCommand}"
                        Style="{StaticResource AccentButton}"/>
                <Button Grid.Column="5" Content="{loc:Tr installer.settings.close}"
                        Command="{Binding CloseCommand}"/>
            </Grid>
        </Border>
    </Grid>
</Window>
