<Window x:Class="XplorePlane.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:vm="clr-namespace:XplorePlane.ViewModels"
        xmlns:fluent="urn:fluent-ribbon"
        mc:Ignorable="d"
        Title="XplorePlane"
        Height="768" Width="1080"
        Background="#F5F5F5"
        WindowStartupLocation="CenterScreen">

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="169*"/>
            <ColumnDefinition Width="47*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="24"/>
        </Grid.RowDefinitions>

        <!-- Row 0: Fluent Ribbon -->
        <fluent:Ribbon Grid.Row="0" x:Name="Ribbon" Grid.ColumnSpan="2" Grid.RowSpan="2">
            <fluent:RibbonTabItem Header="主页">
                <fluent:RibbonGroupBox Header="导航">
                    <fluent:Button Header="主页" Command="{Binding NavigateHomeCommand}" LargeIcon="pack://application:,,,/Assets/Icons/home.png" Size="Large"/>
                    <fluent:Button Header="检测" Command="{Binding NavigateInspectCommand}" LargeIcon="pack://application:,,,/Assets/Icons/inspect.png" Size="Large"/>
                </fluent:RibbonGroupBox>
                <fluent:RibbonGroupBox Header="文件">
                    <fluent:Button Header="打开" Command="{Binding OpenFileCommand}" Icon="pack://application:,,,/Assets/Icons/open.png" Size="Middle"/>
                    <fluent:Button Header="导出" Command="{Binding ExportCommand}" Icon="pack://application:,,,/Assets/Icons/export.png" Size="Middle"/>
                    <fluent:Button Header="清空" Command="{Binding ClearCommand}" Icon="pack://application:,,,/Assets/Icons/clear.png" Size="Middle"/>
                </fluent:RibbonGroupBox>
            </fluent:RibbonTabItem>
            <fluent:RibbonTabItem Header="编辑">
                <fluent:RibbonGroupBox Header="操作">
                    <fluent:Button Header="修改属性" Command="{Binding EditPropertiesCommand}" Icon="pack://application:,,,/Assets/Icons/edit.png" Size="Middle"/>
                </fluent:RibbonGroupBox>
            </fluent:RibbonTabItem>
        </fluent:Ribbon>

        <!-- Row 1: Main Content -->
        <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,0,24" Grid.RowSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300
                                  " MinWidth="200"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="200" MinWidth="140"/>
            </Grid.ColumnDefinitions>

            <!-- Navigation Panel -->
            <Grid Grid.Column="0" Background="#FFFFFF">
                <Grid.RowDefinitions>
                    <RowDefinition Height="26"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <Border Grid.Row="0" Background="#F0F0F0" BorderBrush="#DDDDDD" BorderThickness="0,0,0,1">
                    <TextBlock Text="导航" Foreground="#333333" VerticalAlignment="Center" Margin="8,0" FontWeight="SemiBold"/>
                </Border>

                <TreeView Grid.Row="1" ItemsSource="{Binding NavigationTree}" Background="Transparent" BorderThickness="0" Foreground="#333333"/>
            </Grid>

            <!-- 3D Viewport -->
            <Grid Grid.Column="1" Background="#E8E8E8">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="90"/>
                </Grid.RowDefinitions>

                <Border Grid.Row="0" Background="#FFFFFF" BorderBrush="#DDDDDD" BorderThickness="1" Margin="0,0,0,3" Grid.RowSpan="2">
                    <TextBlock Text="2D Viewport" Foreground="#666666" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16"/>
                </Border>
            </Grid>

            <!-- Properties Panel -->
            <Grid Grid.Column="2" Background="#FFFFFF">
                <Grid.RowDefinitions>
                    <RowDefinition Height="26"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="28"/>
                </Grid.RowDefinitions>

                <Border Grid.Row="0" Background="#F0F0F0" BorderBrush="#DDDDDD" BorderThickness="0,0,0,1">
                    <TextBlock Text="属性" Foreground="#333333" VerticalAlignment="Center" Margin="8,0" FontWeight="SemiBold"/>
                </Border>

                <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
                    <StackPanel Margin="4">
                        <Grid Margin="0,1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="名称" Foreground="#666666"/>
                            <TextBlock Grid.Column="1" Text="{Binding SelectedFeature.Name}" Foreground="#333333"/>
                        </Grid>
                        <Grid Margin="0,1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="X" Foreground="#666666"/>
                            <TextBlock Grid.Column="1" Text="{Binding SelectedFeature.X, StringFormat=F4}" Foreground="#333333"/>
                        </Grid>
                    </StackPanel>
                </ScrollViewer>

                <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="4,2">
                    <Button Content="修改属性" Command="{Binding EditPropertiesCommand}" Margin="0,0,4,0" Background="#0078D4" Foreground="White" BorderBrush="#0078D4"/>
                </StackPanel>
            </Grid>
        </Grid>

        <!-- Row 2: Status Bar -->
        <Border Grid.Row="2" Background="#F0F0F0" BorderBrush="#DDDDDD" BorderThickness="0,1,0,0" Grid.ColumnSpan="2">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0" Text="{Binding LicenseInfo}" Foreground="#666666" Margin="8,0" VerticalAlignment="Center"/>
                <Border Grid.Column="2" Background="#0078D4" CornerRadius="2" Margin="4,3">
                    <TextBlock Text="{Binding ZoomLevel, StringFormat={}{0}%}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="4,0"/>
                </Border>
            </Grid>
        </Border>
    </Grid>
</Window>