<Window x:Class="DragonISO.App.TeamsEmbedWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
        Title="Teams (embedded)"
        Icon="/Assets/DragonISO.ico"
        Width="1280" Height="720"
        MinWidth="640" MinHeight="360"
        Background="Black"
        WindowStyle="None"
        ResizeMode="CanResize"
        UseLayoutRounding="True">

    <shell:WindowChrome.WindowChrome>
        <shell:WindowChrome
            CaptionHeight="32"
            ResizeBorderThickness="6"
            CornerRadius="0"
            GlassFrameThickness="0"
            UseAeroCaptionButtons="False"/>
    </shell:WindowChrome.WindowChrome>

    <Border BorderBrush="{DynamicResource Wd.Border}" BorderThickness="1">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <!-- Caption with experimental warning. The X button restores
                 Teams' chrome before closing, never leaves Teams in a
                 reparented-orphan state. -->
            <Grid Grid.Row="0" Background="{DynamicResource Wd.Surface}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal" Margin="14,0,0,0">
                    <TextBlock Text="TEAMS (EMBEDDED)"
                               Style="{StaticResource Wd.Text.Caption}"
                               VerticalAlignment="Center"/>
                    <Border Style="{StaticResource Wd.Pill}"
                            VerticalAlignment="Center"
                            Margin="10,0,0,0"
                            Padding="8,2"
                            Background="{DynamicResource Wd.Accent.CoralBg}">
                        <TextBlock Text="experimental"
                                   FontFamily="{StaticResource Wd.Font.Mono}"
                                   FontSize="10"
                                   Foreground="{DynamicResource Wd.Accent.Coral}"
                                   VerticalAlignment="Center"/>
                    </Border>
                </StackPanel>
                <Button Grid.Column="1"
                        Style="{StaticResource Wd.Button.CaptionClose}"
                        Click="OnClose"
                        shell:WindowChrome.IsHitTestVisibleInChrome="True"
                        ToolTip="Close embed window. Teams' chrome will be restored before this window closes.">
                    <Path Data="M 0,0 L 10,10 M 10,0 L 0,10"
                          Stroke="{DynamicResource Wd.Text.Primary}"
                          StrokeThickness="1.2"
                          Width="10" Height="10"
                          Stretch="None"/>
                </Button>
            </Grid>

            <!-- Embed host: the Teams window gets SetParent-reparented
                 into this Border's HWND on Loaded. SizeChanged drives
                 MoveWindow to keep Teams fitted to our bounds. -->
            <Border x:Name="EmbedHost"
                    Grid.Row="1"
                    Background="Black"
                    SizeChanged="OnHostSizeChanged"/>
        </Grid>
    </Border>
</Window>
