<Window x:Class="AxCopilot.Views.HelpDetailWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="AX Commander — 기능 목록"
        Width="1020" Height="720"
        WindowStyle="None"
        AllowsTransparency="True"
        UseLayoutRounding="True"
        SnapsToDevicePixels="True"
        Background="Transparent"
        WindowStartupLocation="CenterScreen"
        ShowInTaskbar="False"
        MouseDown="Window_MouseDown"
        KeyDown="Window_KeyDown">

    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVis"/>
    </Window.Resources>

    <Border Margin="20"
            CornerRadius="16"
            Background="{DynamicResource LauncherBackground}"
            BorderBrush="{DynamicResource AccentColor}"
            BorderThickness="1">
        <Border.Effect>
            <DropShadowEffect Color="{DynamicResource ShadowColor}" BlurRadius="28" ShadowDepth="5" Opacity="0.32"/>
        </Border.Effect>

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

            <!-- ─── 헤더 ─────────────────────────────────────── -->
            <Border Grid.Row="0" CornerRadius="16,16,0,0" Padding="24,18,24,14">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                        <GradientStop Color="#1A1B2E" Offset="0"/>
                        <GradientStop Color="#2B2D5B" Offset="0.5"/>
                        <GradientStop Color="#3B4ECC" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Grid>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <TextBlock Text="&#xE946;"
                                   FontFamily="Segoe MDL2 Assets"
                                   FontSize="22"
                                   Foreground="#6496FF"
                                   VerticalAlignment="Center"
                                   Margin="0,0,12,0"/>
                        <StackPanel VerticalAlignment="Center">
                            <TextBlock Text="AX Commander — 전체 기능 목록"
                                       FontSize="16" FontWeight="SemiBold"
                                       Foreground="White"/>
                            <TextBlock x:Name="SubtitleText"
                                       FontSize="11"
                                       Foreground="#8899CC"/>
                        </StackPanel>
                    </StackPanel>
                    <Button HorizontalAlignment="Right" VerticalAlignment="Center"
                            Width="32" Height="32"
                            Background="Transparent" BorderThickness="0"
                            Cursor="Hand" Click="Close_Click">
                        <TextBlock Text="&#xE711;"
                                   FontFamily="Segoe MDL2 Assets"
                                   FontSize="13"
                                   Foreground="#8899CC"/>
                    </Button>
                </Grid>
            </Border>

            <!-- ─── 상단 탭 메뉴 + 검색 ── -->
            <Border Grid.Row="1" Background="{DynamicResource HintBackground}" Padding="16,8">
                <Grid>
                    <StackPanel x:Name="TopMenuBar"
                                Orientation="Horizontal"
                                HorizontalAlignment="Center"/>
                    <!-- 검색 박스 -->
                    <Border HorizontalAlignment="Right" VerticalAlignment="Center"
                            Background="{DynamicResource ItemBackground}" CornerRadius="8" Padding="8,4">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="&#xE721;"
                                       FontFamily="Segoe MDL2 Assets"
                                       FontSize="12" Foreground="{DynamicResource AccentColor}"
                                       VerticalAlignment="Center" Margin="0,0,6,0"/>
                            <TextBox x:Name="SearchBox"
                                     Width="140" FontSize="11"
                                     Foreground="{DynamicResource PrimaryText}"
                                     CaretBrush="{DynamicResource AccentColor}"
                                     Background="Transparent"
                                     BorderThickness="0"
                                     VerticalAlignment="Center"
                                     TextChanged="SearchBox_TextChanged"/>
                        </StackPanel>
                    </Border>
                </Grid>
            </Border>

            <!-- ─── 하위 카테고리 탭 바 ────────────────────────── -->
            <Border Grid.Row="2" Background="{DynamicResource SeparatorColor}" Padding="12,6">
                <WrapPanel x:Name="CategoryBar"
                           Orientation="Horizontal"
                           HorizontalAlignment="Center"/>
            </Border>

            <!-- ─── 기능 목록 (현재 페이지) ──────────────────────── -->
            <ScrollViewer Grid.Row="3"
                          VerticalScrollBarVisibility="Auto"
                          HorizontalScrollBarVisibility="Disabled"
                          Padding="16,8">
                <ItemsControl x:Name="ItemsHost" Margin="4,0">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Border Margin="0,3" CornerRadius="10" Padding="14,10"
                                    Background="{DynamicResource ItemBackground}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="38"/>
                                        <ColumnDefinition Width="120"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="200"/>
                                    </Grid.ColumnDefinitions>

                                    <!-- 심볼 아이콘 -->
                                    <Border Grid.Column="0"
                                            Width="32" Height="32"
                                            CornerRadius="8"
                                            Background="{Binding ColorBrush}"
                                            VerticalAlignment="Center">
                                        <TextBlock Text="{Binding Symbol}"
                                                   FontFamily="Segoe MDL2 Assets"
                                                   FontSize="14"
                                                   Foreground="White"
                                                   HorizontalAlignment="Center"
                                                   VerticalAlignment="Center"/>
                                    </Border>

                                    <!-- 카테고리 + 예약어 -->
                                    <StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="10,0,8,0">
                                        <TextBlock Text="{Binding Category}"
                                                   FontSize="10" Foreground="{DynamicResource SecondaryText}"/>
                                        <TextBlock Text="{Binding Command}"
                                                   FontFamily="Consolas"
                                                   FontSize="13" FontWeight="SemiBold"
                                                   Foreground="{DynamicResource PrimaryText}"/>
                                    </StackPanel>

                                    <!-- 제목 + 설명 -->
                                    <StackPanel Grid.Column="2" VerticalAlignment="Center" Margin="0,0,12,0">
                                        <TextBlock Text="{Binding Title}"
                                                   FontSize="13" FontWeight="SemiBold"
                                                   Foreground="{DynamicResource PrimaryText}" TextWrapping="Wrap"/>
                                        <TextBlock Text="{Binding Description}"
                                                   FontSize="11" Foreground="{DynamicResource SecondaryText}"
                                                   TextWrapping="Wrap" Margin="0,2,0,0"/>
                                    </StackPanel>

                                    <!-- 예시 -->
                                    <Border Grid.Column="3"
                                            Background="{DynamicResource HintBackground}"
                                            CornerRadius="6"
                                            Padding="8,4"
                                            VerticalAlignment="Center"
                                            Visibility="{Binding HasExample, Converter={StaticResource BoolToVis}}">
                                        <TextBlock Text="{Binding Example}"
                                                   FontFamily="Consolas"
                                                   FontSize="10"
                                                   Foreground="{DynamicResource AccentColor}"
                                                   TextWrapping="Wrap"/>
                                    </Border>
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

            <!-- ─── 푸터 (네비게이션 + 안내) ───────────────────── -->
            <Border Grid.Row="4"
                    Background="{DynamicResource SeparatorColor}"
                    CornerRadius="0,0,16,16"
                    Padding="20,10">
                <Grid>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                        <Button x:Name="PrevBtn" Content="◀ 이전"
                                Click="Prev_Click"
                                Background="Transparent" BorderThickness="0"
                                Foreground="{DynamicResource AccentColor}" FontSize="12"
                                Cursor="Hand" Padding="8,4" Margin="0,0,8,0"/>
                        <TextBlock x:Name="PageIndicator"
                                   FontSize="11" Foreground="{DynamicResource SecondaryText}"
                                   VerticalAlignment="Center"/>
                        <Button x:Name="NextBtn" Content="다음 ▶"
                                Click="Next_Click"
                                Background="Transparent" BorderThickness="0"
                                Foreground="{DynamicResource AccentColor}" FontSize="12"
                                Cursor="Hand" Padding="8,4" Margin="8,0,0,0"/>
                    </StackPanel>
                    <TextBlock Text="← → 페이지 이동  ·  ESC 닫기"
                               FontSize="11"
                               Foreground="{DynamicResource SecondaryText}"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Center"/>
                </Grid>
            </Border>
        </Grid>
    </Border>
</Window>
