<?xml version="1.0" encoding="utf-8" ?>
<Window
    x:Class="MBN_STOCK_WEBVIEW.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MBN Stock WebView"
    mc:Ignorable="d">
    <Grid
        x:Name="Root"
        Background="{StaticResource AppBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="48" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Border
            Background="{StaticResource AppSurfaceBrush}"
            BorderBrush="{StaticResource AppBorderBrush}"
            BorderThickness="0,0,0,1">
            <Grid Padding="16,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <StackPanel
                    Orientation="Horizontal"
                    Spacing="10"
                    VerticalAlignment="Center">
                    <Border
                        Width="26"
                        Height="26"
                        Background="{StaticResource AppAccentBrush}"
                        CornerRadius="7">
                        <TextBlock
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            FontSize="12"
                            FontWeight="Bold"
                            Foreground="#07101D"
                            Text="MBN" />
                    </Border>
                    <TextBlock
                        VerticalAlignment="Center"
                        FontSize="14"
                        FontWeight="SemiBold"
                        Foreground="White"
                        Text="STOCK WEBVIEW" />
                    <Border
                        Padding="7,2"
                        Background="#193226"
                        CornerRadius="10">
                        <TextBlock
                            FontSize="10"
                            Foreground="#67E8B8"
                            Text="WINUI 3" />
                    </Border>
                </StackPanel>

                <StackPanel
                    Grid.Column="2"
                    Orientation="Horizontal"
                    Spacing="4"
                    VerticalAlignment="Center">
                    <Button
                        x:Name="BackButton"
                        Width="34"
                        Height="32"
                        Click="OnBackClicked"
                        Content="&#xE72B;"
                        FontFamily="Segoe Fluent Icons"
                        IsEnabled="False"
                        ToolTipService.ToolTip="뒤로" />
                    <Button
                        x:Name="ForwardButton"
                        Width="34"
                        Height="32"
                        Click="OnForwardClicked"
                        Content="&#xE72A;"
                        FontFamily="Segoe Fluent Icons"
                        IsEnabled="False"
                        ToolTipService.ToolTip="앞으로" />
                    <Button
                        Width="34"
                        Height="32"
                        Click="OnReloadClicked"
                        Content="&#xE72C;"
                        FontFamily="Segoe Fluent Icons"
                        ToolTipService.ToolTip="새로 고침" />
                </StackPanel>
            </Grid>
        </Border>

        <Grid Grid.Row="1">
            <WebView2 x:Name="Browser" />

            <Grid
                x:Name="LoadingOverlay"
                Background="{StaticResource AppBackgroundBrush}">
                <StackPanel
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Spacing="16">
                    <ProgressRing
                        Width="36"
                        Height="36"
                        Foreground="{StaticResource AppAccentBrush}"
                        IsActive="True" />
                    <TextBlock
                        Foreground="#93A4BB"
                        Text="운영 화면을 준비하는 중입니다…" />
                </StackPanel>
            </Grid>

            <InfoBar
                x:Name="ErrorBar"
                Margin="16"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Top"
                IsClosable="True"
                IsOpen="False"
                Severity="Error"
                Title="화면을 불러오지 못했습니다." />
        </Grid>
    </Grid>
</Window>
