<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="OTSSignsOrchestrator.Desktop.App"
             RequestedThemeVariant="Dark">

    <Application.Resources>
        <ResourceDictionary>
            <!-- ═══ Brand Palette ═══ -->
            <Color x:Key="Accent">#D93A00</Color>
            <Color x:Key="AccentHover">#E54B14</Color>
            <Color x:Key="AccentPressed">#BF3300</Color>
            <Color x:Key="AccentSubtle">#2A1A14</Color>

            <Color x:Key="BgDeep">#0C0C14</Color>
            <Color x:Key="BgBase">#11111B</Color>
            <Color x:Key="Surface">#181825</Color>
            <Color x:Key="SurfaceRaised">#1E1E2E</Color>
            <Color x:Key="SurfaceOverlay">#232336</Color>
            <Color x:Key="BorderSubtle">#2A2A40</Color>

            <Color x:Key="TextPrimary">#CDD6F4</Color>
            <Color x:Key="TextSecondary">#A6ADC8</Color>
            <Color x:Key="TextMuted">#6C7086</Color>

            <Color x:Key="Green">#4ADE80</Color>
            <Color x:Key="Blue">#60A5FA</Color>
            <Color x:Key="Purple">#C084FC</Color>
            <Color x:Key="Pink">#F472B6</Color>
            <Color x:Key="Amber">#FBBF24</Color>
            <Color x:Key="Teal">#2DD4BF</Color>
            <Color x:Key="Red">#F87171</Color>

            <!-- ═══ Brushes ═══ -->
            <SolidColorBrush x:Key="AccentBrush"        Color="{StaticResource Accent}" />
            <SolidColorBrush x:Key="AccentHoverBrush"    Color="{StaticResource AccentHover}" />
            <SolidColorBrush x:Key="AccentSubtleBrush"   Color="{StaticResource AccentSubtle}" />
            <SolidColorBrush x:Key="BgDeepBrush"         Color="{StaticResource BgDeep}" />
            <SolidColorBrush x:Key="BgBaseBrush"         Color="{StaticResource BgBase}" />
            <SolidColorBrush x:Key="SurfaceBrush"        Color="{StaticResource Surface}" />
            <SolidColorBrush x:Key="SurfaceRaisedBrush"  Color="{StaticResource SurfaceRaised}" />
            <SolidColorBrush x:Key="BorderSubtleBrush"   Color="{StaticResource BorderSubtle}" />
            <SolidColorBrush x:Key="TextPrimaryBrush"    Color="{StaticResource TextPrimary}" />
            <SolidColorBrush x:Key="TextSecondaryBrush"  Color="{StaticResource TextSecondary}" />
            <SolidColorBrush x:Key="TextMutedBrush"      Color="{StaticResource TextMuted}" />
        </ResourceDictionary>
    </Application.Resources>

    <Application.Styles>
        <FluentTheme />
        <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />

        <!-- ═══ Global Typography ═══ -->
        <Style Selector="Window">
            <Setter Property="FontFamily" Value="Inter, Segoe UI, Helvetica Neue, sans-serif" />
            <Setter Property="Background" Value="{StaticResource BgBaseBrush}" />
        </Style>

        <!-- ═══ Buttons — base ═══ -->
        <Style Selector="Button">
            <Setter Property="CornerRadius" Value="6" />
            <Setter Property="Padding" Value="14,7" />
            <Setter Property="FontSize" Value="13" />
        </Style>

        <!-- Accent button -->
        <Style Selector="Button.accent">
            <Setter Property="Background" Value="{StaticResource AccentBrush}" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FontWeight" Value="SemiBold" />
        </Style>
        <Style Selector="Button.accent:pointerover /template/ ContentPresenter">
            <Setter Property="Background" Value="{StaticResource AccentHoverBrush}" />
            <Setter Property="Foreground" Value="White" />
        </Style>

        <!-- Danger button -->
        <Style Selector="Button.danger">
            <Setter Property="Background" Value="#7F1D1D" />
            <Setter Property="Foreground" Value="#FCA5A5" />
        </Style>
        <Style Selector="Button.danger:pointerover /template/ ContentPresenter">
            <Setter Property="Background" Value="#991B1B" />
            <Setter Property="Foreground" Value="#FCA5A5" />
        </Style>

        <!-- ═══ TextBox ═══ -->
        <Style Selector="TextBox">
            <Setter Property="CornerRadius" Value="6" />
        </Style>

        <!-- ═══ ComboBox ═══ -->
        <Style Selector="ComboBox">
            <Setter Property="CornerRadius" Value="6" />
        </Style>

        <!-- ═══ Card border ═══ -->
        <Style Selector="Border.card">
            <Setter Property="Background" Value="{StaticResource SurfaceRaisedBrush}" />
            <Setter Property="CornerRadius" Value="10" />
            <Setter Property="Padding" Value="20" />
            <Setter Property="BorderBrush" Value="{StaticResource BorderSubtleBrush}" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>

        <!-- ═══ Toolbar border ═══ -->
        <Style Selector="Border.toolbar">
            <Setter Property="Background" Value="{StaticResource SurfaceRaisedBrush}" />
            <Setter Property="CornerRadius" Value="10" />
            <Setter Property="Padding" Value="14,10" />
            <Setter Property="BorderBrush" Value="{StaticResource BorderSubtleBrush}" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>

        <!-- ═══ Sidebar ListBox ═══ -->
        <Style Selector="ListBox.sidebar">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Padding" Value="8,0" />
        </Style>
        <Style Selector="ListBox.sidebar ListBoxItem">
            <Setter Property="CornerRadius" Value="8" />
            <Setter Property="Margin" Value="0,1" />
            <Setter Property="Padding" Value="14,10" />
            <Setter Property="Foreground" Value="{StaticResource TextSecondaryBrush}" />
        </Style>
        <Style Selector="ListBox.sidebar ListBoxItem:pointerover /template/ ContentPresenter">
            <Setter Property="Background" Value="#1E1E30" />
        </Style>
        <Style Selector="ListBox.sidebar ListBoxItem:selected /template/ ContentPresenter">
            <Setter Property="Background" Value="{StaticResource AccentSubtleBrush}" />
        </Style>
        <Style Selector="ListBox.sidebar ListBoxItem:selected">
            <Setter Property="Foreground" Value="#F0F0F8" />
        </Style>

        <!-- ═══ DataGrid ═══ -->
        <Style Selector="DataGrid">
            <Setter Property="CornerRadius" Value="8" />
            <Setter Property="BorderBrush" Value="{StaticResource BorderSubtleBrush}" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>

        <!-- ═══ Page header ═══ -->
        <Style Selector="TextBlock.pageTitle">
            <Setter Property="FontSize" Value="22" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
            <Setter Property="Margin" Value="0,0,0,4" />
        </Style>
        <Style Selector="TextBlock.pageSubtitle">
            <Setter Property="FontSize" Value="13" />
            <Setter Property="Foreground" Value="{StaticResource TextMutedBrush}" />
            <Setter Property="Margin" Value="0,0,0,16" />
        </Style>

        <Style Selector="TextBlock.sectionTitle">
            <Setter Property="FontSize" Value="16" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="Margin" Value="0,0,0,4" />
        </Style>

        <!-- ═══ Separator ═══ -->
        <Style Selector="Separator">
            <Setter Property="Background" Value="{StaticResource BorderSubtleBrush}" />
            <Setter Property="Height" Value="1" />
        </Style>

        <!-- ═══ Expander ═══ -->
        <Style Selector="Expander">
            <Setter Property="CornerRadius" Value="8" />
        </Style>

        <!-- ═══ TabControl ═══ -->
        <Style Selector="TabControl">
            <Setter Property="Background" Value="Transparent" />
        </Style>

        <!-- ═══ Status label ═══ -->
        <Style Selector="TextBlock.status">
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Foreground" Value="{StaticResource TextMutedBrush}" />
        </Style>

    </Application.Styles>
</Application>
