<Page x:Class="XFEToolBox.Client.Views.Pages.Admin.ServerOverviewPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:controls="clr-namespace:XFEToolBox.WpfCore.Controls;assembly=XFEToolBox.WpfCore"
      Background="Transparent" Title="" Loaded="Page_Loaded" Unloaded="Page_Unloaded">
    <Page.Resources>
        <Style x:Key="MetricCard" TargetType="Border">
            <Setter Property="MinHeight" Value="124"/>
            <Setter Property="Padding" Value="17,14"/>
            <Setter Property="Margin" Value="5"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="CornerRadius" Value="16"/>
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
            <Setter Property="RenderTransform"><Setter.Value><ScaleTransform ScaleX="1" ScaleY="1"/></Setter.Value></Setter>
        </Style>
        <Style x:Key="MetricLabel" TargetType="TextBlock">
            <Setter Property="Foreground" Value="#DDFFFFFF"/><Setter Property="FontSize" Value="10"/>
        </Style>
        <Style x:Key="MetricValue" TargetType="TextBlock">
            <Setter Property="Foreground" Value="White"/><Setter Property="FontSize" Value="22"/><Setter Property="FontWeight" Value="Bold"/><Setter Property="Margin" Value="0,7,0,0"/>
        </Style>
        <Style x:Key="MetricDetail" TargetType="TextBlock">
            <Setter Property="Foreground" Value="#D0FFFFFF"/><Setter Property="FontSize" Value="9"/><Setter Property="Margin" Value="0,5,0,0"/><Setter Property="TextWrapping" Value="Wrap"/>
        </Style>
        <Style x:Key="MetricProgress" TargetType="ProgressBar">
            <Setter Property="Height" Value="5"/><Setter Property="Minimum" Value="0"/><Setter Property="Maximum" Value="100"/><Setter Property="Margin" Value="0,8,0,0"/><Setter Property="BorderThickness" Value="0"/><Setter Property="Background" Value="#2FFFFFFF"/><Setter Property="Foreground" Value="White"/>
        </Style>
    </Page.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
        <StackPanel Margin="14,10,14,14">
            <Grid Margin="5,0,5,8">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Ellipse x:Name="LiveIndicator" Width="9" Height="9" Fill="#71EEA2" Margin="0,0,8,0" VerticalAlignment="Center"><Ellipse.Effect><DropShadowEffect Color="#57D88A" BlurRadius="8" ShadowDepth="0" Opacity="0.9"/></Ellipse.Effect></Ellipse>
                        <TextBlock x:Name="ServerNameValue" Text="XFEToolBoxServer" Foreground="White" FontSize="17" FontWeight="SemiBold"/>
                    </StackPanel>
                    <TextBlock x:Name="UpdatedValue" Text="正在连接服务器…" Foreground="#D0FFFFFF" FontSize="9.5" Margin="17,4,0,0"/>
                </StackPanel>
            </Grid>

            <UniformGrid Columns="3">
                <Border Style="{StaticResource MetricCard}" BorderBrush="#80A8F0C3">
                    <Border.Background><LinearGradientBrush StartPoint="0,0" EndPoint="1,1"><GradientStop Color="#6042C883"/><GradientStop Color="#3275AF91" Offset="1"/></LinearGradientBrush></Border.Background>
                    <StackPanel><TextBlock Text="运行状态" Style="{StaticResource MetricLabel}"/><TextBlock x:Name="StatusValue" Text="--" Style="{StaticResource MetricValue}"/><TextBlock x:Name="UptimeValue" Text="等待服务器响应" Style="{StaticResource MetricDetail}"/></StackPanel>
                </Border>
                <Border Style="{StaticResource MetricCard}" BorderBrush="#809EC1FF">
                    <Border.Background><LinearGradientBrush StartPoint="0,0" EndPoint="1,1"><GradientStop Color="#604D7BFA"/><GradientStop Color="#325B70D0" Offset="1"/></LinearGradientBrush></Border.Background>
                    <StackPanel><TextBlock Text="CPU 使用率" Style="{StaticResource MetricLabel}"/><TextBlock x:Name="CpuValue" Text="--" Style="{StaticResource MetricValue}"/><ProgressBar x:Name="CpuUsageBar" Style="{StaticResource MetricProgress}"/><TextBlock x:Name="CpuDetailValue" Text="--" Style="{StaticResource MetricDetail}"/></StackPanel>
                </Border>
                <Border Style="{StaticResource MetricCard}" BorderBrush="#808CEDE5">
                    <Border.Background><LinearGradientBrush StartPoint="0,0" EndPoint="1,1"><GradientStop Color="#6033BFC4"/><GradientStop Color="#325B9EC5" Offset="1"/></LinearGradientBrush></Border.Background>
                    <StackPanel><TextBlock Text="服务器内存使用率" Style="{StaticResource MetricLabel}"/><TextBlock x:Name="MemoryValue" Text="--" Style="{StaticResource MetricValue}"/><ProgressBar x:Name="MemoryUsageBar" Style="{StaticResource MetricProgress}"/><TextBlock x:Name="MemoryDetailValue" Text="--" Style="{StaticResource MetricDetail}"/></StackPanel>
                </Border>
                <Border Style="{StaticResource MetricCard}" BorderBrush="#80D2B1FF">
                    <Border.Background><LinearGradientBrush StartPoint="0,0" EndPoint="1,1"><GradientStop Color="#60725FD7"/><GradientStop Color="#32905EC4" Offset="1"/></LinearGradientBrush></Border.Background>
                    <StackPanel><TextBlock Text="用户与会话" Style="{StaticResource MetricLabel}"/><TextBlock x:Name="UsersValue" Text="--" Style="{StaticResource MetricValue}"/><TextBlock x:Name="UsersDetailValue" Text="注册用户 / 有效会话" Style="{StaticResource MetricDetail}"/></StackPanel>
                </Border>
                <Border Style="{StaticResource MetricCard}" BorderBrush="#80FFB4D9">
                    <Border.Background><LinearGradientBrush StartPoint="0,0" EndPoint="1,1"><GradientStop Color="#60DD70AA"/><GradientStop Color="#328474CF" Offset="1"/></LinearGradientBrush></Border.Background>
                    <StackPanel><TextBlock Text="已发布内容" Style="{StaticResource MetricLabel}"/><TextBlock x:Name="PackagesValue" Text="--" Style="{StaticResource MetricValue}" FontSize="18"/><TextBlock x:Name="PackagesDetailValue" Text="工具版本与软件下载目录" Style="{StaticResource MetricDetail}"/></StackPanel>
                </Border>
                <Border Style="{StaticResource MetricCard}" BorderBrush="#80FFD29B">
                    <Border.Background><LinearGradientBrush StartPoint="0,0" EndPoint="1,1"><GradientStop Color="#60E99B4E"/><GradientStop Color="#32CE737A" Offset="1"/></LinearGradientBrush></Border.Background>
                    <StackPanel><TextBlock Text="服务器存储" Style="{StaticResource MetricLabel}"/><TextBlock x:Name="StorageValue" Text="--" Style="{StaticResource MetricValue}"/><TextBlock x:Name="StorageDetailValue" Text="工具包与软件文件" Style="{StaticResource MetricDetail}"/></StackPanel>
                </Border>
            </UniformGrid>

            <Border Margin="5,10,5,2" Padding="18,15" Background="#F7F7FD" BorderBrush="#66FFFFFF" BorderThickness="1" CornerRadius="17">
                <Grid>
                    <Grid.ColumnDefinitions><ColumnDefinition Width="52"/><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
                    <Border Width="42" Height="42" CornerRadius="13" Background="#E9E9FA"><TextBlock Text="☁" FontSize="21" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#6969CE"/></Border>
                    <StackPanel Grid.Column="1" VerticalAlignment="Center">
                        <TextBlock Text="运行指标来自当前工具服务器" Foreground="#3F3F55" FontSize="13" FontWeight="SemiBold"/>
                        <TextBlock Text="CPU 为操作系统整体实时采样；内存为操作系统物理内存总量、已用量与可用量。" Foreground="#8B8B9E" FontSize="9.5" Margin="0,4,0,0" TextWrapping="Wrap"/>
                    </StackPanel>
                    <TextBlock x:Name="ProcessMemoryValue" Grid.Column="2" Foreground="#68687D" FontSize="10" VerticalAlignment="Center" Margin="15,0,0,0"/>
                </Grid>
            </Border>
            <TextBlock x:Name="ErrorText" Foreground="#FFE0E0" Margin="8,8,8,0" TextWrapping="Wrap"/>
        </StackPanel>
    </ScrollViewer>
</Page>
