<UserControl x:Class="SquadDash.MarkdownEditorToolbar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <StackPanel Orientation="Horizontal">
        <!-- B -->
        <Button x:Name="BoldButton"
                Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                IsEnabled="False"
                ToolTip="Bold selection (Ctrl+B)"
                Click="BoldButton_Click">
            <TextBlock FontWeight="Bold" FontSize="{DynamicResource FontSizeLarge}" Text="B" />
        </Button>
        <!-- I -->
        <Button x:Name="ItalicButton"
                Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                IsEnabled="False"
                ToolTip="Italic selection (Ctrl+I)"
                Click="ItalicButton_Click">
            <TextBlock FontStyle="Italic" FontSize="{DynamicResource FontSizeLarge}" Text="I" />
        </Button>
        <Separator Width="1" Height="18" Margin="2,0,4,0"
                   Background="{DynamicResource PanelBorder}" />
        <!-- Link -->
        <Button Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                ToolTip="Insert link"
                Click="LinkButton_Click">
            <TextBlock FontSize="{DynamicResource FontSizeMedium}" Text="🔗" />
        </Button>
        <!-- Image (conditional) -->
        <Button x:Name="ImageButton"
                Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                ToolTip="Insert image placeholder"
                Click="ImageButton_Click">
            <TextBlock FontSize="{DynamicResource FontSizeMedium}" Text="🖼" />
        </Button>
        <!-- Table -->
        <Button Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                ToolTip="Insert table"
                Click="TableButton_Click">
            <TextBlock FontSize="{DynamicResource FontSizeHeading}" Text="⊞" Margin="0,-3,0,0" />
        </Button>
        <Separator Width="1" Height="18" Margin="2,0,4,0"
                   Background="{DynamicResource PanelBorder}" />
        <!-- Inline code -->
        <Button Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                ToolTip="Inline code"
                Click="InlineCodeButton_Click">
            <TextBlock FontFamily="Consolas" FontSize="{DynamicResource FontSizeMedium}" Text="`" />
        </Button>
        <!-- Code block -->
        <Button Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,0,0"
                ToolTip="Code block"
                Click="CodeBlockButton_Click">
            <TextBlock FontFamily="Consolas" FontSize="{DynamicResource FontSizeNormal}" Text="&lt;/&gt;" />
        </Button>
        <!-- HR separator + button (conditional) -->
        <Separator x:Name="HrSeparator"
                   Width="1" Height="18" Margin="2,0,4,0"
                   Background="{DynamicResource PanelBorder}" />
        <Button x:Name="HrButton"
                Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                ToolTip="Insert horizontal rule (---)"
                Click="HrButton_Click">
            <TextBlock FontSize="{DynamicResource FontSizeMedium}" Text="—" />
        </Button>
        <Separator Width="1" Height="18" Margin="2,0,4,0"
                   Background="{DynamicResource PanelBorder}" />
        <!-- Bullet list -->
        <Button x:Name="BulletListButton"
                Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,2,0"
                IsEnabled="False"
                ToolTip="Convert selection to bullet list"
                Click="BulletListButton_Click">
            <Viewbox Width="24" Height="20" Stretch="Uniform">
                <Canvas Width="20" Height="16">
                    <Ellipse   Canvas.Left="0" Canvas.Top="1.25"  Width="3.5" Height="3.5" Fill="{DynamicResource LabelText}"/>
                    <Rectangle Canvas.Left="5" Canvas.Top="2.5"   Width="15"  Height="1"   Fill="{DynamicResource LabelText}" Opacity="0.5" RadiusX="0.5" RadiusY="0.5"/>
                    <Ellipse   Canvas.Left="0" Canvas.Top="6.25"  Width="3.5" Height="3.5" Fill="{DynamicResource LabelText}"/>
                    <Rectangle Canvas.Left="5" Canvas.Top="7.5"   Width="15"  Height="1"   Fill="{DynamicResource LabelText}" Opacity="0.5" RadiusX="0.5" RadiusY="0.5"/>
                    <Ellipse   Canvas.Left="0" Canvas.Top="11.25" Width="3.5" Height="3.5" Fill="{DynamicResource LabelText}"/>
                    <Rectangle Canvas.Left="5" Canvas.Top="12.5"  Width="15"  Height="1"   Fill="{DynamicResource LabelText}" Opacity="0.5" RadiusX="0.5" RadiusY="0.5"/>
                </Canvas>
            </Viewbox>
        </Button>
        <!-- Numbered list -->
        <Button x:Name="NumberedListButton"
                Style="{StaticResource ThemedButtonStyle}"
                Width="34" Height="29"
                Padding="0" Margin="0,0,0,0"
                IsEnabled="False"
                ToolTip="Convert selection to numbered list"
                Click="NumberedListButton_Click">
            <Viewbox Width="24" Height="20" Stretch="Uniform">
                <Canvas Width="20" Height="16">
                    <TextBlock Canvas.Left="0" Canvas.Top="-0.5" FontSize="{DynamicResource FontSizeTiny}" Foreground="{DynamicResource LabelText}" Text="1"/>
                    <Rectangle Canvas.Left="6.5" Canvas.Top="2.5"  Width="13.5" Height="1"   Fill="{DynamicResource LabelText}" Opacity="0.5" RadiusX="0.5" RadiusY="0.5"/>
                    <TextBlock Canvas.Left="0" Canvas.Top="4.5"  FontSize="{DynamicResource FontSizeTiny}" Foreground="{DynamicResource LabelText}" Text="2"/>
                    <Rectangle Canvas.Left="6.5" Canvas.Top="7.5"  Width="13.5" Height="1"   Fill="{DynamicResource LabelText}" Opacity="0.5" RadiusX="0.5" RadiusY="0.5"/>
                    <TextBlock Canvas.Left="0" Canvas.Top="9.5"  FontSize="{DynamicResource FontSizeTiny}" Foreground="{DynamicResource LabelText}" Text="3"/>
                    <Rectangle Canvas.Left="6.5" Canvas.Top="12.5" Width="13.5" Height="1"   Fill="{DynamicResource LabelText}" Opacity="0.5" RadiusX="0.5" RadiusY="0.5"/>
                </Canvas>
            </Viewbox>
        </Button>
    </StackPanel>
</UserControl>
