using System.Drawing;

namespace Elfisa.UI.Theming
{
    /// <summary>
    /// WinUI 3 / Fluent Design light tokens adapted for WinForms
    /// (see microsoft/win-dev-skills winui-design skill).
    /// </summary>
    public sealed class FluentWin11Palette : IThemePalette
    {
        public ThemeVariant Variant => ThemeVariant.FluentWin11;

        public ThemeColors Colors { get; } = new ThemeColors
        {
            Name = "Fluent Win11",
            Mode = ThemeMode.Light,

            // SolidBackgroundFillColorBase / Secondary
            BackgroundPrimary = Color.FromArgb(243, 243, 243),
            BackgroundSecondary = Color.FromArgb(249, 249, 249),
            Surface = Color.White,
            SurfaceElevated = Color.White,

            // ControlStrokeColorDefault / Divider
            Border = Color.FromArgb(229, 229, 229),
            BorderSubtle = Color.FromArgb(240, 240, 240),

            // TextFillColorPrimary / Secondary / Tertiary
            TextPrimary = Color.FromArgb(26, 26, 26),
            TextSecondary = Color.FromArgb(97, 97, 97),
            TextMuted = Color.FromArgb(138, 138, 138),
            TextOnAccent = Color.White,

            // AccentFillColorDefault (pharmacy green on Fluent chrome)
            AccentPrimary = Color.FromArgb(15, 108, 189),
            AccentPrimaryHover = Color.FromArgb(14, 94, 163),
            AccentPrimaryPressed = Color.FromArgb(12, 80, 140),
            AccentPrimarySoft = Color.FromArgb(235, 243, 252),
            AccentPrimaryBorder = Color.FromArgb(199, 224, 244),
            AccentSecondary = Color.FromArgb(16, 124, 16),

            Success = Color.FromArgb(16, 124, 16),
            SuccessSoft = Color.FromArgb(223, 246, 221),
            Warning = Color.FromArgb(157, 93, 0),
            WarningSoft = Color.FromArgb(255, 244, 206),
            Danger = Color.FromArgb(196, 43, 28),
            DangerSoft = Color.FromArgb(253, 231, 233),
            Info = Color.FromArgb(15, 108, 189),
            InfoSoft = Color.FromArgb(235, 243, 252),

            // Commanding layer — light Mica-style header (not heavy gradient)
            TitleBarTop = Color.FromArgb(249, 249, 249),
            TitleBarBottom = Color.FromArgb(237, 237, 237),
            NavBackground = Color.FromArgb(249, 249, 249),
            CartHeaderBackground = Color.FromArgb(243, 243, 243),
            ToolbarBackground = Color.FromArgb(249, 249, 249),
            SectionHeaderBackground = Color.FromArgb(243, 243, 243),

            SidebarBackground = Color.FromArgb(249, 249, 249),
            SidebarItem = Color.FromArgb(97, 97, 97),
            SidebarItemHover = Color.FromArgb(243, 243, 243),
            SidebarItemActive = Color.FromArgb(235, 243, 252),
            SidebarItemActiveText = Color.FromArgb(15, 108, 189),

            GridHeaderBackground = Color.FromArgb(243, 243, 243),
            GridHeaderForeground = Color.FromArgb(26, 26, 26),
            GridRowBackground = Color.White,
            GridRowAlternate = Color.FromArgb(249, 249, 249),
            GridRowHover = Color.FromArgb(243, 243, 243),
            GridRowSelected = Color.FromArgb(15, 108, 189),
            GridRowSelectedText = Color.White,
            GridBorder = Color.FromArgb(229, 229, 229),

            InputBackground = Color.White,
            InputBorder = Color.FromArgb(229, 229, 229),
            InputBorderFocus = Color.FromArgb(15, 108, 189),

            OverlayScrim = Color.FromArgb(120, 0, 0, 0),
            Shadow = Color.FromArgb(24, 0, 0, 0),
            ScrollbarThumb = Color.FromArgb(200, 200, 200),
            ScrollbarTrack = Color.FromArgb(243, 243, 243),

            CornerRadiusSmall = 4,
            CornerRadiusMedium = 8,
            GridRowHeight = 36,
            GridHeaderHeight = 40
        };

        public FluentWin11Palette()
        {
            Colors.FontRegular12 = new Font("Segoe UI", 12f);
            Colors.FontRegular13 = new Font("Segoe UI", 12f);
            Colors.FontRegular14 = new Font("Segoe UI", 14f);
            Colors.FontSemibold14 = new Font("Segoe UI Semibold", 14f);
            Colors.FontSemibold16 = new Font("Segoe UI Semibold", 16f);
            Colors.FontBold18 = new Font("Segoe UI Semibold", 18f);
        }
    }
}
