<Window x:Class="NavisworksTransport.UI.WPF.Views.CornerTurnCheckDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converters="clr-namespace:NavisworksTransport.UI.WPF.Converters"
        Title="过弯检测" Height="520" Width="420"
        WindowStartupLocation="CenterScreen"
        ResizeMode="NoResize"
        ShowInTaskbar="False"
        Topmost="True"
        Background="White">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/TransportPlugin;component/src/UI/WPF/Resources/NavisworksStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <converters:EditableNumberConverter x:Key="EditableNumberConverter"/>
        </ResourceDictionary>
    </Window.Resources>

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

        <!-- 标题栏 -->
        <Border Grid.Row="0" Background="#FFF8FBFF" BorderBrush="#FFD4E7FF" BorderThickness="0,0,0,1" Padding="20,15">
            <StackPanel>
                <TextBlock Text="过弯检测" FontWeight="SemiBold" FontSize="14" Foreground="#FF2B579A"/>
                <TextBlock Text="检查矩形模块能否通过 L 形通道" FontSize="10" Foreground="#FF666666" Margin="0,3,0,0"/>
            </StackPanel>
        </Border>

        <!-- 输入区域 -->
        <Border Grid.Row="1" Padding="20,15">
            <StackPanel>
                <Border Background="#FFF0F7FF" BorderBrush="#FFD4E7FF" BorderThickness="1" Padding="12,10" Margin="0,0,0,15">
                    <TextBlock Text="模块在转角处的投影宽度不能超过通道宽度，输入尺寸后计算最优化角度下的通过性。" 
                               FontSize="10" Foreground="#FF666666" TextWrapping="Wrap"/>
                </Border>

                <!-- 入口通道宽度 -->
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="30"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="入口通道宽度 C₁:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
                    <TextBox Grid.Column="1" x:Name="EntryWidthBox" Height="28"
                             VerticalContentAlignment="Center" Padding="8,0" FontSize="11"
                             BorderBrush="#FFCCCCCC" BorderThickness="1"/>
                    <TextBlock Grid.Column="2" Text="米" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="5,0,0,0"/>
                </Grid>

                <!-- 出口通道宽度 -->
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="30"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="出口通道宽度 C₂:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
                    <TextBox Grid.Column="1" x:Name="ExitWidthBox" Height="28"
                             VerticalContentAlignment="Center" Padding="8,0" FontSize="11"
                             BorderBrush="#FFCCCCCC" BorderThickness="1"/>
                    <TextBlock Grid.Column="2" Text="米" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="5,0,0,0"/>
                </Grid>

                <!-- 分隔线 -->
                <Border Height="1" Background="#FFEEEEEE" Margin="0,0,0,12"/>

                <!-- 模块长度 -->
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="30"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="模块长度 L:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
                    <TextBox Grid.Column="1" x:Name="LengthBox" Height="28"
                             VerticalContentAlignment="Center" Padding="8,0" FontSize="11"
                             BorderBrush="#FFCCCCCC" BorderThickness="1"/>
                    <TextBlock Grid.Column="2" Text="米" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="5,0,0,0"/>
                </Grid>

                <!-- 模块宽度 -->
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="30"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="模块宽度 W:" VerticalAlignment="Center" FontSize="11" Foreground="#FF333333"/>
                    <TextBox Grid.Column="1" x:Name="WidthBox" Height="28"
                             VerticalContentAlignment="Center" Padding="8,0" FontSize="11"
                             BorderBrush="#FFCCCCCC" BorderThickness="1"/>
                    <TextBlock Grid.Column="2" Text="米" VerticalAlignment="Center" FontSize="11" Foreground="#FF666666" Margin="5,0,0,0"/>
                </Grid>

                <!-- 结果区 -->
                <Border x:Name="ResultBorder" Background="#FFF0FFF0" BorderBrush="#FF4CAF50" BorderThickness="1" Padding="12,10" Margin="0,5,0,0"
                        Visibility="Collapsed">
                    <StackPanel>
                        <TextBlock x:Name="ResultTitle" FontWeight="SemiBold" FontSize="12" Foreground="#FF2E7D32"/>
                        <TextBlock x:Name="ResultDetail" FontSize="10" Foreground="#FF666666" Margin="0,3,0,0"/>
                    </StackPanel>
                </Border>
            </StackPanel>
        </Border>

        <!-- 按钮栏 -->
        <Border Grid.Row="2" Background="#FFF8FBFF" BorderBrush="#FFD4E7FF" BorderThickness="0,1,0,0" Padding="20,12">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Content="计算" Click="OnCalculateClick"
                        Style="{StaticResource ActionButtonStyle}" Width="90" Height="32" Margin="0,0,10,0"/>
                <Button Content="关闭" Click="OnCloseClick"
                        Style="{StaticResource SecondaryButtonStyle}" Width="90" Height="32"/>
            </StackPanel>
        </Border>
    </Grid>
</Window>
