<Window x:Class="AxCopilot.Views.BatchRenameWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="AX Commander — 배치 파일 이름변경"
        Width="780" Height="580"
        MinWidth="560" MinHeight="420"
        WindowStyle="None" AllowsTransparency="True"
        Background="Transparent"
        WindowStartupLocation="CenterScreen"
        ResizeMode="CanResizeWithGrip"
        ShowInTaskbar="False"
        AllowDrop="True">

    <Window.Resources>
        <!-- 원본 열 텍스트 스타일 -->
        <Style x:Key="OrigColStyle" TargetType="TextBlock">
            <Setter Property="Margin" Value="12,0"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Foreground" Value="{DynamicResource SecondaryText}"/>
        </Style>
        <!-- 새 이름 열 텍스트 스타일 -->
        <Style x:Key="NewColStyle" TargetType="TextBlock">
            <Setter Property="Margin" Value="12,0"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Foreground" Value="{DynamicResource PrimaryText}"/>
        </Style>
        <!-- 상태 열 텍스트 스타일 -->
        <Style x:Key="StatusColStyle" TargetType="TextBlock">
            <Setter Property="Margin" Value="8,0"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="FontSize" Value="11"/>
        </Style>
    </Window.Resources>

    <Border Background="{DynamicResource LauncherBackground}" CornerRadius="12"
            BorderBrush="{DynamicResource BorderColor}" BorderThickness="1"
            Margin="6">
        <Border.Effect>
            <DropShadowEffect BlurRadius="22" ShadowDepth="4" Opacity="0.32" Color="Black" Direction="270"/>
        </Border.Effect>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="44"/>    <!-- 타이틀바 -->
                <RowDefinition Height="Auto"/>  <!-- 패턴 입력 -->
                <RowDefinition Height="*"/>     <!-- 미리보기 그리드 -->
                <RowDefinition Height="Auto"/>  <!-- 하단 버튼 바 -->
            </Grid.RowDefinitions>

            <!-- ─── 타이틀바 ─────────────────────────────────────────────── -->
            <Border Grid.Row="0" CornerRadius="12,12,0,0"
                    Background="{DynamicResource ItemBackground}"
                    MouseLeftButtonDown="TitleBar_MouseDown">
                <Grid Margin="14,0,8,0">
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <TextBlock Text="&#xE8AC;"
                                   FontFamily="Segoe MDL2 Assets" FontSize="15"
                                   Foreground="{DynamicResource AccentColor}"
                                   VerticalAlignment="Center" Margin="0,1,10,0"/>
                        <TextBlock Text="배치 파일 이름변경"
                                   FontSize="13" FontWeight="SemiBold"
                                   Foreground="{DynamicResource PrimaryText}"
                                   VerticalAlignment="Center"/>
                        <TextBlock x:Name="FileCountBadge" Text=""
                                   FontSize="11"
                                   Foreground="{DynamicResource SecondaryText}"
                                   VerticalAlignment="Center"
                                   Margin="10,0,0,0"/>
                    </StackPanel>
                    <Border HorizontalAlignment="Right" VerticalAlignment="Center"
                            CornerRadius="4" Padding="8,4" Cursor="Hand"
                            MouseLeftButtonUp="BtnClose_Click">
                        <Border.Style>
                            <Style TargetType="Border">
                                <Setter Property="Background" Value="Transparent"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="#40C05050"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                        <TextBlock Text="&#xE711;" FontFamily="Segoe MDL2 Assets" FontSize="13"
                                   Foreground="{DynamicResource SecondaryText}"/>
                    </Border>
                </Grid>
            </Border>

            <!-- ─── 패턴 입력 영역 ───────────────────────────────────────── -->
            <Border Grid.Row="1"
                    Background="{DynamicResource ItemBackground}"
                    BorderBrush="{DynamicResource BorderColor}" BorderThickness="0,1,0,1"
                    Padding="14,10">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="8"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <!-- 패턴 입력 행 -->
                    <Grid Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="44"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Grid.Column="0" Text="패턴"
                                   FontSize="12" FontWeight="Medium"
                                   Foreground="{DynamicResource SecondaryText}"
                                   VerticalAlignment="Center"/>

                        <TextBox Grid.Column="1" x:Name="PatternBox"
                                 FontFamily="Cascadia Code, Consolas, Courier New"
                                 FontSize="12"
                                 Foreground="{DynamicResource PrimaryText}"
                                 Background="{DynamicResource LauncherBackground}"
                                 BorderBrush="{DynamicResource BorderColor}"
                                 BorderThickness="1"
                                 Padding="8,5"
                                 VerticalContentAlignment="Center"
                                 Text="{}{n}_{name}"
                                 TextChanged="PatternBox_TextChanged"/>

                        <!-- 변수 힌트 버튼 -->
                        <Border Grid.Column="2" x:Name="BtnHint"
                                Margin="6,0,0,0"
                                CornerRadius="4" Padding="10,5" Cursor="Hand"
                                MouseLeftButtonUp="BtnHint_Click">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#18FFFFFF"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="#28FFFFFF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <TextBlock Text="변수 ?"
                                       FontSize="11"
                                       Foreground="{DynamicResource AccentColor}"/>
                        </Border>

                        <!-- 힌트 팝업 -->
                        <Popup x:Name="HintPopup"
                               Grid.Column="2"
                               PlacementTarget="{x:Reference BtnHint}"
                               Placement="Bottom"
                               AllowsTransparency="True"
                               StaysOpen="False">
                            <Border Background="{DynamicResource ItemBackground}"
                                    BorderBrush="{DynamicResource BorderColor}" BorderThickness="1"
                                    CornerRadius="8" Padding="14,10"
                                    MinWidth="280">
                                <Border.Effect>
                                    <DropShadowEffect BlurRadius="12" ShadowDepth="2" Opacity="0.3" Color="Black" Direction="270"/>
                                </Border.Effect>
                                <StackPanel>
                                    <TextBlock Text="사용 가능한 변수"
                                               FontSize="11" FontWeight="SemiBold"
                                               Foreground="{DynamicResource SecondaryText}"
                                               Margin="0,0,0,8"/>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="120"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="22"/>
                                            <RowDefinition Height="22"/>
                                            <RowDefinition Height="22"/>
                                            <RowDefinition Height="22"/>
                                            <RowDefinition Height="22"/>
                                            <RowDefinition Height="22"/>
                                            <RowDefinition Height="8"/>
                                            <RowDefinition Height="22"/>
                                        </Grid.RowDefinitions>
                                        <!-- 변수 목록 -->
                                        <TextBlock Grid.Row="0" Grid.Column="0" Text="{}{name}"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="{DynamicResource AccentColor}" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="0" Grid.Column="1" Text="원본 파일명 (확장자 제외)"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>

                                        <TextBlock Grid.Row="1" Grid.Column="0" Text="{}{n}"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="{DynamicResource AccentColor}" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="1" Grid.Column="1" Text="순번 (1, 2, 3 …)"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>

                                        <TextBlock Grid.Row="2" Grid.Column="0" Text="{}{n:3}"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="{DynamicResource AccentColor}" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="2" Grid.Column="1" Text="세 자리 순번 (001, 002 …)"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>

                                        <TextBlock Grid.Row="3" Grid.Column="0" Text="{}{date}"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="{DynamicResource AccentColor}" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="3" Grid.Column="1" Text="오늘 날짜 (yyyy-MM-dd)"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>

                                        <TextBlock Grid.Row="4" Grid.Column="0" Text="{}{date:yyyyMMdd}"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="{DynamicResource AccentColor}" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="4" Grid.Column="1" Text="날짜 (형식 직접 지정)"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>

                                        <TextBlock Grid.Row="5" Grid.Column="0" Text="{}{ext}"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="{DynamicResource AccentColor}" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="5" Grid.Column="1" Text="원본 확장자 (점 제외)"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>

                                        <Border Grid.Row="6" Grid.ColumnSpan="2"
                                                BorderBrush="{DynamicResource BorderColor}" BorderThickness="0,1,0,0" Margin="0,2"/>

                                        <TextBlock Grid.Row="7" Grid.Column="0" Text="/old/new/"
                                                   FontFamily="Cascadia Code, Consolas" FontSize="11"
                                                   Foreground="#F59E0B" VerticalAlignment="Center"/>
                                        <TextBlock Grid.Row="7" Grid.Column="1" Text="정규식 모드: 패턴 치환"
                                                   FontSize="11" Foreground="{DynamicResource PrimaryText}" VerticalAlignment="Center"/>
                                    </Grid>
                                </StackPanel>
                            </Border>
                        </Popup>
                    </Grid>

                    <!-- 옵션 행 -->
                    <Grid Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="44"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Grid.Column="0" Text="모드"
                                   FontSize="12" FontWeight="Medium"
                                   Foreground="{DynamicResource SecondaryText}"
                                   VerticalAlignment="Center"/>

                        <!-- 모드 세그먼트 -->
                        <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
                            <Border x:Name="BtnModeVar"
                                    CornerRadius="4,0,0,4" Padding="12,4"
                                    Cursor="Hand" MouseLeftButtonUp="BtnModeVar_Click">
                                <Border.Style>
                                    <Style TargetType="Border">
                                        <Setter Property="Background" Value="{DynamicResource AccentColor}"/>
                                    </Style>
                                </Border.Style>
                                <TextBlock x:Name="BtnModeVarText" Text="변수 패턴"
                                           FontSize="11" Foreground="White"/>
                            </Border>
                            <Border x:Name="BtnModeRegex"
                                    CornerRadius="0,4,4,0" Padding="12,4"
                                    Cursor="Hand" MouseLeftButtonUp="BtnModeRegex_Click">
                                <Border.Style>
                                    <Style TargetType="Border">
                                        <Setter Property="Background" Value="#18FFFFFF"/>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="#28FFFFFF"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Border.Style>
                                <TextBlock x:Name="BtnModeRegexText" Text="정규식"
                                           FontSize="11" Foreground="{DynamicResource SecondaryText}"/>
                            </Border>

                            <TextBlock Text="시작 번호"
                                       FontSize="11"
                                       Foreground="{DynamicResource SecondaryText}"
                                       VerticalAlignment="Center"
                                       Margin="14,0,6,0"/>
                            <TextBox x:Name="StartNumberBox"
                                     Width="52" Text="1"
                                     FontSize="12"
                                     Foreground="{DynamicResource PrimaryText}"
                                     Background="{DynamicResource LauncherBackground}"
                                     BorderBrush="{DynamicResource BorderColor}"
                                     BorderThickness="1"
                                     Padding="6,3"
                                     VerticalContentAlignment="Center"
                                     TextChanged="StartNumberBox_TextChanged"/>
                        </StackPanel>

                        <!-- 확장자 유지 토글 -->
                        <StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
                            <TextBlock Text="확장자 유지"
                                       FontSize="11"
                                       Foreground="{DynamicResource SecondaryText}"
                                       VerticalAlignment="Center"
                                       Margin="0,0,8,0"/>
                            <Border x:Name="ExtToggle"
                                    Width="36" Height="20" CornerRadius="10"
                                    Background="{DynamicResource AccentColor}"
                                    Cursor="Hand" MouseLeftButtonUp="ExtToggle_Click">
                                <Border x:Name="ExtThumb"
                                        Width="16" Height="16" CornerRadius="8"
                                        Background="White"
                                        HorizontalAlignment="Right"
                                        Margin="0,0,1,0"/>
                            </Border>
                        </StackPanel>
                    </Grid>
                </Grid>
            </Border>

            <!-- ─── 미리보기 그리드 ──────────────────────────────────────── -->
            <Grid Grid.Row="2">

                <!-- 드롭 힌트 오버레이 -->
                <Border x:Name="DropHintOverlay"
                        Background="#18FFFFFF"
                        Visibility="Collapsed">
                    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                        <TextBlock Text="&#xE8D4;"
                                   FontFamily="Segoe MDL2 Assets" FontSize="40"
                                   Foreground="{DynamicResource AccentColor}"
                                   HorizontalAlignment="Center"/>
                        <TextBlock Text="파일을 여기에 끌어다 놓으세요"
                                   FontSize="14" FontWeight="Medium"
                                   Foreground="{DynamicResource PrimaryText}"
                                   HorizontalAlignment="Center"
                                   Margin="0,10,0,0"/>
                    </StackPanel>
                </Border>

                <!-- 빈 상태 안내 -->
                <StackPanel x:Name="EmptyState"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Center"
                            Visibility="Visible">
                    <TextBlock Text="&#xE8AC;"
                               FontFamily="Segoe MDL2 Assets" FontSize="44"
                               Foreground="{DynamicResource SecondaryText}"
                               HorizontalAlignment="Center" Opacity="0.3"/>
                    <TextBlock Text="파일을 추가하세요"
                               FontSize="14"
                               Foreground="{DynamicResource SecondaryText}"
                               HorizontalAlignment="Center"
                               Margin="0,12,0,4" Opacity="0.6"/>
                    <TextBlock Text="하단 버튼 또는 드래그 앤 드롭으로 파일이나 폴더를 추가합니다"
                               FontSize="11"
                               Foreground="{DynamicResource SecondaryText}"
                               HorizontalAlignment="Center" Opacity="0.4"/>
                </StackPanel>

                <!-- DataGrid 미리보기 -->
                <DataGrid x:Name="PreviewGrid"
                          AutoGenerateColumns="False"
                          IsReadOnly="True"
                          SelectionMode="Extended"
                          GridLinesVisibility="Horizontal"
                          HeadersVisibility="Column"
                          CanUserReorderColumns="False"
                          CanUserResizeRows="False"
                          CanUserSortColumns="False"
                          Background="{DynamicResource LauncherBackground}"
                          RowBackground="Transparent"
                          AlternatingRowBackground="#07FFFFFF"
                          BorderThickness="0"
                          FontSize="12"
                          HorizontalScrollBarVisibility="Auto"
                          VerticalScrollBarVisibility="Auto"
                          Visibility="Collapsed">
                    <DataGrid.Resources>
                        <Style TargetType="DataGridColumnHeader">
                            <Setter Property="Background" Value="{DynamicResource ItemBackground}"/>
                            <Setter Property="Foreground" Value="{DynamicResource SecondaryText}"/>
                            <Setter Property="FontSize" Value="11"/>
                            <Setter Property="FontWeight" Value="Medium"/>
                            <Setter Property="Padding" Value="12,6"/>
                            <Setter Property="BorderThickness" Value="0,0,0,1"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BorderColor}"/>
                        </Style>
                        <Style TargetType="DataGridRow">
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="MinHeight" Value="30"/>
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="#14FFFFFF"/>
                                </Trigger>
                                <DataTrigger Binding="{Binding HasConflict}" Value="True">
                                    <Setter Property="Background" Value="#18EF5350"/>
                                </DataTrigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="Background" Value="#20AccentColor"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                        <Style TargetType="DataGridCell">
                            <Setter Property="BorderThickness" Value="0"/>
                            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                        </Style>
                    </DataGrid.Resources>
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="원본 파일명"
                                            Binding="{Binding OriginalName}"
                                            Width="*"
                                            ElementStyle="{StaticResource OrigColStyle}"/>
                        <DataGridTextColumn Header="새 파일명"
                                            Binding="{Binding NewName}"
                                            Width="*"
                                            ElementStyle="{StaticResource NewColStyle}"/>
                        <DataGridTextColumn Header="상태"
                                            Binding="{Binding StatusText}"
                                            Width="72"
                                            ElementStyle="{StaticResource StatusColStyle}"/>
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>

            <!-- ─── 하단 버튼 바 ─────────────────────────────────────────── -->
            <Border Grid.Row="3" CornerRadius="0,0,12,12"
                    Background="{DynamicResource ItemBackground}"
                    BorderBrush="{DynamicResource BorderColor}" BorderThickness="0,1,0,0"
                    Padding="12,8">
                <Grid>
                    <!-- 좌측: 파일 조작 버튼 -->
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">

                        <!-- 폴더 추가 -->
                        <Border CornerRadius="4" Padding="10,5" Cursor="Hand" Margin="0,0,6,0"
                                MouseLeftButtonUp="BtnAddFolder_Click">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#18FFFFFF"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="#28FFFFFF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="&#xE8B7;" FontFamily="Segoe MDL2 Assets" FontSize="12"
                                           Foreground="#5C9BD6" VerticalAlignment="Center" Margin="0,0,5,0"/>
                                <TextBlock Text="폴더 추가" FontSize="12"
                                           Foreground="{DynamicResource PrimaryText}"/>
                            </StackPanel>
                        </Border>

                        <!-- 파일 추가 -->
                        <Border CornerRadius="4" Padding="10,5" Cursor="Hand" Margin="0,0,6,0"
                                MouseLeftButtonUp="BtnAddFiles_Click">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#18FFFFFF"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="#28FFFFFF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="&#xE8A5;" FontFamily="Segoe MDL2 Assets" FontSize="12"
                                           Foreground="#5CB85C" VerticalAlignment="Center" Margin="0,0,5,0"/>
                                <TextBlock Text="파일 추가" FontSize="12"
                                           Foreground="{DynamicResource PrimaryText}"/>
                            </StackPanel>
                        </Border>

                        <!-- 선택 제거 -->
                        <Border CornerRadius="4" Padding="10,5" Cursor="Hand" Margin="0,0,6,0"
                                MouseLeftButtonUp="BtnRemoveSelected_Click">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#18FFFFFF"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="#28FFFFFF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="&#xE74D;" FontFamily="Segoe MDL2 Assets" FontSize="12"
                                           Foreground="#EF5350" VerticalAlignment="Center" Margin="0,0,5,0"/>
                                <TextBlock Text="선택 제거" FontSize="12"
                                           Foreground="{DynamicResource PrimaryText}"/>
                            </StackPanel>
                        </Border>

                        <!-- 전체 제거 -->
                        <Border CornerRadius="4" Padding="10,5" Cursor="Hand"
                                MouseLeftButtonUp="BtnClearAll_Click">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="#18FFFFFF"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="#28FFFFFF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="&#xE74D;" FontFamily="Segoe MDL2 Assets" FontSize="12"
                                           Foreground="{DynamicResource SecondaryText}" VerticalAlignment="Center" Margin="0,0,5,0"/>
                                <TextBlock Text="전체 제거" FontSize="12"
                                           Foreground="{DynamicResource SecondaryText}"/>
                            </StackPanel>
                        </Border>
                    </StackPanel>

                    <!-- 우측: 충돌 수 + 적용 버튼 -->
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
                        <TextBlock x:Name="ConflictLabel" Text=""
                                   FontSize="11"
                                   Foreground="#EF5350"
                                   VerticalAlignment="Center"
                                   Margin="0,0,14,0"/>

                        <Border x:Name="BtnApply"
                                CornerRadius="4" Padding="16,6" Cursor="Hand"
                                Background="{DynamicResource AccentColor}"
                                MouseLeftButtonUp="BtnApply_Click">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="{DynamicResource AccentColor}"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Opacity" Value="0.85"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="&#xE8AC;" FontFamily="Segoe MDL2 Assets" FontSize="12"
                                           Foreground="White" VerticalAlignment="Center" Margin="0,0,6,0"/>
                                <TextBlock Text="적용" FontSize="12" FontWeight="SemiBold"
                                           Foreground="White"/>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                </Grid>
            </Border>
        </Grid>
    </Border>
</Window>
