<UserControl x:Class="NexusShell.Controls.NexusWorkspaceTaskbar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:converters="clr-namespace:NexusShell.Converters">
    <UserControl.Resources>
        <converters:BoolToVisibilityConverter x:Key="BoolToVisibility"/>
    </UserControl.Resources>
    <Border Background="#AA071224" CornerRadius="18" BorderBrush="#4400D9FF" BorderThickness="1"
            Padding="10,7" Margin="24,0,24,96" HorizontalAlignment="Center" MaxWidth="980"
            Visibility="{Binding HasWorkspaceApps, Converter={StaticResource BoolToVisibility}}">
        <Border.Effect>
            <DropShadowEffect Color="#00D9FF" BlurRadius="22" ShadowDepth="0" Opacity="0.24"/>
        </Border.Effect>
        <ItemsControl ItemsSource="{Binding WorkspaceApps}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border Margin="4,0" Padding="9,6" CornerRadius="14"
                            Background="#1600D9FF" BorderBrush="#3300D9FF" BorderThickness="1">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,10,0">
                                <Ellipse Width="7" Height="7" Fill="#22C55E" VerticalAlignment="Center" Margin="0,0,8,0">
                                    <Ellipse.Style>
                                        <Style TargetType="Ellipse">
                                            <Setter Property="Opacity" Value="0.9"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsMinimized}" Value="True">
                                                    <Setter Property="Fill" Value="#8CA3C7"/>
                                                    <Setter Property="Opacity" Value="0.65"/>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsActive}" Value="True">
                                                    <Setter Property="Fill" Value="#00D9FF"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Ellipse.Style>
                                </Ellipse>
                                <StackPanel>
                                    <TextBlock Text="{Binding DisplayName}" Foreground="#FFFFFF" FontSize="12" FontWeight="SemiBold"
                                               TextTrimming="CharacterEllipsis" MaxWidth="130"/>
                                    <TextBlock Text="{Binding StatusHint}" Foreground="#8CA3C7" FontSize="10" Margin="0,1,0,0"/>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
                                <Button Content="↗" Command="{Binding ActivateCommand}" ToolTip="Fokus"
                                        Style="{StaticResource NexusIconButtonStyle}" Padding="5" Margin="0,0,3,0"/>
                                <Button Content="−" Command="{Binding MinimizeCommand}" ToolTip="Minimer"
                                        Style="{StaticResource NexusIconButtonStyle}" Padding="5" Margin="0,0,3,0"/>
                                <Button Content="×" Command="{Binding CloseCommand}" ToolTip="Luk"
                                        Style="{StaticResource NexusIconButtonStyle}" Padding="5"/>
                            </StackPanel>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Border>
</UserControl>
