-- Default Light Theme for Lumacs
-- Enhanced version with rich styling using all available face attributes and theme elements

local theme = editor:create_and_register_theme("default")

-- Default light color palette
local bg       = lumacs.Color(255, 255, 255)  -- #ffffff
local fg       = lumacs.Color(0, 0, 0)        -- #000000
local grey     = lumacs.Color(128, 128, 128)  -- #808080
local light_bg = lumacs.Color(245, 245, 245)  -- #f5f5f5
local dark_bg  = lumacs.Color(240, 240, 240)  -- #f0f0f0

-- Simple but effective color scheme
local blue       = lumacs.Color(0, 0, 255)      -- #0000ff
local green      = lumacs.Color(0, 128, 0)      -- #008000
local red        = lumacs.Color(255, 0, 0)      -- #ff0000
local purple     = lumacs.Color(128, 0, 128)    -- #800080
local orange     = lumacs.Color(255, 140, 0)    -- #ff8c00
local dark_blue  = lumacs.Color(0, 0, 139)      -- #00008b
local dark_green = lumacs.Color(0, 100, 0)      -- #006400
local dark_red   = lumacs.Color(139, 0, 0)      -- #8b0000

-- === SET ALL THEME ELEMENTS (Complete theming) ===

-- Special elements (base)
theme:set_color(lumacs.ThemeElement.Background, fg, bg)
theme:set_color(lumacs.ThemeElement.Foreground, fg, bg)
theme:set_color(lumacs.ThemeElement.Normal, fg, bg)

-- Text syntax elements
theme:set_color(lumacs.ThemeElement.Keyword, blue, bg)
theme:set_color(lumacs.ThemeElement.String, green, bg)
theme:set_color(lumacs.ThemeElement.Comment, grey, bg)
theme:set_color(lumacs.ThemeElement.Function, dark_blue, bg)
theme:set_color(lumacs.ThemeElement.Type, purple, bg)
theme:set_color(lumacs.ThemeElement.Number, red, bg)
theme:set_color(lumacs.ThemeElement.Constant, purple, bg)
theme:set_color(lumacs.ThemeElement.Variable, fg, bg)
theme:set_color(lumacs.ThemeElement.Builtin, dark_blue, bg)
theme:set_color(lumacs.ThemeElement.Preprocessor, orange, bg)
theme:set_color(lumacs.ThemeElement.Operator, fg, bg)
theme:set_color(lumacs.ThemeElement.Error, bg, red)
theme:set_color(lumacs.ThemeElement.Warning, fg, lumacs.Color(255, 255, 0))

-- UI elements
theme:set_color(lumacs.ThemeElement.StatusLine, fg, light_bg)
theme:set_color(lumacs.ThemeElement.StatusLineInactive, grey, dark_bg)
theme:set_color(lumacs.ThemeElement.MessageLine, fg, bg)
theme:set_color(lumacs.ThemeElement.LineNumber, grey, bg)
theme:set_color(lumacs.ThemeElement.LineNumberCurrent, dark_blue, bg)
theme:set_color(lumacs.ThemeElement.Cursor, bg, fg)
theme:set_color(lumacs.ThemeElement.Selection, bg, blue)
theme:set_color(lumacs.ThemeElement.SearchMatch, fg, lumacs.Color(255, 255, 0))
theme:set_color(lumacs.ThemeElement.SearchFail, bg, red)
theme:set_color(lumacs.ThemeElement.MatchParen, fg, lumacs.Color(0, 255, 0))

-- Minibuffer elements
theme:set_color(lumacs.ThemeElement.MinibufferPrompt, dark_blue, bg)
theme:set_color(lumacs.ThemeElement.MinibufferInput, fg, light_bg)
theme:set_color(lumacs.ThemeElement.MinibufferCompletion, grey, light_bg)
theme:set_color(lumacs.ThemeElement.MinibufferMatch, bg, blue)

-- Window elements
theme:set_color(lumacs.ThemeElement.WindowBorder, grey, bg)
theme:set_color(lumacs.ThemeElement.WindowBorderActive, blue, bg)
theme:set_color(lumacs.ThemeElement.WindowSeparator, grey, bg)
theme:set_color(lumacs.ThemeElement.TabLine, grey, dark_bg)
theme:set_color(lumacs.ThemeElement.TabLineSel, fg, bg)

-- === SYNTAX HIGHLIGHTING FACES (Rich Styling) ===

-- Base default face
local default_face = lumacs.FaceAttributes()
default_face.foreground = fg
default_face.background = bg
default_face.family = "Liberation Mono"
default_face.height = 110  -- 11pt
default_face.weight = lumacs.FontWeight.Normal
default_face.slant = lumacs.FontSlant.Normal
theme:set_face("default", default_face)

-- Keywords (blue, bold)
local keyword_face = lumacs.FaceAttributes()
keyword_face.foreground = blue
keyword_face.weight = lumacs.FontWeight.Bold
keyword_face.inherit = "default"
theme:set_face("font-lock-keyword-face", keyword_face)

-- Strings (green, italic)
local string_face = lumacs.FaceAttributes()
string_face.foreground = green
string_face.slant = lumacs.FontSlant.Italic
string_face.inherit = "default"
theme:set_face("font-lock-string-face", string_face)

-- Comments (grey, italic)
local comment_face = lumacs.FaceAttributes()
comment_face.foreground = grey
comment_face.slant = lumacs.FontSlant.Italic
comment_face.inherit = "default"
theme:set_face("font-lock-comment-face", comment_face)

-- Function names (dark blue, bold)
local function_face = lumacs.FaceAttributes()
function_face.foreground = dark_blue
function_face.weight = lumacs.FontWeight.Bold
function_face.inherit = "default"
theme:set_face("font-lock-function-name-face", function_face)

-- Type names (purple, bold)
local type_face = lumacs.FaceAttributes()
type_face.foreground = purple
type_face.weight = lumacs.FontWeight.Bold
type_face.inherit = "default"
theme:set_face("font-lock-type-face", type_face)

-- === UI FACES (Rich Styling) ===

-- Mode line (status bar)
local modeline_face = lumacs.FaceAttributes()
modeline_face.foreground = fg
modeline_face.background = light_bg
modeline_face.weight = lumacs.FontWeight.Bold
modeline_face.family = "DejaVu Sans"
modeline_face.height = 100
theme:set_face("mode-line", modeline_face)

-- Inactive mode line
local modeline_inactive_face = lumacs.FaceAttributes()
modeline_inactive_face.foreground = grey
modeline_inactive_face.background = dark_bg
modeline_inactive_face.inherit = "mode-line"
theme:set_face("mode-line-inactive", modeline_inactive_face)

-- Minibuffer prompt (dark blue, bold)
local minibuffer_prompt_face = lumacs.FaceAttributes()
minibuffer_prompt_face.foreground = dark_blue
minibuffer_prompt_face.weight = lumacs.FontWeight.Bold
minibuffer_prompt_face.inherit = "default"
theme:set_face("minibuffer-prompt", minibuffer_prompt_face)

-- Line numbers (grey, small)
local line_number_face = lumacs.FaceAttributes()
line_number_face.foreground = grey
line_number_face.background = bg
line_number_face.family = "Liberation Mono"
line_number_face.height = 90
line_number_face.weight = lumacs.FontWeight.Light
theme:set_face("line-number", line_number_face)

-- Current line number (highlighted)
local line_number_current_face = lumacs.FaceAttributes()
line_number_current_face.foreground = dark_blue
line_number_current_face.weight = lumacs.FontWeight.Bold
line_number_current_face.inherit = "line-number"
theme:set_face("line-number-current", line_number_current_face)

-- Selection/region (blue background)
local region_face = lumacs.FaceAttributes()
region_face.foreground = bg
region_face.background = blue
region_face.weight = lumacs.FontWeight.Bold
theme:set_face("region", region_face)

-- Error (red background, bold)
local error_face = lumacs.FaceAttributes()
error_face.foreground = bg
error_face.background = red
error_face.weight = lumacs.FontWeight.Bold
error_face.underline = true
theme:set_face("error", error_face)

-- Warning (orange, bold)
local warning_face = lumacs.FaceAttributes()
warning_face.foreground = orange
warning_face.weight = lumacs.FontWeight.Bold
warning_face.inherit = "default"
theme:set_face("warning", warning_face)

-- Success (green, bold)
local success_face = lumacs.FaceAttributes()
success_face.foreground = dark_green
success_face.weight = lumacs.FontWeight.Bold
success_face.inherit = "default"
theme:set_face("success", success_face)

print(string.format("Enhanced theme '%s' loaded with comprehensive default styling.", theme:name()))