<Window x:Class="AxCopilot.Views.AboutWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="AX Copilot — 정보"
        Width="460" SizeToContent="Height"
        WindowStyle="None"
        AllowsTransparency="True"
        UseLayoutRounding="True"
        SnapsToDevicePixels="True"
        Background="Transparent"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen"
        ShowInTaskbar="False"
        Topmost="True"
        MouseDown="Window_MouseDown">

    <Window.Resources>
        <Style x:Key="LinkButton" TargetType="Button">
            <Setter Property="Background"      Value="Transparent"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Cursor"          Value="Hand"/>
            <Setter Property="Padding"         Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <TextBlock x:Name="Tb"
                                   Text="{TemplateBinding Content}"
                                   FontSize="12"
                                   Foreground="#7B8FFF"
                                   TextDecorations="Underline"/>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Tb" Property="Foreground" Value="#4B5EFC"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Grid Margin="20">
        <Border CornerRadius="20" Background="White">
            <Border.Effect>
                <DropShadowEffect Color="Black" BlurRadius="22" ShadowDepth="4" Opacity="0.24"/>
            </Border.Effect>
        </Border>
        <Border Background="White" CornerRadius="20" ClipToBounds="True">
            <Grid>
                <Grid.RowDefinitions>
                    <!-- 상단 헤더 그라데이션 -->
                    <RowDefinition Height="210"/>
                    <!-- 본문 -->
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <!-- ══ 헤더 ══ -->
                <Grid Grid.Row="0">
                    <Grid.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>
                    </Grid.Background>

                    <!-- 닫기 버튼 -->
                    <Button HorizontalAlignment="Right" VerticalAlignment="Top"
                            Margin="0,14,16,0"
                            Width="28" Height="28"
                            Background="Transparent" BorderThickness="0"
                            Cursor="Hand" Click="Close_Click">
                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border x:Name="Bd" CornerRadius="14" Background="Transparent">
                                    <TextBlock Text="&#xE711;" FontFamily="Segoe MDL2 Assets"
                                               FontSize="11" Foreground="#88AAFFEE"
                                               HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter TargetName="Bd" Property="Background" Value="#22FFFFFF"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>

                    <!-- 앱 아이콘 (항상 표시) -->
                    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,10,0,0">

                        <Border Width="88" Height="88" CornerRadius="44"
                                HorizontalAlignment="Center"
                                BorderBrush="#33FFFFFF" BorderThickness="2">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                    <GradientStop Color="#2E3060" Offset="0"/>
                                    <GradientStop Color="#3B4ECC" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Grid>
                                <!-- 다이아몬드 픽셀 아이콘 (벡터, 해상도 독립) -->
                                <Canvas x:Name="DiamondIconCanvas"
                                        Width="48" Height="48"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center">
                                    <Canvas.RenderTransform>
                                        <RotateTransform Angle="45" CenterX="24" CenterY="24"/>
                                    </Canvas.RenderTransform>
                                    <!-- 좌상→상: Blue -->
                                    <Rectangle Canvas.Left="1" Canvas.Top="1"
                                               Width="21" Height="21"
                                               RadiusX="3" RadiusY="3"
                                               Fill="#4488FF"/>
                                    <!-- 우상→우: Green -->
                                    <Rectangle Canvas.Left="26" Canvas.Top="1"
                                               Width="21" Height="21"
                                               RadiusX="3" RadiusY="3"
                                               Fill="#44DD66"/>
                                    <!-- 좌하→좌: Green -->
                                    <Rectangle Canvas.Left="1" Canvas.Top="26"
                                               Width="21" Height="21"
                                               RadiusX="3" RadiusY="3"
                                               Fill="#44DD66"/>
                                    <!-- 우하→하: Red -->
                                    <Rectangle Canvas.Left="26" Canvas.Top="26"
                                               Width="21" Height="21"
                                               RadiusX="3" RadiusY="3"
                                               Fill="#FF4466"/>
                                </Canvas>
                                <!-- 비트맵 아이콘 폴백 (숨김) -->
                                <Image x:Name="AppIconImage" Visibility="Collapsed"
                                       Stretch="UniformToFill"
                                       RenderOptions.BitmapScalingMode="HighQuality"/>
                                <TextBlock x:Name="FallbackIcon" Visibility="Collapsed"
                                           Text="&#xE700;"
                                           FontFamily="Segoe MDL2 Assets"
                                           FontSize="38" Foreground="#88FFFFFF"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"/>
                            </Grid>
                        </Border>
                        <!-- 마스코트 이미지 (숨겨진 상태 — 사용자 클릭 시 오버레이용으로만 사용) -->
                        <Image x:Name="MascotImage" Visibility="Collapsed"/>

                        <TextBlock x:Name="AppNameText"
                                   Text="AX Copilot"
                                   FontSize="20" FontWeight="Bold"
                                   Foreground="White"
                                   HorizontalAlignment="Center"
                                   Margin="0,14,0,3"/>
                        <TextBlock x:Name="VersionText"
                                   Text="v1.0.0"
                                   FontSize="12" Foreground="#88AACCFF"
                                   HorizontalAlignment="Center"/>
                    </StackPanel>
                </Grid>

                <!-- ══ 마스코트 오버레이 (클릭 시 표시) ══ -->
                <Grid x:Name="MascotOverlay"
                      Grid.Row="0" Grid.RowSpan="2"
                      Visibility="Collapsed"
                      Panel.ZIndex="10">
                    <!-- 어두운 배경 (클릭 시 닫기) -->
                    <Rectangle Fill="#CC101025"
                               MouseDown="HideMascot_Click"/>
                    <!-- 마스코트 이미지 -->
                    <Border Width="240" Height="240"
                            CornerRadius="20"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            ClipToBounds="True"
                            BorderBrush="#33FFFFFF"
                            BorderThickness="1.5">
                        <Border.Effect>
                            <DropShadowEffect Color="Black" BlurRadius="40"
                                             ShadowDepth="0" Opacity="0.7"/>
                        </Border.Effect>
                        <Image x:Name="MascotOverlayImage"
                               Stretch="UniformToFill"
                               RenderOptions.BitmapScalingMode="HighQuality"/>
                    </Border>
                    <!-- 닫기 힌트 -->
                    <TextBlock Text="클릭하여 닫기"
                               FontSize="11" Foreground="#88AACCFF"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Margin="0,270,0,0"
                               IsHitTestVisible="False"/>
                </Grid>

                <!-- ══ 본문 ══ -->
                <StackPanel Grid.Row="1" Margin="32,24,32,20">

                    <!-- 구분선 -->
                    <Rectangle Height="1" Fill="#F0F0F8" Margin="0,0,0,20"/>

                    <!-- 개발 목적 -->
                    <Border Background="#F7F8FF" CornerRadius="12" Padding="16,13" Margin="0,0,0,20">
                        <StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="0,0,0,6">
                                <TextBlock Text="&#xE946;" FontFamily="Segoe MDL2 Assets"
                                           FontSize="12" Foreground="#4B5EFC"
                                           VerticalAlignment="Center" Margin="0,0,8,0"/>
                                <TextBlock Text="개발 목적"
                                           FontSize="11" FontWeight="SemiBold"
                                           Foreground="#4B5EFC"/>
                            </StackPanel>
                            <TextBlock x:Name="PurposeText"
                                       Text="업무 편의성 증가 및 시스템과 직관적인 연결을 위해 제작"
                                       FontSize="12" Foreground="#444466"
                                       TextWrapping="Wrap" LineHeight="18"/>
                        </StackPanel>
                    </Border>

                    <!-- 개발자 정보 -->
                    <StackPanel Margin="0,0,0,16">
                        <TextBlock Text="개발자 정보"
                                   FontSize="10.5" FontWeight="SemiBold"
                                   Foreground="#AAAACC" Margin="0,0,0,10"/>

                        <!-- 조직 (클릭 시 마스코트 팝업) -->
                        <Grid Margin="0,0,0,10" Cursor="Hand" Background="Transparent"
                              MouseDown="ShowMascot_Click">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="28"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Border Width="24" Height="24" CornerRadius="6"
                                    Background="#EEF0FF" VerticalAlignment="Center">
                                <TextBlock Text="&#xE7EE;" FontFamily="Segoe MDL2 Assets"
                                           FontSize="12" Foreground="#4B5EFC"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Border>
                            <StackPanel Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center">
                                <TextBlock x:Name="CompanyNameText"
                                           Text="AX연구소 AI팀"
                                           FontSize="13" FontWeight="SemiBold"
                                           Foreground="#1A1B2E"/>
                                <TextBlock Text="백승재  ·  SW Architect"
                                           FontSize="11" Foreground="#7777AA" Margin="0,2,0,0"/>
                            </StackPanel>
                            <!-- 클릭 힌트 아이콘 -->
                            <TextBlock Grid.Column="2" Text="&#xE76C;"
                                       FontFamily="Segoe MDL2 Assets" FontSize="9"
                                       Foreground="#CCCCDD" VerticalAlignment="Center"
                                       Margin="0,0,2,0"/>
                        </Grid>

                        <!-- 블로그 -->
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="28"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Width="24" Height="24" CornerRadius="6"
                                    Background="#EEF0FF" VerticalAlignment="Center">
                                <TextBlock Text="&#xE774;" FontFamily="Segoe MDL2 Assets"
                                           FontSize="12" Foreground="#4B5EFC"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Border>
                            <StackPanel Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center">
                                <TextBlock Text="블로그" FontSize="11" Foreground="#9999BB" Margin="0,0,0,2"/>
                                <Button x:Name="BlogLinkBtn"
                                        Content="www.swarchitect.net"
                                        Style="{StaticResource LinkButton}"
                                        Click="Blog_Click"/>
                            </StackPanel>
                        </Grid>

                        <!-- 기여자 -->
                        <Grid Margin="0,12,0,0" x:Name="ContributorsGrid" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="28"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Width="24" Height="24" CornerRadius="6"
                                    Background="#EEF0FF" VerticalAlignment="Center">
                                <TextBlock Text="&#xE716;" FontFamily="Segoe MDL2 Assets"
                                           FontSize="12" Foreground="#4B5EFC"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Border>
                            <StackPanel Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center">
                                <TextBlock Text="기여자" FontSize="11" Foreground="#9999BB" Margin="0,0,0,2"/>
                                <TextBlock x:Name="ContributorsText"
                                           FontSize="12" Foreground="#444466"
                                           TextWrapping="Wrap" LineHeight="18"/>
                            </StackPanel>
                        </Grid>
                    </StackPanel>

                    <!-- 구분선 -->
                    <Rectangle Height="1" Fill="#F0F0F8" Margin="0,0,0,14"/>

                    <!-- 버전/빌드 정보 -->
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <TextBlock Text="&#xE700;" FontFamily="Segoe MDL2 Assets"
                                   FontSize="10" Foreground="#CCCCDD"
                                   VerticalAlignment="Center" Margin="0,0,6,0"/>
                        <TextBlock x:Name="BuildInfoText"
                                   FontSize="10.5" Foreground="#BBBBCC"
                                   VerticalAlignment="Center"/>
                    </StackPanel>

                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Window>
