<UserControl x:Class="CtrEditor.Controls.osVisFilter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:CtrEditor.Controls"
        mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="200">
    <UserControl.Resources>
        <Style x:Key="FilterCheckBoxStyle" TargetType="CheckBox">
            <Setter Property="Margin" Value="0,2,0,2" />
            <Setter Property="FontSize" Value="12" />
        </Style>
        <Style x:Key="FilterHeaderStyle" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Margin" Value="0,5,0,2" />
        </Style>
        <Style x:Key="FilterSeparatorStyle" TargetType="Separator">
            <Setter Property="Margin" Value="0,5,0,5" />
        </Style>
    </UserControl.Resources>

    <Border BorderBrush="LightGray" BorderThickness="1" Padding="5">
        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <StackPanel>
                <!-- Fixed Filter Options -->
                <TextBlock Text="Filter Options" Style="{StaticResource FilterHeaderStyle}" />
                <CheckBox Content="All" IsChecked="{Binding ShowAll, Mode=TwoWay}"
                        Style="{StaticResource FilterCheckBoxStyle}" />
                <CheckBox Content="Cloned" IsChecked="{Binding ShowCloned, Mode=TwoWay}"
                        Style="{StaticResource FilterCheckBoxStyle}" />
                <CheckBox Content="Auto Created" IsChecked="{Binding ShowAutoCreated, Mode=TwoWay}"
                        Style="{StaticResource FilterCheckBoxStyle}" />
                <CheckBox Content="Enable On All Pages" IsChecked="{Binding ShowEnableOnAllPages, Mode=TwoWay}"
                        Style="{StaticResource FilterCheckBoxStyle}" />
                <CheckBox Content="Show On This Page" IsChecked="{Binding ShowOnThisPage, Mode=TwoWay}"
                        Style="{StaticResource FilterCheckBoxStyle}" />

                <!-- Separator between fixed and dynamic options -->
                <Separator Style="{StaticResource FilterSeparatorStyle}" />

                <!-- Type Filter Options -->
                <TextBlock Text="Object Types" Style="{StaticResource FilterHeaderStyle}" />
                <ItemsControl ItemsSource="{Binding TypeFilters}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding DisplayName}" IsChecked="{Binding IsSelected, Mode=TwoWay}"
                                    Style="{StaticResource FilterCheckBoxStyle}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>

                <!-- Separator between types and tags -->
                <Separator Style="{StaticResource FilterSeparatorStyle}" />

                <!-- Tag Filter Options -->
                <TextBlock Text="Tags" Style="{StaticResource FilterHeaderStyle}" />
                <TextBox Margin="0,2,0,5" 
                         Text="{Binding SearchTags, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                         ToolTip="Buscar etiquetas (use # antes de cada etiqueta, ej: #motor #bomba)"
                         FontSize="11" />
                <ItemsControl ItemsSource="{Binding TagFilters}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding DisplayName}" IsChecked="{Binding IsSelected, Mode=TwoWay}"
                                    Style="{StaticResource FilterCheckBoxStyle}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
        </ScrollViewer>
    </Border>
</UserControl>