<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:ClaudeDo.Ui.ViewModels.Modals"
        x:Class="ClaudeDo.Ui.Views.Modals.UnfinishedPlanningModalView"
        x:DataType="vm:UnfinishedPlanningModalViewModel"
        Title="Unfinished planning session"
        Width="440" Height="200"
        CanResize="False"
        WindowDecorations="None"
        ExtendClientAreaToDecorationsHint="True"
        WindowStartupLocation="CenterOwner"
        Background="{DynamicResource SurfaceBrush}">

  <Window.KeyBindings>
    <KeyBinding Gesture="Escape" Command="{Binding CancelCommand}"/>
  </Window.KeyBindings>

  <Window.Styles>
    <Style Selector="Button.primary">
      <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
      <Setter Property="Foreground" Value="{DynamicResource DeepBrush}"/>
      <Setter Property="FontWeight" Value="SemiBold"/>
    </Style>
  </Window.Styles>

  <Border Background="{DynamicResource SurfaceBrush}"
          BorderBrush="{DynamicResource LineBrush}"
          BorderThickness="1">
    <Grid RowDefinitions="36,*,52">

      <!-- Title bar -->
      <Border Grid.Row="0"
              x:Name="TitleBar"
              Background="{DynamicResource DeepBrush}"
              BorderBrush="{DynamicResource LineBrush}"
              BorderThickness="0,0,0,1"
              PointerPressed="TitleBar_PointerPressed">
        <Grid ColumnDefinitions="*,Auto" Margin="14,0">
          <TextBlock Text="UNFINISHED PLANNING SESSION"
                     FontFamily="{DynamicResource MonoFont}"
                     FontSize="11"
                     LetterSpacing="1.4"
                     Foreground="{DynamicResource TextBrush}"
                     VerticalAlignment="Center"/>
          <Button Grid.Column="1"
                  Classes="icon-btn"
                  Content="✕"
                  FontSize="12"
                  Command="{Binding CancelCommand}"
                  VerticalAlignment="Center"/>
        </Grid>
      </Border>

      <!-- Body -->
      <StackPanel Grid.Row="1" Margin="20,16" Spacing="8">
        <TextBlock Text="{Binding TaskTitle}"
                   FontWeight="SemiBold"
                   Foreground="{DynamicResource TextBrush}"
                   TextTrimming="CharacterEllipsis"/>
        <TextBlock Foreground="{DynamicResource TextDimBrush}">
          <Run Text="{Binding DraftCount}"/>
          <Run Text=" draft task(s) waiting to be finalized."/>
        </TextBlock>
      </StackPanel>

      <!-- Footer -->
      <Border Grid.Row="2"
              Background="{DynamicResource DeepBrush}"
              BorderBrush="{DynamicResource LineBrush}"
              BorderThickness="0,1,0,0">
        <StackPanel Orientation="Horizontal" Spacing="8"
                    HorizontalAlignment="Right" VerticalAlignment="Center"
                    Margin="16,0">
          <Button Content="Discard"  Command="{Binding DiscardCommand}"     MinWidth="80"/>
          <Button Content="Finalize" Command="{Binding FinalizeNowCommand}" MinWidth="80"/>
          <Button Content="Resume"   Command="{Binding ResumeCommand}"      Classes="primary" MinWidth="80"/>
        </StackPanel>
      </Border>

    </Grid>
  </Border>
</Window>
