<Page x:Class="CamBooth.App.Features.PictureGallery.PictureGalleryPage"
      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:core="clr-namespace:CamBooth.App.Core"
      mc:Ignorable="d"
      Title="PictureGalleryPage" Width="1600" Height="900"
      Background="Black">
   
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <!-- Close Button (top-right) -->
        <Button Grid.Row="0"
                Content="✕"
                Style="{StaticResource SecondaryButtonStyle}"
                Width="60"
                Height="60"
                HorizontalAlignment="Right"
                VerticalAlignment="Top"
                Margin="20"
                FontSize="24"
                Click="CloseGallery_Click"
                Panel.ZIndex="10" />
        
        <ScrollViewer Grid.Row="0" x:Name="GalleryScrollViewer" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Background="Black" CanContentScroll="False">
            <ItemsControl x:Name="PicturesPanel" Background="Black">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </ScrollViewer>
        
        <!-- Pager Controls -->
        <Border Grid.Row="1" Background="#2C2C2C" Padding="20,15" BorderBrush="#444444" BorderThickness="0,1,0,0">
            <Grid HorizontalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                
                <!-- First Page Button -->
                <Button Grid.Column="0" 
                        x:Name="FirstPageButton" 
                        Content="⏮️" 
                        Style="{StaticResource PagingButtonStyle}"
                        Click="FirstPageButton_Click" />
                
                <!-- Previous Page Button -->
                <Button Grid.Column="1" 
                        x:Name="PreviousPageButton" 
                        Content="◀️" 
                        Style="{StaticResource PagingButtonStyle}"
                        Click="PreviousPageButton_Click" />
                
                <!-- Page Info -->
                <TextBlock Grid.Column="2" x:Name="PageInfoText" 
                           VerticalAlignment="Center" HorizontalAlignment="Center"
                           Margin="20,0" FontSize="18" Foreground="White"
                           Text="Seite 1 von 1" MinWidth="150" TextAlignment="Center" />
                
                <!-- Next Page Button -->
                <Button Grid.Column="3" 
                        x:Name="NextPageButton" 
                        Content="▶️" 
                        Style="{StaticResource PagingButtonStyle}"
                        Click="NextPageButton_Click" />
                
                <!-- Last Page Button -->
                <Button Grid.Column="4" 
                        x:Name="LastPageButton" 
                        Content="⏭️" 
                        Style="{StaticResource PagingButtonStyle}"
                        Click="LastPageButton_Click" />
            </Grid>
        </Border>
        
        <ContentPresenter x:Name="RootContentDialogPresenter" Grid.Row="0" />

        <!-- Foto-Dialog Overlay -->
        <core:BaseDialogOverlay x:Name="PhotoDialogOverlay"
                                Grid.RowSpan="2"
                                Panel.ZIndex="20"/>
    </Grid>
</Page>