<!-- PRE-GENERATED (design session). Settings window. API-key input for all 3 providers now;
     provider SELECTION logic is M10 (extension). Keys stored encrypted via DpapiSecretStore. -->
<ui:FluentWindow x:Class="DansoriEQ.App.SettingsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
        xmlns:ctrl="clr-namespace:DansoriEQ.App.Controls"
        Title="설정" Height="620" Width="620"
        WindowStartupLocation="CenterOwner"
        ExtendsContentIntoTitleBar="True" WindowBackdropType="Mica"
        Background="#1B1B1F" Foreground="#F2F3F5"
        FontFamily="Segoe UI Variable, Segoe UI">
    <Window.Resources>
        <SolidColorBrush x:Key="Card"    Color="#26262B"/>
        <SolidColorBrush x:Key="Stroke"  Color="#3A3A42"/>
        <SolidColorBrush x:Key="TextDim" Color="#A8ABB4"/>
        <SolidColorBrush x:Key="TextMute" Color="#767A83"/>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ui:TitleBar Grid.Row="0" Title="설정" Foreground="#F2F3F5" Padding="14,6"/>
        <Border Grid.Row="1" Style="{StaticResource NeonPopup}">
    <DockPanel Margin="20">
        <TextBlock DockPanel.Dock="Top" Text="설정" FontSize="18" FontWeight="Bold" Margin="0,0,0,14"/>

        <Button DockPanel.Dock="Bottom" x:Name="BtnClose" Content="닫기" Click="BtnClose_Click"
                HorizontalAlignment="Right" Height="36" Padding="18,0" Margin="0,14,0,0"
                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}" BorderBrush="{StaticResource Stroke}"/>

        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <StackPanel>
                <!-- AI / API KEYS -->
                <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}" BorderThickness="1"
                        CornerRadius="12" Padding="16" Margin="0,0,0,14">
                    <StackPanel>
                        <TextBlock Text="AI · API 키" Foreground="{StaticResource TextDim}" FontWeight="Bold" Margin="0,0,0,4"/>
                        <TextBlock Foreground="{StaticResource TextMute}" FontSize="11" TextWrapping="Wrap" Margin="0,0,0,12"
                                   Text="키는 DPAPI로 암호화되어 로컬에 저장됩니다(평문 저장 안 함). 저장 후에는 '이미 입력되어 있음'으로 표시되고 값은 다시 보이지 않습니다."/>
                        <ctrl:ApiKeyRow x:Name="RowClaude"/>
                        <ctrl:ApiKeyRow x:Name="RowOpenAi"/>
                        <ctrl:ApiKeyRow x:Name="RowGemini"/>

                        <StackPanel Orientation="Horizontal" Margin="0,6,0,0">
                            <TextBlock Text="Claude 모델" VerticalAlignment="Center" Foreground="{StaticResource TextDim}" FontSize="12" Width="180"/>
                            <ComboBox x:Name="CmbModel" Width="220" SelectedIndex="0" Background="#2D2D33" Foreground="#F2F3F5"
                                      SelectionChanged="CmbModel_SelectionChanged">
                                <ComboBoxItem>Claude Sonnet (기본)</ComboBoxItem>
                                <ComboBoxItem>Claude Opus</ComboBoxItem>
                            </ComboBox>
                        </StackPanel>
                        <Button Content="🧩 AI 관리 · 로컬 모델 설치 · 활성 모델 선택" Click="BtnAiManager_Click"
                                HorizontalAlignment="Left" Height="34" Padding="14,0" Margin="0,12,0,0"
                                Background="#243B4A" Foreground="#4CC2FF" FontWeight="SemiBold" BorderThickness="0"/>
                        <TextBlock Foreground="{StaticResource TextMute}" FontSize="11" Margin="0,8,0,0"
                                   Text="※ 제공자/모델 선택과 로컬 AI(Ollama 등) 설치·다운로드는 'AI 관리'에서. ChatGPT/Gemini 실사용은 확장(M10)."/>
                    </StackPanel>
                </Border>

                <!-- placeholders for other sections -->
                <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}" BorderThickness="1"
                        CornerRadius="12" Padding="16" Margin="0,0,0,14">
                    <StackPanel>
                        <TextBlock Text="테마" Foreground="{StaticResource TextDim}" FontWeight="Bold" Margin="0,0,0,10"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="색상 모드" VerticalAlignment="Center" Foreground="{StaticResource TextDim}" FontSize="12" Width="180"/>
                            <ComboBox x:Name="CmbTheme" Width="180" Background="#2D2D33" Foreground="#F2F3F5"
                                      SelectionChanged="CmbTheme_SelectionChanged">
                                <ComboBoxItem>Dark (기본)</ComboBoxItem>
                                <ComboBoxItem>Light</ComboBoxItem>
                                <ComboBoxItem>System 추종</ComboBoxItem>
                            </ComboBox>
                        </StackPanel>
                        <TextBlock Foreground="{StaticResource TextMute}" FontSize="11" Margin="0,8,0,0"
                                   Text="※ Light/System 모드는 현재 WPF-UI 컨트롤에 적용되며, 다음 실행부터 반영됩니다."/>
                    </StackPanel>
                </Border>
                <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}" BorderThickness="1"
                        CornerRadius="12" Padding="16">
                    <StackPanel>
                        <TextBlock Text="Equalizer APO" Foreground="{StaticResource TextDim}" FontWeight="Bold"/>
                        <TextBlock Text="APO 경로 · 최초 연동 설정 (M3에서 구현)" Foreground="{StaticResource TextMute}" FontSize="12" Margin="0,6,0,0"/>
                    </StackPanel>
                </Border>

                <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}" BorderThickness="1"
                        CornerRadius="12" Padding="16" Margin="0,14,0,0">
                    <StackPanel>
                        <TextBlock Text="자동 전환" Foreground="{StaticResource TextDim}" FontWeight="Bold"/>
                        <Button Content="🔀 앱/장치 자동전환 규칙" Click="BtnSwitchRules_Click"
                                HorizontalAlignment="Left" Height="34" Padding="14,0" Margin="0,10,0,0"
                                Background="#243B4A" Foreground="#4CC2FF" FontWeight="SemiBold" BorderThickness="0"/>
                        <TextBlock Text="앱이 바뀌면 규칙에 맞는 프리셋을 자동 적용합니다(예: 게임→게이밍)." Foreground="{StaticResource TextMute}" FontSize="11" Margin="0,8,0,0"/>
                    </StackPanel>
                </Border>
            </StackPanel>
        </ScrollViewer>
    </DockPanel>
        </Border>
    </Grid>
</ui:FluentWindow>
