#pragma once

#include "CoreMinimal.h"
#include "Fonts/SlateFontInfo.h"
#include "Layout/Margin.h"
#include "UIStyleTypes.h"
#include "UIStyleTokens.generated.h"

/**
 * Tokens de estilo da UI organizados em 3 camadas (design tokens):
 *
 *   1. Primitive (FUIStylePalette) — paleta crua "Aurora Arcana".
 *      Espelha Tools/Templates/Zeus_Widget/shared/styles.css (:root).
 *   2. Semantic (FUIStyleSemantic) — papéis (Accent, Surface, OnSurface...)
 *      que referenciam a primitive. Trocar de tema mexe sobretudo aqui.
 *   3. Component (FUIStyle*) — por componente, consome a camada semantic.
 *
 * Defaults faithful ao tema padrão; tudo é sobrescrito por linha em
 * DT_UI_Styles (FUIStyleRow). Cores em FColor(R,G,B[,A]) sRGB convertidas
 * implicitamente para FLinearColor.
 */

// =====================================================================
//  1. Primitive — paleta Aurora Arcana
// =====================================================================
USTRUCT(BlueprintType)
struct ZMMO_API FUIStylePalette
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Bg0 = FLinearColor(FColor(7, 10, 18));            // --bg-0 #070A12

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Bg1 = FLinearColor(FColor(11, 16, 32));           // --bg-1 #0B1020

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Panel = FLinearColor(FColor(12, 18, 34, 235));    // --panel rgba(..,.92)

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Panel2 = FLinearColor(FColor(17, 24, 42));        // --panel-2 #11182A

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Panel3 = FLinearColor(FColor(14, 20, 36));        // --panel-3 #0E1424

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Border = FLinearColor(FColor(58, 75, 120));       // --border #3A4B78

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor BorderSoft = FLinearColor(FColor(58, 75, 120, 140)); // --border-soft

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Gold = FLinearColor(FColor(201, 167, 90));        // --gold #C9A75A

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor GoldHi = FLinearColor(FColor(231, 200, 115));     // --gold-hi #E7C873

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Blue = FLinearColor(FColor(78, 163, 255));        // --blue #4EA3FF

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Violet = FLinearColor(FColor(123, 92, 255));      // --violet #7B5CFF

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Text = FLinearColor(FColor(244, 240, 230));       // --text #F4F0E6

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Text2 = FLinearColor(FColor(174, 182, 200));      // --text-2 #AEB6C8

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor TextDim = FLinearColor(FColor(105, 115, 138));    // --text-dim #69738A

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Danger = FLinearColor(FColor(217, 92, 92));       // --danger #D95C5C

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Online = FLinearColor(FColor(80, 216, 144));      // --online #50D890

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Palette")
	FLinearColor Warn = FLinearColor(FColor(230, 180, 80));        // --warn #E6B450
};

// =====================================================================
//  2. Semantic — papéis (referenciam a primitive)
// =====================================================================
USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleSemantic
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Accent = FLinearColor(FColor(201, 167, 90));      // Gold

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor AccentHover = FLinearColor(FColor(231, 200, 115)); // GoldHi

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Focus = FLinearColor(FColor(78, 163, 255));       // Blue

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Glow = FLinearColor(FColor(123, 92, 255));        // Violet

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor SurfaceBase = FLinearColor(FColor(7, 10, 18));    // Bg0

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Surface = FLinearColor(FColor(12, 18, 34, 235));  // Panel

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor SurfaceRaised = FLinearColor(FColor(17, 24, 42)); // Panel2

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor SurfaceSunken = FLinearColor(FColor(14, 20, 36)); // Panel3

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor OutlineStrong = FLinearColor(FColor(58, 75, 120)); // Border

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor OutlineSoft = FLinearColor(FColor(58, 75, 120, 140)); // BorderSoft

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor OnSurface = FLinearColor(FColor(244, 240, 230));  // Text

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor OnSurfaceMuted = FLinearColor(FColor(174, 182, 200)); // Text2

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor OnSurfaceDim = FLinearColor(FColor(105, 115, 138)); // TextDim

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Danger = FLinearColor(FColor(217, 92, 92));       // Danger

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Success = FLinearColor(FColor(80, 216, 144));     // Online

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Semantic")
	FLinearColor Warning = FLinearColor(FColor(230, 180, 80));     // Warn
};

// =====================================================================
//  3. Component
// =====================================================================
USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleText
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	FSlateFontInfo TitleFont;       // Cinzel ExtraBold (display)

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	FSlateFontInfo SectionFont;     // Cinzel Bold (section title)

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	FSlateFontInfo BodyFont;        // Rajdhani Regular

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	FSlateFontInfo ButtonFont;      // Rajdhani Bold

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	FSlateFontInfo LabelFont;       // Rajdhani Bold (label/caps)

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	bool bLabelUppercase = true;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Text")
	float TitleLetterSpacing = 0.f; // informativo (RichText/futuro)
};

/** Cores de uma variante de botão (primary/secondary/danger/ghost). */
USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleButtonVariant
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor BgNormal = FLinearColor::Transparent;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor BgHover = FLinearColor::Transparent;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor BgPressed = FLinearColor::Transparent;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor BgDisabled = FLinearColor(0.f, 0.f, 0.f, 0.42f);

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor BorderNormal = FLinearColor::Transparent;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor BorderHover = FLinearColor::Transparent;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FLinearColor TextColor = FLinearColor::White;
};

USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleButton
{
	GENERATED_BODY()

	/**
	 * Defaults = paleta Aurora Arcana (styles.css .btn-*). Garante que mesmo
	 * sem DataTable (preview de designer) o botão já saia estilizado.
	 */
	FUIStyleButton()
	{
		// .btn-primary — dourado, texto quase preto
		Primary.BgNormal     = FLinearColor(FColor(201, 167, 90));   // gold
		Primary.BgHover      = FLinearColor(FColor(231, 200, 115));  // gold-hi
		Primary.BgPressed    = FLinearColor(FColor(201, 167, 90));
		Primary.BgDisabled   = FLinearColor(FColor(201, 167, 90, 107));
		Primary.BorderNormal = FLinearColor(FColor(201, 167, 90));
		Primary.BorderHover  = FLinearColor(FColor(231, 200, 115));
		Primary.TextColor    = FLinearColor(FColor(10, 10, 18));     // ~#0A0A12

		// .btn-secondary — painel sólido + borda
		Secondary.BgNormal     = FLinearColor(FColor(17, 24, 42));   // panel-2
		Secondary.BgHover      = FLinearColor(FColor(22, 32, 58));   // #16203A
		Secondary.BgPressed    = FLinearColor(FColor(17, 24, 42));
		Secondary.BorderNormal = FLinearColor(FColor(58, 75, 120));  // border
		Secondary.BorderHover  = FLinearColor(FColor(78, 163, 255)); // blue
		Secondary.TextColor    = FLinearColor(FColor(244, 240, 230));// text

		// .btn-danger
		Danger.BgNormal     = FLinearColor(FColor(217, 92, 92, 36)); // rgba(.14)
		Danger.BgHover      = FLinearColor(FColor(217, 92, 92, 66)); // rgba(.26)
		Danger.BgPressed    = FLinearColor(FColor(217, 92, 92, 36));
		Danger.BorderNormal = FLinearColor(FColor(217, 92, 92));     // danger
		Danger.BorderHover  = FLinearColor(FColor(217, 92, 92));
		Danger.TextColor    = FLinearColor(FColor(240, 182, 182));   // #F0B6B6

		// .btn-ghost — transparente + borda suave
		Ghost.BgNormal     = FLinearColor::Transparent;
		Ghost.BgHover      = FLinearColor(FColor(22, 32, 58, 128));
		Ghost.BgPressed    = FLinearColor::Transparent;
		Ghost.BorderNormal = FLinearColor(FColor(58, 75, 120, 140)); // border-soft
		Ghost.BorderHover  = FLinearColor(FColor(78, 163, 255));
		Ghost.TextColor    = FLinearColor(FColor(174, 182, 200));    // text-2
	}

	// .btn-primary — dourado, texto quase preto
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FUIStyleButtonVariant Primary;

	// .btn-secondary — painel sólido + borda
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FUIStyleButtonVariant Secondary;

	// .btn-danger
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FUIStyleButtonVariant Danger;

	// .btn-ghost — transparente + borda suave
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FUIStyleButtonVariant Ghost;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	FMargin Padding = FMargin(22.f, 12.f);

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	float MinHeight = 48.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	float CornerRadius = 8.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	float BorderWidth = 1.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	float HoverScale = 1.02f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	float PressedScale = 0.98f;

	/** Tamanho por silhueta (Square/Rectangle/Topbar/Header). */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Button")
	TMap<EUIButtonShape, FVector2D> ShapeSizes;
};

USTRUCT(BlueprintType)
struct ZMMO_API FUIStylePanel
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor Bg = FLinearColor(FColor(12, 18, 34, 235));       // Panel

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor BgRaised = FLinearColor(FColor(17, 24, 42));      // Panel2

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor BgSunken = FLinearColor(FColor(14, 20, 36));      // Panel3

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor BorderColor = FLinearColor(FColor(58, 75, 120));

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor BorderSoftColor = FLinearColor(FColor(58, 75, 120, 140));

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	float CornerRadius = 12.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	float CornerRadiusSmall = 10.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	float BorderWidth = 1.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FMargin Padding = FMargin(30.f);

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FMargin PaddingSmall = FMargin(20.f);

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor CardSelectedBorder = FLinearColor(FColor(201, 167, 90)); // Accent

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Panel")
	FLinearColor CardSelectedBg = FLinearColor(FColor(24, 32, 58));
};

USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleBorders
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	FLinearColor Color = FLinearColor(FColor(58, 75, 120));

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	FLinearColor SoftColor = FLinearColor(FColor(58, 75, 120, 140));

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	float Width = 1.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	float Radius = 12.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	float RadiusSmall = 8.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	FLinearColor RuleColor = FLinearColor(FColor(201, 167, 90, 166)); // Gold ~.65

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	float RuleThickness = 2.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Borders")
	float RuleSoftThickness = 1.f;
};

USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleProgressBar
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|ProgressBar")
	FLinearColor TrackColor = FLinearColor(FColor(14, 20, 36));    // Panel3

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|ProgressBar")
	FLinearColor BorderColor = FLinearColor(FColor(58, 75, 120, 140));

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|ProgressBar")
	float Height = 10.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|ProgressBar")
	float CornerRadius = 6.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|ProgressBar")
	float BorderWidth = 1.f;

	/** Cor de preenchimento por tipo (Health/Mana/XP...). */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|ProgressBar")
	TMap<EUIProgressBarType, FLinearColor> FillByType;
};

USTRUCT(BlueprintType)
struct ZMMO_API FUIStyleTooltip
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	FLinearColor Bg = FLinearColor(FColor(17, 24, 42));            // Panel2

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	FLinearColor BorderColor = FLinearColor(FColor(58, 75, 120));

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	float CornerRadius = 10.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	float BorderWidth = 1.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	FMargin Padding = FMargin(18.f, 14.f);

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	FSlateFontInfo Font;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style|Tooltip")
	FLinearColor TextColor = FLinearColor(FColor(244, 240, 230));  // Text
};
