<UserControl x:Class="NexusShell.Views.DashboardView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Background="#F8F9FA">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="48"/>
        </Grid.RowDefinitions>

        <!-- Dashboard / widgets -->
        <ScrollViewer Grid.Row="0" Padding="40,32">
            <StackPanel MaxWidth="900" HorizontalAlignment="Left">
                <Border Background="White" CornerRadius="12" Padding="20" Margin="0,0,0,16">
                    <StackPanel>
                        <TextBlock Text="{Binding ClockText}" FontSize="36" FontWeight="SemiBold" Foreground="#1A1A2E"/>
                        <TextBlock Text="{Binding DateText}" FontSize="14" Foreground="#6C757D" Margin="0,4,0,0"/>
                    </StackPanel>
                </Border>

                <Border Background="White" CornerRadius="12" Padding="20" Margin="0,0,0,16">
                    <StackPanel>
                        <TextBlock Text="{Binding WelcomeText}" FontSize="22" FontWeight="SemiBold" Foreground="#1A1A2E"/>
                        <TextBlock Text="Du arbejder i Ninja Nexus — ikke Windows desktop."
                                   Foreground="#6C757D" Margin="0,8,0,0" TextWrapping="Wrap"/>
                    </StackPanel>
                </Border>

                <Border Background="White" CornerRadius="12" Padding="20" Margin="0,0,0,16">
                    <StackPanel>
                        <TextBlock Text="Hurtig start" FontSize="16" FontWeight="SemiBold" Foreground="#1A1A2E" Margin="0,0,0,12"/>
                        <ItemsControl ItemsSource="{Binding PinnedApps}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Button Content="{Binding Name}"
                                            Command="{Binding DataContext.LaunchAppCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                            CommandParameter="{Binding}"
                                            Margin="0,0,8,8"
                                            Padding="16,10"
                                            Background="#1D3557"
                                            Foreground="White"
                                            BorderThickness="0"
                                            Cursor="Hand"/>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </StackPanel>
                </Border>

                <TextBlock Text="{Binding StatusMessage}" Foreground="#2A9D8F" FontSize="13"/>
            </StackPanel>
        </ScrollViewer>

        <!-- Taskbar -->
        <Border Grid.Row="1" Background="#E8FFFFFF" BorderBrush="#DEE2E6" BorderThickness="0,1,0,0">
            <DockPanel LastChildFill="True" Margin="12,0">
                <TextBlock Text="Nexus"
                           FontWeight="Bold"
                           Foreground="#E63946"
                           VerticalAlignment="Center"
                           DockPanel.Dock="Left"
                           Margin="0,0,16,0"/>
                <Button Content="🔍  Søg apps... (Ctrl+Space)"
                        Command="{Binding OpenLauncherCommand}"
                        HorizontalContentAlignment="Left"
                        Padding="12,6"
                        MinWidth="260"
                        Background="#FFFFFF"
                        BorderBrush="#DEE2E6"
                        DockPanel.Dock="Left"
                        Cursor="Hand"/>
                <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" VerticalAlignment="Center">
                    <TextBlock Text="{Binding ClockText}" Foreground="#1A1A2E" Margin="0,0,16,0"/>
                    <TextBlock Text="{Binding UserDisplayName}" Foreground="#6C757D" Margin="0,0,12,0"/>
                    <Button Content="Log ud"
                            Command="{Binding LogoutCommand}"
                            Padding="10,4"
                            Background="Transparent"
                            BorderBrush="#DEE2E6"
                            Cursor="Hand"/>
                </StackPanel>
            </DockPanel>
        </Border>
    </Grid>
</UserControl>
