<Page
    x:Class="YMhut.Box.WinUI.Views.SettingsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <ScrollViewer>
        <StackPanel Padding="28,24,28,28" Spacing="16">
            <TextBlock Text="设置" FontSize="30" FontWeight="SemiBold" />
            <TextBlock Text="新主线使用 WinUI 的本地设置目录，同时兼容导入旧版设置、最近工具和主题配置。" Opacity="0.72" />

            <Border CornerRadius="24" Padding="22" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}">
                <StackPanel Spacing="14">
                    <TextBlock Text="外观" FontSize="20" FontWeight="SemiBold" />
                    <ComboBox x:Name="ThemeBox" Width="240" SelectionChanged="ThemeBox_SelectionChanged">
                        <ComboBoxItem Content="跟随系统" Tag="System" />
                        <ComboBoxItem Content="浅色" Tag="Light" />
                        <ComboBoxItem Content="深色" Tag="Dark" />
                    </ComboBox>

                    <InfoBar
                        IsOpen="True"
                        Severity="Informational"
                        Title="数据迁移"
                        Message="如果检测到旧版设置文件，本页会自动导入最近工具与主题配置，并将其标记为已完成。" />
                </StackPanel>
            </Border>

            <Border CornerRadius="24" Padding="22" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}">
                <StackPanel Spacing="12">
                    <TextBlock Text="本地数据" FontSize="20" FontWeight="SemiBold" />
                    <TextBlock x:Name="SettingsPathText" Opacity="0.78" />
                    <TextBlock x:Name="LegacyStatusText" Opacity="0.78" />

                    <StackPanel Orientation="Horizontal" Spacing="10">
                        <Button Content="刷新设置" Click="Reload_Click" />
                        <Button Content="清空最近工具" Click="ClearRecent_Click" />
                    </StackPanel>
                </StackPanel>
            </Border>

            <Border CornerRadius="24" Padding="22" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}">
                <StackPanel Spacing="12">
                    <TextBlock Text="最近工具" FontSize="20" FontWeight="SemiBold" />
                    <ItemsControl x:Name="RecentToolsList">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border CornerRadius="16" Padding="12" Margin="0,0,0,8" Background="{ThemeResource SystemControlBackgroundChromeLowBrush}">
                                    <TextBlock Text="{Binding}" />
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </StackPanel>
            </Border>
        </StackPanel>
    </ScrollViewer>
</Page>
