--[[--------------------------------------------------------------------
  PaladinHolyPower - ui/settings_panel/tabs/hp_general_subtab.lua
  Holy Power Tab → General subtab
----------------------------------------------------------------------]]

local PHP = _G.PaladinHolyPower
if not PHP then return end

local M = {}

function M.Build(parent, PHP, hpSettings)
  local Theme = PHP and PHP.Theme

  local line1 = "Nothing here yet :/"
  local line2 = "May the Light guide your strikes with Holy Power, and temper your heart with patience."
  local GAP   = 20   -- vertical space between line1 and line2
  local PAD   = 35   -- horizontal pad used to compute wrap width

  -- First line (centered slightly above so both lines read visually centered)
  local fs1 = parent:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
  fs1:SetPoint("CENTER", parent, "CENTER", 0, GAP * 0.5)
  fs1:SetJustifyH("CENTER"); fs1:SetJustifyV("MIDDLE")

  -- Second line below; enable wrapping and give it a width
  local fs2 = parent:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
  fs2:SetPoint("TOP", fs1, "BOTTOM", 0, -GAP)
  fs2:SetJustifyH("CENTER"); fs2:SetJustifyV("MIDDLE")
  fs2:SetWordWrap(true)
  fs2:SetNonSpaceWrap(false)   -- only wrap at spaces (default behavior)
  fs2:SetMaxLines(2)           -- (optional) cap to two lines

  -- Keep the wrap width responsive to the panel size
  local function fitWidth()
    local w = (parent.GetWidth and parent:GetWidth()) or 300
    fs2:SetWidth(math.max(160, w - PAD))
  end
  fitWidth()
  parent:HookScript("OnSizeChanged", fitWidth)

  -- Apply theme gradient if available; otherwise plain text
  if Theme and Theme.ApplyGradientText then
    Theme.ApplyGradientText(fs1, line1, nil, nil, { outline = true, sizeDelta = 2 })
    Theme.ApplyGradientText(fs2, line2, nil, nil, { outline = true, sizeDelta = 2 })
  else
    fs1:SetText(line1)
    fs2:SetText(line2)
  end
end

HPGeneralSubTab = M
_G.HPGeneralSubTab = M

return M