<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:OTSSignsOrchestrator.Desktop.ViewModels"
        xmlns:views="using:OTSSignsOrchestrator.Desktop.Views"
        x:Class="OTSSignsOrchestrator.Desktop.Views.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        Title="OTS Signs Orchestrator"
        Width="1280" Height="850"
        WindowStartupLocation="CenterScreen"
        ExtendClientAreaToDecorationsHint="False">

    <Window.DataTemplates>
        <DataTemplate DataType="vm:HostsViewModel">
            <views:HostsView />
        </DataTemplate>
        <DataTemplate DataType="vm:InstancesViewModel">
            <views:InstancesView />
        </DataTemplate>
        <DataTemplate DataType="vm:SecretsViewModel">
            <views:SecretsView />
        </DataTemplate>
        <DataTemplate DataType="vm:LogsViewModel">
            <views:LogsView />
        </DataTemplate>
        <DataTemplate DataType="vm:CreateInstanceViewModel">
            <views:CreateInstanceView />
        </DataTemplate>
        <DataTemplate DataType="vm:SettingsViewModel">
            <views:SettingsView />
        </DataTemplate>
    </Window.DataTemplates>

    <DockPanel>

        <!-- ═══ Status Bar ═══ -->
        <Border DockPanel.Dock="Bottom"
                Background="#0C0C14"
                BorderBrush="{StaticResource BorderSubtleBrush}"
                BorderThickness="0,1,0,0"
                Padding="16,6">
            <Grid ColumnDefinitions="Auto,*,Auto">
                <StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
                    <Ellipse Width="7" Height="7" Fill="{StaticResource AccentBrush}" />
                    <TextBlock Text="Ready" FontSize="11" Foreground="{StaticResource TextMutedBrush}" />
                </StackPanel>
                <TextBlock Grid.Column="1"
                           Text="{Binding StatusMessage}"
                           FontSize="11"
                           Foreground="{StaticResource TextSecondaryBrush}"
                           Margin="16,0,0,0"
                           TextTrimming="CharacterEllipsis" />
                <TextBlock Grid.Column="2"
                           Text="OTS Signs Orchestrator"
                           FontSize="10"
                           Foreground="#45475A" />
            </Grid>
        </Border>

        <!-- ═══ Sidebar ═══ -->
        <Border DockPanel.Dock="Left"
                Width="220"
                Background="{StaticResource SurfaceBrush}"
                BorderBrush="{StaticResource BorderSubtleBrush}"
                BorderThickness="0,0,1,0">
            <DockPanel>

                <!-- Logo + title area -->
                <StackPanel DockPanel.Dock="Top"
                            HorizontalAlignment="Center"
                            Margin="20,28,20,8">
                    <Image Source="avares://OTSSignsOrchestrator.Desktop/Assets/OTS-Signs.png"
                           Width="56" Height="56"
                           RenderOptions.BitmapInterpolationMode="HighQuality"
                           HorizontalAlignment="Center"
                           Margin="0,0,0,14" />
                    <TextBlock Text="OTS Signs"
                               FontSize="18" FontWeight="Bold"
                               Foreground="{StaticResource TextPrimaryBrush}"
                               HorizontalAlignment="Center" />
                    <TextBlock Text="Orchestrator"
                               FontSize="12"
                               Foreground="{StaticResource TextMutedBrush}"
                               HorizontalAlignment="Center"
                               Margin="0,2,0,0" />
                </StackPanel>

                <!-- Divider -->
                <Border DockPanel.Dock="Top"
                        Height="1"
                        Background="{StaticResource BorderSubtleBrush}"
                        Margin="20,16,20,12" />

                <!-- Version at bottom -->
                <TextBlock DockPanel.Dock="Bottom"
                           Text="v1.0.0"
                           FontSize="10"
                           Foreground="#3B3B50"
                           HorizontalAlignment="Center"
                           Margin="0,0,0,12" />

                <!-- Navigation -->
                <ListBox ItemsSource="{Binding NavItems}"
                         SelectedItem="{Binding SelectedNav}"
                         Classes="sidebar">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}"
                                       FontSize="14"
                                       FontWeight="Medium" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

            </DockPanel>
        </Border>

        <!-- ═══ Main Content ═══ -->
        <Border Padding="28,24">
            <ContentControl Content="{Binding CurrentView}" />
        </Border>

    </DockPanel>
</Window>
