<Window x:Class="GTPCorrgir.ContextMenuWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:GTPCorrgir" Title="Menu"
        WindowStyle="None" AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False" Topmost="True"
        SizeToContent="WidthAndHeight" KeyDown="Window_KeyDown" Deactivated="Window_Deactivated">

    <Window.Resources>
        <local:NullToBooleanConverter x:Key="NullToBooleanConverter" />
        <Style x:Key="CloseButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Foreground" Value="#757575" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="FontSize" Value="14" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Background="Transparent">
                            <Border x:Name="border" Background="{TemplateBinding Background}"
                                    BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"
                                    Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                                <TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Center"
                                        VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" />
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#20000000" />
                                <Setter Property="Foreground" Value="#FF4081" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#40000000" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Border Background="#F5F5F5" BorderBrush="#CCCCCC" BorderThickness="1" CornerRadius="3" Margin="5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <!-- Header con título y botón de cerrar -->
            <Grid Grid.Row="0" Height="20" Margin="10,5,10,5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBlock Text="Modo de Uso:" FontWeight="Bold" Grid.Column="0" VerticalAlignment="Center" />

                <Button x:Name="CloseButton" Content="✕" Click="CloseButton_Click" Grid.Column="1" Width="20"
                        Height="20" Style="{StaticResource CloseButtonStyle}" />
            </Grid>

            <!-- Contenido principal -->
            <Grid Grid.Row="1" Margin="10,0,10,10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <ListBox x:Name="ModeListBox" Height="200" Grid.Row="0" Margin="0,0,0,10">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding DisplayName}" Padding="5,3" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <StackPanel Grid.Row="1" Margin="0,0,0,10">
                    <TextBlock Text="Modelo LLM:" FontWeight="Bold" Margin="0,0,0,5" />
                    <ListBox x:Name="LLMListBox" Height="120">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding DisplayName}" Padding="5,3" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>

                <Button Grid.Row="2" Content="Aceptar" Height="30" Width="80" HorizontalAlignment="Right"
                        Click="AcceptButton_Click" Margin="0,10,0,0">
                    <!-- ... resto del estilo del botón ... -->
                </Button>
            </Grid>
        </Grid>
    </Border>
</Window>