using MudBlazor;

namespace {Namespace}.Themes;

/// <summary>
/// MudBlazor Theme customizado para {Project Name}.
/// Gerado automaticamente baseado em ui-design-system.md
/// </summary>
/// <remarks>
/// Template MORPH-SPEC v2.1.1 by Polymorphism Tech
/// </remarks>
public static class AppTheme
{
    /// <summary>
    /// Tema Light Mode
    /// </summary>
    public static MudTheme LightTheme => new()
    {
        Palette = new PaletteLight
        {
            // Cores Principais
            Primary = "#{hex da cor primária}",        // Ex: #3b82f6
            Secondary = "#{hex da cor secundária}",    // Ex: #6b7280
            Tertiary = "#{hex da cor terciária}",      // Opcional

            // Cores de Estado
            Success = "#{hex}",   // Ex: #10b981
            Error = "#{hex}",     // Ex: #ef4444
            Warning = "#{hex}",   // Ex: #f59e0b
            Info = "#{hex}",      // Ex: #06b6d4

            // Background e Superfícies
            Background = "#ffffff",
            BackgroundGrey = "#{hex do gray-50}",      // Ex: #f9fafb
            Surface = "#ffffff",

            // Text Colors
            TextPrimary = "#{hex do gray-900}",        // Texto principal
            TextSecondary = "#{hex do gray-600}",      // Texto secundário
            TextDisabled = "#{hex do gray-400}",       // Texto desabilitado

            // Borders
            Divider = "#{hex do gray-200}",            // Divisores
            DividerLight = "#{hex do gray-100}",       // Divisores mais claros
            Lines = "#{hex do gray-300}",              // Linhas de borda

            // Action colors (usados em botões, links, etc)
            ActionDefault = "#{hex do gray-500}",
            ActionDisabled = "#{hex do gray-300}",
            ActionDisabledBackground = "#{hex do gray-100}",

            // Outros
            Dark = "#{hex do gray-800}",
            DarkLighten = "#{hex do gray-700}",
            DarkDarken = "#{hex do gray-900}",

            // Overlay (usado em modais, dropdowns)
            OverlayLight = "rgba(255, 255, 255, 0.95)",
            OverlayDark = "rgba(33, 33, 33, 0.95)",

            // Hover effects
            HoverOpacity = 0.06,  // Opacidade do hover (6%)
        },

        Typography = new Typography
        {
            // Font Families
            Default = new Default
            {
                FontFamily = new[] { "{Font Name}", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "Roboto", "sans-serif" },
                FontSize = "1rem",          // 16px
                FontWeight = 400,           // Regular
                LineHeight = 1.5,
                LetterSpacing = "normal",
            },

            H1 = new H1
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "2.25rem",    // 36px
                FontWeight = 700,        // Bold
                LineHeight = 1.2,
            },

            H2 = new H2
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1.875rem",   // 30px
                FontWeight = 700,
                LineHeight = 1.3,
            },

            H3 = new H3
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1.5rem",     // 24px
                FontWeight = 600,
                LineHeight = 1.4,
            },

            H4 = new H4
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1.25rem",    // 20px
                FontWeight = 600,
                LineHeight = 1.4,
            },

            H5 = new H5
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1.125rem",   // 18px
                FontWeight = 600,
                LineHeight = 1.5,
            },

            H6 = new H6
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1rem",       // 16px
                FontWeight = 600,
                LineHeight = 1.5,
            },

            Body1 = new Body1
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1rem",       // 16px
                FontWeight = 400,
                LineHeight = 1.5,
            },

            Body2 = new Body2
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "0.875rem",   // 14px
                FontWeight = 400,
                LineHeight = 1.43,
            },

            Button = new Button
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "0.875rem",   // 14px
                FontWeight = 600,        // Semibold
                LineHeight = 1.75,
                TextTransform = "none",  // Ou "uppercase" se preferir
            },

            Caption = new Caption
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "0.75rem",    // 12px
                FontWeight = 400,
                LineHeight = 1.66,
            },

            Subtitle1 = new Subtitle1
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "1rem",
                FontWeight = 500,        // Medium
                LineHeight = 1.75,
            },

            Subtitle2 = new Subtitle2
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "0.875rem",
                FontWeight = 500,
                LineHeight = 1.57,
            },

            Overline = new Overline
            {
                FontFamily = new[] { "{Font Name}", "sans-serif" },
                FontSize = "0.75rem",
                FontWeight = 600,
                LineHeight = 2.66,
                LetterSpacing = "0.08em",
            },
        },

        Shadows = new Shadow
        {
            Elevation = new[]
            {
                "none",  // 0
                "0 1px 2px 0 rgba(0, 0, 0, 0.05)",                                                      // 1
                "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",               // 2
                "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",             // 3
                "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",           // 4
                "0 25px 50px -12px rgba(0, 0, 0, 0.25)",                                                // 5
                // Adicione mais elevações conforme necessário
            }
        },

        LayoutProperties = new LayoutProperties
        {
            // Border Radius
            DefaultBorderRadius = "6px",  // md

            // Drawer
            DrawerWidthLeft = "240px",
            DrawerWidthRight = "240px",

            // AppBar
            AppbarHeight = "64px",
        },

        ZIndex = new ZIndex
        {
            Drawer = 1200,
            AppBar = 1100,
            Dialog = 1300,
            Popover = 1400,
            Snackbar = 1500,
            Tooltip = 1600,
        },
    };

    /// <summary>
    /// Tema Dark Mode (opcional - ajustar cores)
    /// </summary>
    public static MudTheme DarkTheme => new()
    {
        Palette = new PaletteDark
        {
            // Cores Principais (ajustar para dark mode)
            Primary = "#{hex}",
            Secondary = "#{hex}",

            // Cores de Estado
            Success = "#{hex}",
            Error = "#{hex}",
            Warning = "#{hex}",
            Info = "#{hex}",

            // Background e Superfícies (tons escuros)
            Background = "#{hex do gray-900}",
            BackgroundGrey = "#{hex do gray-800}",
            Surface = "#{hex do gray-800}",

            // Text Colors (invertidos)
            TextPrimary = "#{hex do gray-50}",
            TextSecondary = "#{hex do gray-400}",
            TextDisabled = "#{hex do gray-600}",

            // Etc... (ajustar conforme design system dark mode)
        },

        // Compartilhar Typography e outras configurações do LightTheme
        Typography = LightTheme.Typography,
        Shadows = LightTheme.Shadows,
        LayoutProperties = LightTheme.LayoutProperties,
        ZIndex = LightTheme.ZIndex,
    };
}

/// <summary>
/// EXEMPLO DE USO:
///
/// // Program.cs
/// builder.Services.AddMudServices(config =>
/// {
///     config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight;
/// });
///
/// // App.razor ou MainLayout.razor
/// <MudThemeProvider Theme="@AppTheme.LightTheme" />
/// <MudDialogProvider />
/// <MudSnackbarProvider />
///
/// // Para suportar dark mode dinâmico:
/// <MudThemeProvider @bind-IsDarkMode="@_isDarkMode"
///                  Theme="@(_isDarkMode ? AppTheme.DarkTheme : AppTheme.LightTheme)" />
///
/// @code {
///     private bool _isDarkMode;
/// }
/// </summary>
