<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:conv="clr-namespace:NexusInstaller.Converters">

    <conv:BoolToVisibilityConverter x:Key="BoolToVis"/>
    <conv:InverseBoolToVisibilityConverter x:Key="InverseBoolToVis"/>
    <conv:RequirementStatusBrushConverter x:Key="ReqStatusBrush"/>
    <conv:InstallPhaseBrushConverter x:Key="PhaseBrush"/>
    <conv:InstallPhaseLabelConverter x:Key="PhaseLabel"/>

    <!-- Palette -->
    <Color x:Key="InstallerPurple">#8A4FFF</Color>
    <Color x:Key="InstallerBlue">#2D9CFF</Color>
    <Color x:Key="InstallerCyan">#00D9FF</Color>
    <Color x:Key="InstallerDeepNavy">#040810</Color>
    <Color x:Key="InstallerSurface">#0A1020</Color>
    <Color x:Key="InstallerTextPrimary">#F8FAFC</Color>
    <Color x:Key="InstallerTextSecondary">#8B9CB8</Color>
    <Color x:Key="InstallerSuccess">#22C55E</Color>
    <Color x:Key="InstallerWarning">#F59E0B</Color>
    <Color x:Key="InstallerError">#EF4444</Color>

    <SolidColorBrush x:Key="InstallerTextPrimaryBrush" Color="{StaticResource InstallerTextPrimary}"/>
    <SolidColorBrush x:Key="InstallerTextSecondaryBrush" Color="{StaticResource InstallerTextSecondary}"/>
    <SolidColorBrush x:Key="InstallerCyanBrush" Color="{StaticResource InstallerCyan}"/>
    <SolidColorBrush x:Key="InstallerSuccessBrush" Color="{StaticResource InstallerSuccess}"/>

    <LinearGradientBrush x:Key="InstallerBackgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Color="#030508" Offset="0"/>
        <GradientStop Color="#0A1020" Offset="0.45"/>
        <GradientStop Color="#040810" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="InstallerHorizonGlowBrush" StartPoint="0.5,1" EndPoint="0.5,0">
        <GradientStop Color="#00000000" Offset="0"/>
        <GradientStop Color="#5500D4FF" Offset="0.3"/>
        <GradientStop Color="#778A4FFF" Offset="0.6"/>
        <GradientStop Color="#00000000" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="InstallerGlassBorderBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#AAFFFFFF" Offset="0"/>
        <GradientStop Color="#33FFFFFF" Offset="0.45"/>
        <GradientStop Color="#7700D4FF" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="InstallerAccentGradientBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#A855FF" Offset="0"/>
        <GradientStop Color="#3B82F6" Offset="0.45"/>
        <GradientStop Color="#06B6D4" Offset="1"/>
    </LinearGradientBrush>

    <!-- Glass card (radius 24) -->
    <Style x:Key="InstallerGlassCardStyle" TargetType="Border">
        <Setter Property="CornerRadius" Value="24"/>
        <Setter Property="BorderThickness" Value="1.5"/>
        <Setter Property="BorderBrush" Value="{StaticResource InstallerGlassBorderBrush}"/>
        <Setter Property="Padding" Value="32"/>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Color="#70101828" Offset="0"/>
                    <GradientStop Color="#50101828" Offset="0.5"/>
                    <GradientStop Color="#38081018" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect Color="#2D9CFF" BlurRadius="48" ShadowDepth="0" Opacity="0.35"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerInnerCardStyle" TargetType="Border">
        <Setter Property="CornerRadius" Value="16"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="#28FFFFFF"/>
        <Setter Property="Background" Value="#18081428"/>
        <Setter Property="Padding" Value="16"/>
    </Style>

    <Style x:Key="InstallerTitleStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="FontSize" Value="28"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="FontFamily" Value="Segoe UI Variable Display, Segoe UI"/>
    </Style>

    <Style x:Key="InstallerSubtitleStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextSecondaryBrush}"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Margin" Value="0,8,0,0"/>
    </Style>

    <Style x:Key="InstallerSectionLabelStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextSecondaryBrush}"/>
        <Setter Property="FontSize" Value="11"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Margin" Value="0,0,0,8"/>
    </Style>

    <Style x:Key="InstallerFormTextBoxStyle" TargetType="TextBox">
        <Setter Property="IsReadOnly" Value="False"/>
        <Setter Property="IsEnabled" Value="True"/>
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="Background" Value="#12081428"/>
        <Setter Property="BorderBrush" Value="#3800D9FF"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="14,12"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Height" Value="44"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="CaretBrush" Value="{StaticResource InstallerCyanBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Border x:Name="Root"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="14">
                        <ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter TargetName="Root" Property="BorderBrush" Value="#8800D9FF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerComboBoxItemStyle" TargetType="ComboBoxItem">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="Background" Value="#0A1228"/>
        <Setter Property="Padding" Value="14,12"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Border x:Name="Root" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                        <ContentPresenter/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="True">
                            <Setter TargetName="Root" Property="Background" Value="#338A4FFF"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Root" Property="Background" Value="#4400D9FF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerComboBoxStyle" TargetType="ComboBox">
        <Setter Property="IsEnabled" Value="True"/>
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="Background" Value="#12081428"/>
        <Setter Property="BorderBrush" Value="#3800D9FF"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="14,12"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="MinHeight" Value="44"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource InstallerComboBoxItemStyle}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <Border x:Name="Root" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="14"
                                IsHitTestVisible="False">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="28"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter Grid.Column="0" Margin="14,0,0,0"
                                                  VerticalAlignment="Center"
                                                  Content="{TemplateBinding SelectionBoxItem}"
                                                  ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                                  IsHitTestVisible="False"/>
                                <Path Grid.Column="1" Data="M 0,0 L 4,4 L 8,0 Z"
                                      Fill="{StaticResource InstallerTextSecondaryBrush}"
                                      HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,12,0"
                                      IsHitTestVisible="False"/>
                            </Grid>
                        </Border>
                        <ToggleButton x:Name="Toggle"
                                      Focusable="False"
                                      HorizontalAlignment="Stretch"
                                      VerticalAlignment="Stretch"
                                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                      ClickMode="Press" Background="Transparent" BorderThickness="0">
                            <ToggleButton.Template>
                                <ControlTemplate TargetType="ToggleButton">
                                    <Border Background="Transparent"/>
                                </ControlTemplate>
                            </ToggleButton.Template>
                        </ToggleButton>
                        <Popup Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
                               AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
                            <Border MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
                                    MaxHeight="240" Background="#0A1228" BorderBrush="#6600D9FF"
                                    BorderThickness="1" CornerRadius="14" Margin="0,4,0,0">
                                <ScrollViewer CanContentScroll="True">
                                    <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDropDownOpen" Value="True">
                            <Setter TargetName="Root" Property="BorderBrush" Value="#8800D9FF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerPrimaryButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="#FFFFFF"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Padding" Value="24,14"/>
        <Setter Property="MinWidth" Value="140"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Background" Value="{StaticResource InstallerAccentGradientBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Root" Background="{TemplateBinding Background}"
                            CornerRadius="14" Padding="{TemplateBinding Padding}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Root" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect Color="#8A4FFF" BlurRadius="22" ShadowDepth="0" Opacity="0.65"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Root" Property="Opacity" Value="0.42"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerSecondaryButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Padding" Value="24,14"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Background" Value="#18FFFFFF"/>
        <Setter Property="BorderBrush" Value="#44FFFFFF"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Root" Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="14" Padding="{TemplateBinding Padding}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Root" Property="Background" Value="#28FFFFFF"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Root" Property="Opacity" Value="0.42"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerGhostButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="{StaticResource InstallerCyanBrush}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Padding" Value="8,4"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="InstallerCloseButtonStyle" TargetType="Button">
        <Setter Property="Width" Value="40"/>
        <Setter Property="Height" Value="40"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Background" Value="#18FFFFFF"/>
        <Setter Property="BorderBrush" Value="#28FFFFFF"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Root" CornerRadius="12"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Root" Property="Background" Value="#33EF4444"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Step indicator -->
    <Style x:Key="InstallerStepDotStyle" TargetType="Ellipse">
        <Setter Property="Width" Value="10"/>
        <Setter Property="Height" Value="10"/>
        <Setter Property="Fill" Value="#334455"/>
    </Style>

    <!-- Log panel -->
    <Style x:Key="InstallerLogTextStyle" TargetType="TextBox">
        <Setter Property="Foreground" Value="#A8B8D0"/>
        <Setter Property="Background" Value="#080C14"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FontFamily" Value="Consolas, Courier New"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="IsReadOnly" Value="True"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
    </Style>

    <!-- Aliases for views -->
    <LinearGradientBrush x:Key="NexusBackgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Color="#030508" Offset="0"/>
        <GradientStop Color="#0A1020" Offset="0.5"/>
        <GradientStop Color="#040810" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="NexusCyanBrush" Color="{StaticResource InstallerCyan}"/>
    <SolidColorBrush x:Key="NexusTextPrimaryBrush" Color="{StaticResource InstallerTextPrimary}"/>
    <SolidColorBrush x:Key="NexusTextSecondaryBrush" Color="{StaticResource InstallerTextSecondary}"/>
    <SolidColorBrush x:Key="NexusErrorBrush" Color="{StaticResource InstallerError}"/>

    <Style x:Key="NexusPrimaryButton" TargetType="Button" BasedOn="{StaticResource InstallerPrimaryButtonStyle}"/>
    <Style x:Key="NexusSecondaryButton" TargetType="Button" BasedOn="{StaticResource InstallerSecondaryButtonStyle}"/>
    <Style x:Key="NexusTextBox" TargetType="TextBox" BasedOn="{StaticResource InstallerFormTextBoxStyle}"/>
    <Style x:Key="NexusComboBox" TargetType="ComboBox" BasedOn="{StaticResource InstallerComboBoxStyle}"/>
    <Style x:Key="NexusCheckBox" TargetType="CheckBox">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextPrimaryBrush}"/>
        <Setter Property="FontSize" Value="14"/>
    </Style>
    <Style x:Key="NexusBodyText" TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource InstallerTextSecondaryBrush}"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
    </Style>
    <Style x:Key="NexusHeading" TargetType="TextBlock" BasedOn="{StaticResource InstallerTitleStyle}"/>
    <Style x:Key="NexusSubheading" TargetType="TextBlock" BasedOn="{StaticResource InstallerSubtitleStyle}"/>

</ResourceDictionary>
