<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SilverOS.Welcome.App"
             xmlns:components="clr-namespace:SilverOS.Welcome.App.Components;assembly=SilverOS.Welcome.UI"
             x:Class="SilverOS.Welcome.App.MainPage">

    <!--
      A native MAUI splash sits ON TOP of the BlazorWebView. MAUI controls render
      immediately when the window is shown — they do NOT wait on WebView2/.NET JIT —
      so the user sees branded "loading" within the first frame instead of a blank
      window for the seconds it takes WebView2 to cold-start and Blazor to boot.
      The overlay is dismissed in MainPage.xaml.cs once WV2 finishes its first
      navigation (the index.html splash then carries the eye through Blazor's boot).
    -->
    <Grid BackgroundColor="#0b0f14">

        <BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html"
                       BlazorWebViewInitialized="OnBlazorInitialized"
                       UrlLoading="OnUrlLoading">
            <BlazorWebView.RootComponents>
                <RootComponent Selector="#app" ComponentType="{x:Type components:Routes}" />
            </BlazorWebView.RootComponents>
        </BlazorWebView>

        <Grid x:Name="SplashOverlay"
              BackgroundColor="#0b0f14"
              InputTransparent="False">
            <VerticalStackLayout HorizontalOptions="Center"
                                 VerticalOptions="Center"
                                 Spacing="22">
                <Label Text="SilverOS"
                       HorizontalOptions="Center"
                       FontFamily="OpenSansRegular"
                       FontSize="42"
                       FontAutoScalingEnabled="False"
                       TextColor="#e8edf5" />
                <Label Text="WELCOME"
                       HorizontalOptions="Center"
                       FontSize="13"
                       CharacterSpacing="8"
                       TextColor="#00d4ff" />
                <ActivityIndicator IsRunning="True"
                                   Color="#00d4ff"
                                   HeightRequest="34"
                                   WidthRequest="34"
                                   HorizontalOptions="Center"
                                   Margin="0,10,0,0" />
                <Label Text="Preparing your setup…"
                       HorizontalOptions="Center"
                       FontSize="14"
                       TextColor="#8fa4bc" />
            </VerticalStackLayout>
        </Grid>

    </Grid>

</ContentPage>
