<Window x:Class="TeamsISO.App.NotesWindow"
        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="Show notes"
        Icon="/Assets/teamsiso.ico"
        Width="540" Height="560"
        WindowStartupLocation="CenterOwner"
        WindowStyle="None"
        ResizeMode="CanResize"
        Background="{DynamicResource Wd.Canvas}"
        UseLayoutRounding="True"
        TextOptions.TextFormattingMode="Ideal"
        TextOptions.TextRenderingMode="ClearType">

    <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 Margin="24,16,24,20">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <!-- Caption -->
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="SHOW NOTES"
                           Style="{StaticResource Wd.Text.Caption}"
                           VerticalAlignment="Center"/>
                <Button Grid.Column="1"
                        Style="{StaticResource Wd.Button.CaptionClose}"
                        Click="OnClose"
                        shell:WindowChrome.IsHitTestVisibleInChrome="True">
                    <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>

            <TextBlock Grid.Row="1"
                       x:Name="DateLine"
                       Style="{StaticResource Wd.Text.Subtle}"
                       Foreground="{DynamicResource Wd.Text.Tertiary}"
                       FontSize="12"
                       Margin="0,12,0,12"/>

            <!-- Notes view -->
            <Border Grid.Row="2" Style="{StaticResource Wd.Card}" Padding="0">
                <ScrollViewer x:Name="Scroller"
                              VerticalScrollBarVisibility="Auto"
                              Padding="14,12">
                    <TextBox x:Name="NotesText"
                             IsReadOnly="True"
                             AcceptsReturn="True"
                             Background="Transparent"
                             BorderThickness="0"
                             FontFamily="{StaticResource Wd.Font.Mono}"
                             FontSize="11"
                             Foreground="{DynamicResource Wd.Text.Primary}"
                             TextWrapping="Wrap"/>
                </ScrollViewer>
            </Border>

            <!-- Inline note input — quick stamping without leaving the dialog -->
            <Grid Grid.Row="3" Margin="0,12,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBox Grid.Column="0"
                         x:Name="NewNoteBox"
                         Padding="10,7"
                         FontSize="12"
                         VerticalAlignment="Center"
                         KeyDown="OnNewNoteKey"
                         ToolTip="Type a note and press Enter (or click 'Add'). Lands in today's file with a HH:mm:ss timestamp."/>
                <Button Grid.Column="1"
                        Style="{StaticResource Wd.Button.Primary}"
                        Content="Add"
                        Click="OnAddNote"
                        Margin="8,0,0,0"
                        Padding="20,8"/>
            </Grid>

            <!-- Footer -->
            <Grid Grid.Row="4" Margin="0,12,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0"
                        Style="{StaticResource Wd.Button.Ghost}"
                        Content="Open in editor"
                        Click="OnOpenInEditor"
                        Padding="14,8"
                        ToolTip="Launch the notes file in the system default editor."/>
                <Button Grid.Column="2"
                        Style="{StaticResource Wd.Button.Ghost}"
                        Content="Refresh"
                        Click="OnRefresh"
                        Margin="0,0,8,0"
                        Padding="14,8"/>
                <Button Grid.Column="3"
                        Style="{StaticResource Wd.Button.Ghost}"
                        Content="Close"
                        Click="OnClose"
                        Padding="20,8"/>
            </Grid>
        </Grid>
    </Border>
</Window>
