extends Object
class_name ThemeColors
## Theme Colors
##
## Defines the color palette for Code of Conquest.
## Based on the original web UI color scheme:
## - Dark slate gray backgrounds
## - Gold accents and highlights
## - RPG/fantasy aesthetic
##
## Usage:
##   var bg_color = ThemeColors.BACKGROUND_PRIMARY
##   button.add_theme_color_override("font_color", ThemeColors.GOLD_ACCENT)

# Primary Background Colors
const BACKGROUND_PRIMARY := Color("#1a1a2e")       # Very dark blue-gray
const BACKGROUND_SECONDARY := Color("#16213e")     # Slightly lighter blue-gray
const BACKGROUND_TERTIARY := Color("#0f3460")      # Accent background
const BACKGROUND_CARD := Color("#1e1e2f")          # Card backgrounds

# Text Colors
const TEXT_PRIMARY := Color("#e4e4e7")             # Light gray (main text)
const TEXT_SECONDARY := Color("#a1a1aa")           # Medium gray (secondary text)
const TEXT_DISABLED := Color("#71717a")            # Dark gray (disabled)
const TEXT_INVERTED := Color("#1a1a2e")            # Dark text on light bg

# Accent Colors
const GOLD_ACCENT := Color("#d4af37")              # Primary gold accent
const GOLD_LIGHT := Color("#f4d03f")               # Lighter gold
const GOLD_DARK := Color("#b8930a")                # Darker gold

# Status Colors
const SUCCESS := Color("#10b981")                  # Green (success messages)
const ERROR := Color("#ef4444")                    # Red (errors)
const WARNING := Color("#f59e0b")                  # Orange (warnings)
const INFO := Color("#3b82f6")                     # Blue (info messages)

# HP/Mana/Resource Colors
const HP_COLOR := Color("#dc2626")                 # Red for HP bars
const MANA_COLOR := Color("#3b82f6")               # Blue for mana bars
const STAMINA_COLOR := Color("#10b981")            # Green for stamina

# Rarity Colors (for items, etc.)
const RARITY_COMMON := Color("#9ca3af")            # Gray
const RARITY_UNCOMMON := Color("#10b981")          # Green
const RARITY_RARE := Color("#3b82f6")              # Blue
const RARITY_EPIC := Color("#a855f7")              # Purple
const RARITY_LEGENDARY := Color("#f59e0b")         # Orange/gold

# Border and Divider Colors
const BORDER_DEFAULT := Color("#3f3f46")           # Default borders
const BORDER_ACCENT := Color("#d4af37")            # Gold borders
const DIVIDER := Color("#27272a")                  # Subtle dividers

# Interactive States
const HOVER := Color("#d4af37", 0.1)               # Gold overlay on hover
const PRESSED := Color("#d4af37", 0.2)             # Gold overlay on press
const FOCUSED := Color("#d4af37", 0.15)            # Gold overlay on focus
const SELECTED := Color("#d4af37", 0.25)           # Gold overlay on selection

# Overlay Colors
const OVERLAY_DARK := Color("#000000", 0.5)        # Dark overlay
const OVERLAY_LIGHT := Color("#ffffff", 0.1)       # Light overlay

# Shadow Colors
const SHADOW := Color("#000000", 0.3)              # Default shadow
const SHADOW_STRONG := Color("#000000", 0.5)       # Strong shadow


## Get a color with modified alpha
static func with_alpha(color: Color, alpha: float) -> Color:
	var new_color := color
	new_color.a = alpha
	return new_color


## Lighten a color by a percentage
static func lighten(color: Color, amount: float) -> Color:
	return color.lightened(amount)


## Darken a color by a percentage
static func darken(color: Color, amount: float) -> Color:
	return color.darkened(amount)


## Mix two colors
static func mix(color1: Color, color2: Color, weight: float = 0.5) -> Color:
	return color1.lerp(color2, weight)


## Get rarity color by tier
static func get_rarity_color(tier: int) -> Color:
	match tier:
		1:
			return RARITY_COMMON
		2:
			return RARITY_UNCOMMON
		3:
			return RARITY_RARE
		4:
			return RARITY_EPIC
		5:
			return RARITY_LEGENDARY
		_:
			return RARITY_COMMON


## Get status color by type
static func get_status_color(status: String) -> Color:
	match status.to_lower():
		"success", "ok", "complete":
			return SUCCESS
		"error", "fail", "failed":
			return ERROR
		"warning", "warn":
			return WARNING
		"info", "information":
			return INFO
		_:
			return TEXT_SECONDARY
