<UserControl x:Class="UniGetUI.Avalonia.Views.Pages.SettingsPages.SettingsBasePage"
             xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:automation="clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
             xmlns:vm="using:UniGetUI.Avalonia.ViewModels.Pages.SettingsPages"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:controls="using:UniGetUI.Avalonia.Views.Controls"
             xmlns:t="using:UniGetUI.Avalonia.MarkupExtensions"
             x:DataType="vm:SettingsBasePageViewModel">

    <Grid RowDefinitions="Auto,Auto,*">

        <!-- Row 0: Header. Title is left-aligned to the settings cards (40px), with the back
             button sitting in the gutter to its left. -->
        <Grid Grid.Row="0"
              VerticalAlignment="Center"
              Margin="0,12,16,8">
            <Button Command="{Binding BackCommand}"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Margin="4,0,0,0"
                    Padding="4"
                    Background="Transparent"
                    BorderThickness="0"
                    automation:AutomationProperties.Name="{t:Translate Go back}">
                <controls:SvgIcon Width="24" Height="24"
                                  Path="avares://UniGetUI/Assets/Symbols/backward.svg"/>
            </Button>
            <TextBlock Text="{Binding Title}"
                       FontSize="24"
                       FontWeight="Bold"
                       VerticalAlignment="Center"
                       Margin="40,0,0,0"
                       automation:AutomationProperties.HeadingLevel="1"/>
        </Grid>

        <!-- Row 1: Restart-required banner -->
        <Border x:Name="RestartBannerBorder"
                Grid.Row="1"
                Classes="warning-banner"
                CornerRadius="8"
                Margin="16,0,16,8"
                Padding="4"
                IsVisible="{Binding IsRestartBannerVisible}">
            <StackPanel Orientation="Horizontal"
                        Margin="8,6">
                <TextBlock Text="{Binding RestartBannerText}"
                           FontSize="14"
                           VerticalAlignment="Center"
                           Margin="0,0,16,0"/>
                <Button Content="{Binding RestartButtonText}"
                        automation:AutomationProperties.Name="{Binding RestartButtonText}"
                        Command="{Binding RestartAppCommand}"
                        HorizontalAlignment="Right"/>
            </StackPanel>
        </Border>

        <!-- Row 2: Content frame — sub-pages slide in horizontally (WinUI SlideNavigationTransition) -->
        <TransitioningContentControl x:Name="Frame"
                        Grid.Row="2"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch"
                        VerticalContentAlignment="Stretch"
                        ClipToBounds="True"/>

    </Grid>

</UserControl>
