-- =============================================================================
-- File: ArenaCore/Core/UI.Vanity.lua - v8.0 RENAMED
-- =============================================================================
local addonName, _ns = ...
local addon = _G.ArenaCore or {}
_G.ArenaCore = addon
local V = {}
addon.Vanity = V

-- Get localized strings
local L = addon.UILocalization

-- Helper function to get localized string
local function GetLocalizedString(section, key, fallback)
    if not L or not L[section] or not L[section][key] then
        return fallback or key
    end
    
    local locale = GetLocale()
    local localeTable = L[section][key]
    
    -- Return localized string for current locale, fallback to enUS, then fallback parameter
    return localeTable[locale] or localeTable["enUS"] or fallback or key
end

-- START: REPLACE with this code block
do
  -- Method-style helpers to correctly handle calls from other files
  function addon:CreateFlatTexture(parent, layer, sublevel, color, alpha)
    local lvl = sublevel or 0
    -- Safety check to prevent this exact error
    if type(lvl) ~= "number" then lvl = 0 end
    
    if lvl > 7 then lvl = 7 elseif lvl < -8 then lvl = -8 end
    
    local t = parent:CreateTexture(nil, layer or "BACKGROUND", nil, math.floor(lvl))
    local c = color or {0.1, 0.1, 0.1, 1}
    local a = alpha or c[4] or 1
    t:SetColorTexture(c[1], c[2], c[3], a)
    return t
  end
  function addon:AddHairlineRect(frame, color, alpha, z)
    local c = color or COLORS.BORDER_LIGHT; local a = alpha or 1; local lvl = z or 6
    -- Use 'self:' to call the method version
    local t=self:CreateFlatTexture(frame,"OVERLAY",lvl,c,a);t:SetPoint("TOPLEFT",0,0);t:SetPoint("TOPRIGHT",0,0);t:SetHeight(1)
    local b=self:CreateFlatTexture(frame,"OVERLAY",lvl,c,a);b:SetPoint("BOTTOMLEFT",0,0);b:SetPoint("BOTTOMRIGHT",0,0);b:SetHeight(1)
    local l=self:CreateFlatTexture(frame,"OVERLAY",lvl,c,a);l:SetPoint("TOPLEFT",0,0);l:SetPoint("BOTTOMLEFT",0,0);l:SetWidth(1)
    local r=self:CreateFlatTexture(frame,"OVERLAY",lvl,c,a);r:SetPoint("TOPRIGHT",0,0);r:SetPoint("BOTTOMRIGHT",0,0);r:SetWidth(1)
  end
  function addon:CreateStyledText(parent, text, size, color, layer, flags)
    local fs = parent:CreateFontString(nil, layer or "OVERLAY")
    -- Set font BEFORE setting text to avoid "Font not set" errors
    local fontPath = addon.FONT_PATH or "Interface\\AddOns\\ArenaCore\\Media\\Fonts\\arenacore.ttf"
    local fontSet = fs:SetFont(fontPath, tonumber(size) or 12, flags or "")
    if not fontSet then
      -- Fallback to WoW default font
      fs:SetFont("Fonts\\FRIZQT__.TTF", tonumber(size) or 12, flags or "")
    end
    fs:SetText(text or "")
    if type(color) == "table" then
      fs:SetTextColor(unpack(color))
    else
      fs:SetTextColor(1, 1, 1, 1)
    end
    fs:SetShadowOffset(0, 0)
    return fs
  end
  function addon:CreateTexturedButton(parent, w, h, label, texBase, name)
    local b = CreateFrame("Button", name or nil, parent)
    b:SetSize(w, h)
    local path = "Interface\\AddOns\\ArenaCore\\Media\\" .. texBase .. ".tga"
    local n = b:CreateTexture(nil, "BACKGROUND")
    n:SetAllPoints(); n:SetTexture(path);
    b:SetNormalTexture(n)
    local hlt = b:CreateTexture(nil, "HIGHLIGHT")
    hlt:SetAllPoints(); hlt:SetTexture(path); hlt:SetVertexColor(1, 1, 1, 0.85)
    b:SetHighlightTexture(hlt)
    if label and label ~= "" then
      -- Use 'self:' to call the method version
      local t = self:CreateStyledText(b, label, 12, COLORS.TEXT, "OVERLAY", "")
      t:SetPoint("CENTER", 0, 0)
      b.text = t
    end
    return b
  end
  function addon:CreateProfileStyleButton(parent, width, height, text, colorType, fontSize)
    if not parent then return nil end
    local btn = CreateFrame("Button", nil, parent)
    btn:SetSize(width, height)
    btn:EnableMouse(true)
    btn:RegisterForClicks("LeftButtonUp")
    local colors = {
      primary = {
        bg = {0.545, 0.271, 1.000, 1},
        border = {0.4, 0.2, 0.7, 1},
        hover = {0.645, 0.371, 1.000, 1}
      },
      success = {
        bg = {0.133, 0.667, 0.267, 1},
        border = {0.1, 0.5, 0.2, 1},
        hover = {0.233, 0.767, 0.367, 1}
      },
      emerald = {
        bg = {0.2, 0.8, 0.4, 1},
        border = {0.15, 0.65, 0.3, 1},
        hover = {0.3, 0.9, 0.5, 1}
      },
      danger = {
        bg = {0.863, 0.176, 0.176, 1},
        border = {0.6, 0.1, 0.1, 1},
        hover = {0.963, 0.276, 0.276, 1}
      }
    }
    local color = colors[colorType] or colors.primary
    local bg = btn:CreateTexture(nil, "BACKGROUND")
    bg:SetAllPoints()
    bg:SetColorTexture(color.bg[1], color.bg[2], color.bg[3], color.bg[4])
    btn.bg = bg
    local border = btn:CreateTexture(nil, "BORDER")
    border:SetAllPoints()
    border:SetColorTexture(color.border[1], color.border[2], color.border[3], color.border[4])
    border:SetPoint("TOPLEFT", 1, -1)
    border:SetPoint("TOPRIGHT", -1, -1)
    border:SetPoint("BOTTOMLEFT", 1, 1)
    border:SetPoint("BOTTOMRIGHT", -1, 1)
    btn.border = border
    local btnText = btn:CreateFontString(nil, "OVERLAY", nil, 7)
    btnText:SetFont("Interface/AddOns/ArenaCore/Media/Fonts/arenacore.ttf", fontSize or 11)
    btnText:SetText(text or "")
    btnText:SetTextColor(1, 1, 1, 1)
    btnText:SetPoint("CENTER", 0, 0)
    btn.text = btnText
    -- Add purple glow overlay on hover
    local glow = btn:CreateTexture(nil, "OVERLAY")
    glow:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\tab-purple-matte.tga")
    glow:SetAllPoints()
    glow:SetBlendMode("ADD")
    glow:SetAlpha(0)
    btn.glow = glow
    btn:SetScript("OnEnter", function(self)
      self.bg:SetColorTexture(color.hover[1], color.hover[2], color.hover[3], color.hover[4])
      -- Fade in purple glow
      if self.glow then
        self.glow:SetAlpha(0.3)
      end
    end)
    btn:SetScript("OnLeave", function(self)
      self.bg:SetColorTexture(color.bg[1], color.bg[2], color.bg[3], color.bg[4])
      -- Fade out purple glow
      if self.glow then
        self.glow:SetAlpha(0)
      end
    end)
    return btn
  end
end
-- END: REPLACE with this code block
-- Define necessary colors locally to avoid errors
local COLORS = {
  PRIMARY      = {0.545, 0.271, 1.000, 1}, -- #8B45FF
  TEXT         = {1.000, 1.000, 1.000, 1},
  TEXT_2       = {0.706, 0.706, 0.706, 1}, -- #B4B4B4
  BG           = {0.165, 0.165, 0.165, 1}, -- #2A2A2A
  -- INPUT_DARK removed - using centralized definition from UI.lua
  BORDER       = {0.196, 0.196, 0.196, 1}, -- #323232
  BORDER_LIGHT = {0.278, 0.278, 0.278, 1}, -- #474747
}
-- Icons
local ICONS = {
  HEART = "Interface\\AddOns\\ArenaCore\\Media\\UI\\arena-core-heart.tga",
  SWORD = "Interface\\AddOns\\ArenaCore\\Media\\UI\\arena-core-sword.tga",
}
-- Motto pool
V.MOTTO_LINES = {
  "No Excuses, Only Results",
  "One Mistake, Game Over",
  "Precision Over Panic",
  "Dominate or Be Dominated",
  "Every Bind Counts",
  "Pressure Creates Power",
  "Control The Chaos",
  "Only Skill Survives",
  "Strength Through Struggle",
  "Don't Forget To Press Wall",
  "Timing Beats Talent",
  "Fear The Calm Before The Burst",
  "Earn Every Victory",
  "It's Out Of Your Control, Just Press",
  "Best Game Ever Made",
  "Even Venruki Didn't Block Once",
}
-- Public helper: page motto strip (callable anytime)
function V:EnsureMottoStrip(parent)
  parent._mottoStrip = parent._mottoStrip or CreateFrame("Frame", nil, parent)
  local bar = parent._mottoStrip
  bar:ClearAllPoints()
  bar:SetPoint("TOPLEFT", parent, "TOPLEFT", 6, -8)
  bar:SetPoint("TOPRIGHT", parent, "TOPRIGHT", -6, -8)
  bar:SetHeight(40)
  if not bar.bg then
    bar.bg = bar:CreateTexture(nil, "BACKGROUND", nil, 0)
    bar.bg:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\bar-orange-matte.tga") -- Using your matte texture
    bar.bg:SetAllPoints()
    bar.text = bar:CreateFontString(nil, "OVERLAY")
    -- CRITICAL FIX: Set font BEFORE setting text
    local fontSet = bar.text:SetFont("Interface\\AddOns\\ArenaCore\\Media\\Fonts\\arenacore.ttf", 13, "")
    if not fontSet then
      -- Fallback to WoW default font if custom font fails
      bar.text:SetFont("Fonts\\FRIZQT__.TTF", 13, "")
    end
    bar.text:SetPoint("CENTER", 0, 0)
  end
  local pick = math.random(1, #self.MOTTO_LINES)
  bar.text:SetText(self.MOTTO_LINES[pick])
  return bar
end
-- ============================================================================
-- Patch Notes Popup (RE-SKINNED)
-- ============================================================================

-- Retro scanline overlay for the changelog backdrop
local function AddScanlines(parent)
    local spacing = 4
    local count = math.floor(parent:GetHeight() / spacing)
    for i = 1, count do
        local line = parent:CreateTexture(nil, "BACKGROUND", nil, 2)
        line:SetColorTexture(0.08, 0.08, 0.08, 0.6)
        line:SetPoint("TOPLEFT", parent, "TOPLEFT", 0, -(i - 1) * spacing)
        line:SetPoint("TOPRIGHT", parent, "TOPRIGHT", 0, -(i - 1) * spacing)
        line:SetHeight(1)
    end
end

function V:ShowPatchNotes()
  -- Patch notes popup - debug removed for clean release
  
  -- FORCE RECREATE: Destroy old frame to apply new styling
  if addon._patchFrame then
    -- Destroying old frame for fresh styling
    addon._patchFrame:Hide()
    addon._patchFrame = nil
  end
  -- Create a plain Frame, NOT a BackdropTemplate
  local f = CreateFrame("Frame", "ArenaCorePatchNotes", UIParent)
  f:SetSize(520, 600); f:SetPoint("CENTER", 0, 0); f:SetFrameStrata("DIALOG")
  f:SetMovable(true); f:SetClampedToScreen(true); f:EnableMouse(true); f:RegisterForDrag("LeftButton")
  f:SetScript("OnDragStart", f.StartMoving); f:SetScript("OnDragStop", f.StopMovingOrSizing)
  
  -- Frame created, applying ArenaCore skin
  if not f._skin then
   -- Background using ArenaCore styling (matching other pages)
-- Darker backdrop so text is easier to read
local patchBg = {0.10, 0.10, 0.10, 1}
local bg = addon:CreateFlatTexture(f, "BACKGROUND", 1, patchBg, 1)
bg:SetAllPoints()
AddScanlines(f)
-- Border using ArenaCore styling
addon:AddWindowEdge(f, 1, 0)
-- Header matching other configuration windows
local header = CreateFrame("Frame", nil, f)
header:SetPoint("TOPLEFT", 8, -8)
header:SetPoint("TOPRIGHT", -8, -8)
header:SetHeight(50)
-- Header background - solid dark color (no texture, simpler approach)
local headerBg = addon:CreateFlatTexture(header, "BACKGROUND", 1, {0.12, 0.12, 0.12, 1}, 1)
headerBg:SetAllPoints()
-- Purple accent line (hairline like main UI)
local accent = addon:CreateFlatTexture(header, "OVERLAY", 3, COLORS.PRIMARY, 1)
accent:SetPoint("TOPLEFT", 0, 0)
accent:SetPoint("TOPRIGHT", 0, 0)
accent:SetHeight(2)
-- Header border
local hbLight = addon:CreateFlatTexture(header, "OVERLAY", 2, COLORS.BORDER_LIGHT, 0.8)
hbLight:SetPoint("BOTTOMLEFT", 0, 0)
hbLight:SetPoint("BOTTOMRIGHT", 0, 0)
hbLight:SetHeight(1)
       -- Style the title text (NO outline) - now in header
    f._title = addon:CreateStyledText(header, "What's new in v" .. (addon.Version or "0.10.4c"), 14, COLORS.TEXT, "OVERLAY", "")
    f._title:SetPoint("LEFT", 15, 0)
    -- Style the close button to match the main panel's - now in header
    f._close = addon:CreateProfileStyleButton(header, 36, 36, "", "danger", 16)
    f._close:SetPoint("RIGHT", -10, 0)
    local xText = addon:CreateStyledText(f._close, "×", 16, COLORS.TEXT, "OVERLAY", "")
    xText:SetPoint("CENTER", 0, 0)
    f._close:SetScript("OnClick", function() f:Hide() end)
    -- Create scroll frame for content
    local scrollFrame = CreateFrame("ScrollFrame", nil, f)
    scrollFrame:SetPoint("TOPLEFT", header, "BOTTOMLEFT", 7, -15)
    scrollFrame:SetPoint("BOTTOMRIGHT", -14, 14)
    
    local scrollChild = CreateFrame("Frame", nil, scrollFrame)
    scrollChild:SetWidth(scrollFrame:GetWidth() - 20)
    scrollChild:SetHeight(1000) -- Set initial height for dividers to show
    scrollFrame:SetScrollChild(scrollChild)
    
    -- Style the body text (NO outline) - positioned in scroll child
    f._body = addon:CreateStyledText(scrollChild, "", 12, COLORS.TEXT_2, "OVERLAY", "")
    f._body:SetPoint("TOPLEFT", 0, 0)
    f._body:SetPoint("TOPRIGHT", 0, 0)
    f._body:SetJustifyH("LEFT"); f._body:SetJustifyV("TOP")
    f._body:SetSpacing(3)
    
    -- Enable mouse wheel scrolling
    scrollFrame:EnableMouseWheel(true)
    scrollFrame:SetScript("OnMouseWheel", function(self, delta)
        local current = self:GetVerticalScroll()
        local maxScroll = self:GetVerticalScrollRange()
        local newScroll = math.max(0, math.min(maxScroll, current - (delta * 20)))
        self:SetVerticalScroll(newScroll)
    end)
    
    f._scrollFrame = scrollFrame
    f._scrollChild = scrollChild
    
    
    f._skin = true
  end
  -- Build release notes with color coding and formatting
  local notes = table.concat({
    "\n|A:Crosshair_Important_128:32:32|a |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_scroll_notice", "Scroll down to see all changes in this build") .. "|r\n\n",
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cffFFD700              " .. GetLocalizedString("CHANGELOG", "addon_release_notes", "ADDON RELEASE NOTES") .. "              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cffFFD700Addon:|r ARENA CORE\n",
    "|cffFFD700Version:|r |cffB266FFv0.10.4c|r\n",
    "|cffFFD700Build:|r |cffB266FF12.0+|r\n",
    "|cffFFD700Game Version:|r |cff8B45FFRetail - Midnight|r\n",
    "|cffFFD700Release Date:|r 6/20/2026\n\n",

    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              " .. GetLocalizedString("CHANGELOG", "v0104c_header", "v0.10.4c CHANGELOG") .. "              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",

    "|cff00FF00>> " .. GetLocalizedString("CHANGELOG", "new_features_header", "NEW FEATURES") .. ":\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_feat_1", "Win rate for all brackets. Can be found in the Misc page, \"PvP LFG Window Stats\" toggle. Shows winrate for all brackets dynamically. This is ON by default") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_feat_2", "Spec Icons option for Class Icons feature above nameplates, users can now use Spec Icons instead if they choose to") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_feat_3", "Enemy Healer Indicator above nameplate at all times. Can be toggled on in the UI, Page Frames/Nameplates") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_feat_4", "Support for Enemy Healer Indicator for Platynator") .. "|r\n\n",

    "|cff00FF00>> " .. GetLocalizedString("CHANGELOG", "bug_fixes_header", "BUG FIXES") .. ":\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_fix_1", "Party Trinkets showing in PvE content/dungeons and more. Will now only show in PvP environments") .. "|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_fix_2", "Buff reminders for Evoker specific spells/buffs") .. "|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_fix_3", "Visual issues during round transitions in solo shuffle on frames") .. "|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_fix_4", "CC icons for frames only showing cooldown and spiral animation with no icon") .. "|r\n\n",

    "|cff44FF44• DISABLED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_fix_5", "Important Auras for now due to recent API changes") .. "|r\n\n",

    "|cff00FF00>> " .. GetLocalizedString("CHANGELOG", "improvements_header", "IMPROVEMENTS") .. ":\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_imp_1", "Class Color border option for the Class Icon Indicators on nameplates, can be found in the Frames/Nameplates page, under Class Icons section, there is a new toggle for this. It is OFF by default") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_imp_2", "Feature toggle to disable the outline glow feature on your current target") .. "|r\n\n",

    "|cff44FF44• IMPROVED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_imp_3", "Outline glow when targeting teammates/healer indicator. Way better visuals now") .. "|r\n\n",

    "|cff44FF44• IMPROVED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_imp_4", "Performance by removing the proc animation \"burst\" effect that initially happens when a crowd control happens on party frames, now only shows the proc glow for increased stability") .. "|r\n\n",

    "|cff44FF44• IMPROVED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104c_imp_5", "Platynator support for various nameplates mods in the Frames/Nameplates page. Now fully supporting Arena 1/2/3, Spec/class names on nameplates when using Platynator") .. "|r\n\n",

    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              " .. GetLocalizedString("CHANGELOG", "v0104b_header", "v0.10.4b CHANGELOG") .. "              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",

    "|cff00FF00>> " .. GetLocalizedString("CHANGELOG", "fixes_improvements_header", "FIXES & IMPROVEMENTS") .. ":\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_1", "Fixed edge case visual bug for some users with Crowd Control/Important buffs etc now properly showing their icon on class icons on all arena frames") .. "|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_2", "Fixed edge case issue with the Buff/Debuffs Crowd Control on party frame sometimes showing the same CC twice") .. "|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_3", "Fixed localization language translations for the new features/pages") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_4", "Made it so users can now toggle on their own trinket only on party frames instead of every teammate") .. "|r\n\n",

    "|cff44FF44• IMPROVED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_5", "Improved the Talent Reminder feature, now properly showing on every solo shuffle round and arena bracket more cleanly & reliably") .. "|r\n\n",

    "|cff44FF44• IMPROVED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_6", "Improved performance overall for several newly recently added features") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104b_fix_7", "Added toggle feature to show/hide the Glow Line animation for the Show Spells On Portraits feature") .. "|r\n\n",

    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              " .. GetLocalizedString("CHANGELOG", "v0104_header", "v0.10.4 CHANGELOG") .. "              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",

    "|cff00FF00>> " .. GetLocalizedString("CHANGELOG", "fixes_improvements_header", "FIXES & IMPROVEMENTS") .. ":\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_fix_1", "Visual bug for Frame 3 during test mode that showed two sets of cooldown tracking numbers") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_fix_2", "New toggle feature for the Party Class Icon feature, \"Arena/BG Only\" so they only turn on when user is in an arena game OR a battleground") .. "|r\n\n",

    "|cff44FF44• REDESIGNED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_fix_3", "Redesigned the \"General\" page within the Misc page so it looks cleaner and easier to use/follow") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_fix_4", "Debuffs are BACK, same section in the Arena Frames page under Debuffs, various settings and filters to go with them") .. "|r\n\n",

    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_fix_5", "Absorbs are BACK, same section in the Arena Frames page under Absorbs, simplified settings and toggle now for Midnight. Lots of restrictions here, so a much more basic system in place now") .. "|r\n\n",

    "|cff44FF44• REDESIGNED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_fix_6", "Changelog window got a redesign visually to be much easier to look at and read") .. "|r\n\n",

    "|cff00FF00>> " .. GetLocalizedString("CHANGELOG", "new_features_header", "NEW FEATURES") .. ":\n\n",
    
    "|cff44FF44• REDESIGNED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_1", "The custom layouts section in the Profiles page, now baked in preview images for each custom layout and an additional button to enlarge the previews") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_2", "NEW custom layout options, a high requested feature is more layouts and profile options, now available to anyone. Even more layouts coming soon") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_3", "NEW page \"Arena Arsenal\" with TONS of new features, mods and additions to Arena Core, making Arena Core truly a one stop addon for anyone's arena needs") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_4", "Buff Reminder: Reminds users about various class specific buffs in arena/other situations so you don't forget to buff inside of arena, and it shows an indicator glowing icon if you or a party member is missing a buff you can place") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_5", "PvP Queue Notifier: Adds a custom flashing color'd overlay on your entire screen and plays a sound/song when your selected queue types pop (user can set all brackets or just some of them, Solo Shuffle is ON by default)") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_6", "Safe Queue System: Adds timer under the queue pop window so you don't miss the accept timer. Works for pvp and LFG types. Also adds custom safe queue box with details on your screen you can freely drag around and resize to your liking. As well as a chat notification showing how long you were in queue for when the queue popped and more") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_7", "Party Trinkets: Can now track friendly party trinkets with various design/customization options so you can fine tune to your liking freely") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_8", "Talent Reminder: Displays an on screen reminder to check your talents during arena prep room and battleground starting room. Goes away once the game starts") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_9", "Gear Reminder: Custom made gear reminder that scans your gear for ANY PvE gear you have currently equipped and then shows a custom overlay alert telling you exactly which slot it is") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_10", "Big Debuff Tracking: Custom Crowd Control debuffs on party frames so you know when teammates (or yourself) is in CC/has important debuffs on them. Fully customizable with border styles, color overlays and more") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_11", "Honor Cap Reminder: Built in custom feature that allows the user to set their own threshold of honor points, once set.. the feature will alert you when you have hit the threshold of honor points on that specific character so you never cap without spending them") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_12", "Target of Targets: Two new targetting features within the Arena Arsenal page. Friendly Targets on Arena Frames, which adds custom class icon indicators on the enemey arena frames of your teammates to show who they are targetting. Also has nameing options and other customization options like class color outlines and more. Then, a Arena Targets on party Frames feature, which will show class icons or names of the enemy players targeting your teammates") .. "|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_13", "Focus Highlight: Adds a custom border outline to your current Focus Target, color can be changed in the settings on the Size sub page within the Arena Frames page, near the Target Highlight settings") .. "|r\n\n",
    
    "|cff44FF44• OPTIMIZED:|r |cffFF7A18" .. GetLocalizedString("CHANGELOG", "v0104_feat_14", "Several overall addon optimizations and code clean ups") .. "|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.3f CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> BUG FIXES:\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Made another pass through for fixing issues with class icons in prep room for all arena types in some are edge cases|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Removed more system messages that are no longer needed and will now stop spamming|r\n\n",
    
    "|cff00FF00>> CODE CLEANUP:\n\n",
    
    "|cff44FF44• CLEANUP:|r |cffFF7A18Code clean up and prep for next up and coming big update with lots of features inbound|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.3e CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> BUG FIXES:\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Fixed issue with class icons in prep room for all arena types|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Removed various chat messages that would get initiated during gates opening that are no longer needed|r\n\n",
    
    "|cff00FF00>> NEW FEATURES:\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18New toggle to disable/enable the mouse over frame tooltips in live matches|r |cff44FF44(can be found in the Arena Frames page under Text Display Settings)|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.3d CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> NEW FEATURES:\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Updated TOC/files to accommodate 12.0.5 release|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Updated Woez custom layout settings profile|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Updated Venruki custom layout settings profile|r\n\n",
    
    "|cff00FF00>> BUG FIXES:\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Fixed issue with custom layout profiles creating two profiles instead of just one|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Increased the number of profiles users can create from 8 to 20|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.3c CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> NEW FEATURES:\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18New Search page/feature!|r |cff44FF44Users can now use this new page to search anything they are looking for, get|r |cffFF7A18instant results|r |cff44FF44and navigate the UI/addon much easier now!|r |cffFF7A18A long time coming feature|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Visual improvements to the UI|r |cff44FF44on various elements design wise and|r |cffFF7A18lots of clean up|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18New toggle/name feature|r |cff44FF44to show names as the|r |cffFF7A18spec names instead|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Improved the resource bar editing,|r |cff44FF44you can now make it|r |cffFF7A18even thinner|r |cff44FF44in the settings.|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Improved the class icons|r |cff44FF44and other|r |cffFF7A18assets visually|r |cff44FF44in terms of|r |cffFF7A18matching pixels|r |cff44FF44for all|r |cffFF7A183 frames|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Added back more aura features|r |cff44FF44that were in|r |cffFF7A18TWW|r |cff44FF44(these are|r |cffFF7A18turned on by default|r)\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Added setting to adjust Cast Bar border thickness|r |cff44FF44so users can|r |cffFF7A18customize cast bars|r |cff44FF44even further|r |cff44FF44(thanks to Juicemage for the idea)|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Added full localization methods,|r |cff44FF44Arena Core now supports an array of|r |cffFF7A18languages|r |cff44FF44such as|r |cffFF7A18Chinese, Russian, Korean, Spanish, Italian|r |cff44FF44and more|r |cff44FF44all|r |cffFF7A18completely dynamic|r |cff44FF44Focusing on|r |cffFF7A18Player names, Cast Bar spell names|r |cff44FF44etc|r |cff44FF44(super important aspects only)|r\n\n",
    
    "|cff00FF00>> BUG FIXES:\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Spec Icons not properly updating during Solo Shuffle round changes when using the|r |cff44FF44\\\"Show Spec Icons Instead\\\"|r |cffFF7A18in place of the class icons|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Class icons not populating correctly in prep room for 3v3 and all other arena types|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18An additional issue with being able to change|r |cff44FF44certain settings|r |cff44FF44while using a|r |cffFF7A18custom layout profile|r |cff44FF44from the|r |cffFF7A18Custom Layouts page,|r |cff44FF44users can now|r |cffFF7A18freely make changes|r |cff44FF44and|r |cff44FF44settings will persists|r |cff44FF44on reload|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18An issue with sometimes spec icons|r |cff44FF44showing in the|r |cffFF7A18prep room|r |cff44FF44even though you had them|r |cffFF7A18off|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Another DR rare edge case|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Addressed some edge case issues|r |cff44FF44running into|r |cffFF7A18Lua errors|r |cff44FF44when adjusting the|r |cffFF7A18settings within the UI|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18An issue with the|r |cff44FF44\\\"Show Specs Instead\\\"|r |cffFF7A18in place of the class icons|r |cff44FF44not working properly|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18A visual issue with class icons|r |cff44FF44not populating correct data|r |cff44FF44between solo shuffle rounds|r\n\n",

    "|cff44FF44• FIXED:|r |cffFF7A18An issue with Auras|r |cff44FF44not respecting your toggle On/Off settings|r |cff44FF44in arena|r |cff44FF44They not properly turn off|r |cff44FF44if you toggle them off|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.2b CHANGELOG              |r",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> BUG FIXES:\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18A rare edge case issue|r |cff44FF44with some users experiencing a|r |cffFF7A18DR icon|r |cff44FF44not fully clearing in arena.|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18FrameSort addon integration|r |cff44FF44now fully working again after being|r |cffFF7A18broken|r |cff44FF44in previous updates.|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Issue with some settings|r |cff44FF44not saving properly when using a|r |cffFF7A18custom profile layout|r |cff44FF44configuration.|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.2 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> NEW FEATURES:\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18New Edit Mode button|r |cff44FF44in the UI header, intuitive edit mode allows users to use|r |cffFF7A18Shift+Click|r |cff44FF44to drag various elements freely now such as|r |cffFF7A18Class Icons, Racials, Trinkets, Cast Bars|r |cff44FF44and more.|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18New layout editor|r |cff44FF44when using the|r |cffFF7A18Unlock|r |cff44FF44button, no need for the new edit mode feature, you can still use|r |cffFF7A18Shift+Click|r |cff44FF44using the simple|r |cffFF7A18Unlock|r |cff44FF44button|r\n\n",
    
    "|cff00FF00>> BUG FIXES:\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Spec icons|r |cff44FF44not coming back in test mode if user disables the|r |cffFF7A18spec icon feature|r |cff44FF44that replaces class icons|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18Crowd control auras|r |cff44FF44not coming back in test mode if you had them|r |cffFF7A18disabled then re enabled|r |cff44FF44them|r\n\n",
    
    "|cff44FF44• FIXED:|r |cffFF7A18CC auras|r |cff44FF44not showing due to the above issue in the|r |cffFF7A18UI|r\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18More team mismatch guards|r |cff44FF44to help with incorrect data being displayed in|r |cffFF7A18skirms|r |cff44FF44and other rare edge cases|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.1.1b CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff44FF44• Made changes to adapt to the new|r |cffFF7A18API changes by blizzard|r|cff44FF44, seems never ending :(|r\n\n",
    
    "|cff44FF44• Fixes|r |cffFF7A18lots of visual and timing issues|r |cff44FF44for various features as a result.|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.1.1 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff44FF44• Fixed|r |cffFF7A18trinket tracking|r |cff44FF44in|r |cffFF7A18Solo Shuffle|r |cff44FF44(and a couple related variables).|r\n\n",
    
    "|cff44FF44• Cleaned up|r |cffFF7A18visual edge cases|r |cff44FF44across the board.|r\n\n",
    
    "|cff44FF44• Fixed|r |cffFF7A18Racial icons|r |cff44FF44sometimes not properly using the saved|r |cffFF7A18border theme|r |cff44FF44in arena matches.|r\n\n",
    
    "|cff44FF44• Fixed a visual issue with|r |cffFF7A18DR icons|r |cff44FF44sometimes showing in|r |cffFF7A18prep room|r |cff44FF44of arena matches.|r\n\n",
    
    "|cff44FF44• Fixed an edge case where|r |cffFF7A18arena frame spacing|r |cff44FF44wasn't changing in real time on certain themes.|r\n\n",
    
    "|cff44FF44• Fixed an issue with|r |cffFF7A18DR Tracking|r |cff44FF44on various themes.|r\n\n",
    
    "|cff44FF44• Cleaned up some backend edge cases so arena features behave|r |cffFF7A18smoother|r|cff44FF44.|r\n\n",
    
    "|cff00FF00>> NEW FEATURES:\n\n",
    
    "|cff44FF44• ADDED:|r |cffFF7A18Custom Layouts|r |cff44FF44page has begun to be built, currently added|r |cffFF7A18Venruki's|r |cff44FF44profile/layout, with more to come.|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.1.0 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> PERFORMANCE:\n\n",
    "|cffB266FF• Improved memory/CPU usage performance overall for the entire addon.|r\n",
    "|cffFFFFFFGeneral optimizations across the board to keep things lighter and smoother.|r\n\n",
    "|cff00FF00>> FRAME SYSTEM + SETTINGS:\n\n",
    "|cffB266FF• Improved frame backgrounds and the overall system for frame design and settings.|r\n",
    "|cffFFFFFFMore consistent visuals and cleaner behavior when applying + saving settings.|r\n\n",
    "|cffB266FF• Improved the smoothness of slider settings visually (trinkets + more) while editing.|r\n",
    "|cffFFFFFFLess jank while dragging sliders so you can actually enjoy tweaking stuff.|r\n\n",
    "|cffB266FF• Fixed various visual issues some users ran into when saving specific settings.|r\n",
    "|cffFFFFFFMore reliable save/restore behavior with fewer weird edge cases.|r\n\n",
    "|cff00FF00>> TARGET HIGHLIGHT:\n\n",
    "|cffB266FF• Target Highlight improvements.|r\n",
    "|cffFFFFFFYou can now disable it, or move it to highlight the Class Icon instead of the full frame.|r\n\n",
    "|cff00FF00>> THEMES + VISUAL POLISH:\n\n",
    "|cffB266FF• Added a dark color theme to the original default Arena Core theme.|r\n",
    "|cffFFFFFFCleaner vibe, better contrast, and easier on the eyes in-game.|r\n\n",
    "|cffB266FF• Fixed DR borders visually and improved their styling.|r\n",
    "|cffFFFFFFMore consistent borders + better pixel snapping for clean rendering.|r\n\n",
    "|cffB266FF• Improved spell cast bar fill texture/colors and styling.|r\n",
    "|cffFFFFFFCast bars should look cleaner and more consistent across themes.|r\n\n",
    "|cffB266FF• Added the texture back (like before Midnight) for uninterruptible casts on the cast bar.|r\n",
    "|cffFFFFFFUninterruptible casts are once again visually obvious at a glance.|r\n\n",
    "|cffB266FF• Improved pixel-perfect styling for borders, frames, and more.|r\n",
    "|cffFFFFFFSmall details, big difference. Everything lines up cleaner now.|r\n\n",
    "|cff00FF00>> JUST BLASTIN':\n\n",
    "|cffB266FF• Added a Border Thickness slider for the Just Blastin' theme.|r\n",
    "|cffFFFFFFYou can now fine-tune the pixel border thickness in real time (1px to 5px).|r\n\n",
    "|cff00FF00>> CAST BARS:\n\n",
    "|cffB266FF• Added Blizzard \"shield\" size slider for uninterruptible casts located in the Spell Icons sub page under Cast Bars.|r\n",
    "|cffFFFFFFYou can now scale the shield icon that appears behind spell icons for uninterruptible casts (50% to 200%).|r\n\n",
    "|cffB266FF• Added Cast Bar Uninterruptible custom texture drop down menu so users can choose their own texture for these.|r\n",
    "|cffFFFFFFPick any texture from the dropdown to customize how uninterruptible casts look on the cast bar.|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.10.0.0b CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "\n|cffB266FFFixed issue with some settings persisting/not saving properly|r\n\n",
    "|cffB266FFMAJOR COMPLETE UI/UX OVERHAUL - ESSENTIAL UPDATE|r\n\n",
    
    "|cffFFD700NOTE THAT THIS IS A ESSENTIALLY A COMPLETE OVERHAUL:|r\n",
    "|cffFFFFFFYou will likely need to make fine tune adjustments to your settings and placements of things as a result, but will be worth it.\n\n",
    
    "|cff00FF00>> COMPLETE UI/UX OVERHAUL:|r\n\n",
    
    "|cffB266FF• ONE PAGE UI SYSTEM|r\n",
    "|cffFFFFFFComplete UI/UX overhaul. EVERYTHING was redone on the backend and almost all visuals have changed. Massive upgrades to the UI. There are NO longer separate windows for various pages/settings. A new ONE page UI system. Things are easier to find, look at, use and read.\n\n",
    
    "|cffB266FF• EASIER NAVIGATION|r\n",
    "|cffFFFFFFIt may take time getting used to things again, but long term health and the ability to follow the pages easier and use the settings will attract more users.\n\n",
    
    "|cff00FF00>> PROFILES OVERHAUL:|r\n\n",
    
    "|cffB266FF• THEME-SPECIFIC PROFILES|r\n",
    "|cffFFFFFFProfiles now share all settings properly for each respective theme, you can now set up each theme available and all proper settings will be shared for those themes.\n\n",
    
    "|cffB266FF• PERFECT PROFILE SHARING|r\n",
    "|cffFFFFFFSharing shares ALL settings, so the end user who receives the profile code will get the users exact set up.\n\n",
    
    "|cff00FF00>> VISUAL PERFECTION:|r\n\n",
    
    "|cffB266FF• PIXEL PERFECT PLACEMENT|r\n",
    "|cffFFFFFFPixel perfect placement and syncing across all assets, no more mis aligned borders that are very slightly off or don't match.\n\n",
    
    "|cff00FF00>> CLEANER EXPERIENCE:|r\n\n",
    
    "|cffB266FF• CLEANED UP CHAT MESSAGES|r\n",
    "|cffFFFFFFCleaned up in game chat messages such as reload messages and other needs no longer needed.\n\n",
    
    "|cff00FF00>> UNLIMITED CUSTOMIZATION:|r\n\n",
    
    "|cffB266FF• FULL CUSTOMIZATION|r\n",
    "|cffFFFFFFFully customize anything and everything now. The doors are blown wide open.. change the theme and styling of the DR borders, Trinkets, Racials and more.\n\n",
    
    "|cffB266FF• CUSTOM COLOR PICKER|r\n",
    "|cffFFFFFFCustom color picker built in for certain themes so the user can fully control their own specific look and feel.\n\n",
    
    "|cff00FF00>> PERFORMANCE OPTIMIZATIONS:|r\n\n",
    
    "|cffB266FF• CODE CLEANUP|r\n",
    "|cffFFFFFFCleaned up old code, pages and features for Midnight. Pages like Classpacks, Blackout and more are now removed and replaced with a cleaner UI set up and easier navigation.\n\n",
    
    "|cffB266FF• BETTER PERFORMANCE|r\n",
    "|cffFFFFFFSome aspects of these features may come back in a different way in the future, but for now.. better performance over all and less CPU usage.\n\n",
    
    "|cff00FF00>> NEW PERFORMANCE PAGE:|r\n\n",
    
    "|cffB266FF• PERFORMANCE PRESETS|r\n",
    "|cffFFFFFFNew Feature/Page: Performance.. use the custom preset for graphics settings curated by one of the best players on the planet. Gain FPS and the edge you need in pvp.\n\n",
    
    "|cff00FF00>> ENDLESS NEW OPTIONS:|r\n\n",
    
    "|cffB266FF• ADVANCED CUSTOMIZATION|r\n",
    "|cffFFFFFFEndless new options and settings for fine tuning how you want things to look, even so much as adding a glow line for the spiral animations for CC auras, DR animations and more..\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.9.3.2 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> BUG FIXES/IMPROVEMENTS:|r\n\n",
    "|cffFFD700• Backend cleanup (pre-Midnight)|r\n",
    "|cffFFFFFFSome backend code clean up left behind before Midnight. This ensures no issues lingering from before the Midnight changes. Lots of edge case bug fixes and positioning saving issues as well now all resolved.|r\n\n",
    "|cffFFD700• Stability + performance|r\n",
    "|cffFFFFFFStability fixes and better performance overall in prep for Midnight release.|r\n\n",
    "|cffFFD700• DR icon placement changes|r\n",
    "|cffFFFFFFYou may need to re-adjust your DR icon placement in test mode after this update, please look at this before entering arena! We got rid of a lot of pre-Midnight old code that cleaned a lot of things up and made changes to some placement icons.|r\n\n",
    "|cffB266FF• BIG NEW UPDATE COMING SOON|r\n",
    "|cffFFFFFFBIG NEW UPDATE COMING SOON BEFORE MIDNIGHT SEASON 1 RELEASES join the discord and be on the look out!|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.9.3.1 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff44FF44>> NEW FEATURES:|r\n\n",
    
    "|cffB266FF• Brand NEW Arena Frame theme|r\n",
    "|cffFFFFFFMinimalist styling with simple Arena Core flare with a nice default layout|r\n\n",
    
    "|cffB266FF• Status text positioning|r\n",
    "|cffFFFFFFAdded health text etc positioning options|r\n\n",
    
    "|cffB266FF• CC Auras in test mode|r\n",
    "|cffFFFFFFAdded CC Auras functionality while in test mode|r\n\n",
    
    "|cffB266FF• Color+Texture glows to current target|r\n",
    "|cffFFFFFFAdded Color+Texture glows to your current target when using the Class Indicator icons above friendly targets (you will want this)|r\n\n",
    
    "|cffB266FF• Custom color + glow to your healer|r\n",
    "|cffFFFFFFAdded custom color + glow to your healer if you have Wheres My Healer feature on (you will want this)|r\n\n",
    
    "|cff00FF00>> BUG FIXES/IMPROVEMENTS:|r\n\n",
    "|cffFFD700• Secret value API fixes|r\n",
    "|cffFFFFFFMade proper fixes to avoid secret errors with new API changes|r\n\n",
    
    "|cffFFD700• Cast bar test mode settings|r\n",
    "|cffFFFFFFFixed issue with cast bars not using your exact settings from test mode inside of arena games|r\n\n",
    
    "|cffFFD700• DR tracking consistency|r\n",
    "|cffFFFFFFFixed issues with DR tracking not being 100% consistent|r\n\n",
    
    "|cffFFD700• DR custom border colors|r\n",
    "|cffFFFFFFFixed the DR custom border colors if you have this option on|r\n\n",
    
    "|cffFFD700• Friendly nameplates player names|r\n",
    "|cffFFFFFFFixed issue with player names showing on friendly nameplates if you have the class indicators on|r\n\n",
    
    "|cffFFD700• Trinket cooldown flickering|r\n",
    "|cffFFFFFFFixed an issue with Trinket cooldowns sometimes flickering|r\n\n",
    
    "|cffFFD700• Custom Racial icons improvement|r\n",
    "|cffFFFFFFImproved the custom Racial icons in prep room when no data is available xD pay attention to this for a good laugh|r\n\n",
    
    "|cffFFD700• UI settings cleanup|r\n",
    "|cffFFFFFFFixed a lot of various settings within the entire UI and cleaned various things up overall|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.9.2.3 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff00FF00>> BUG FIXES:|r\n\n",
    
    "|cffFFD700• Test Mode Data Leak|r\n",
    "|cffFFFFFFFixed an issue with stale data from test mode leaking into arena prep room.|r\n\n",
    
    "|cffFFD700• Cast Bar Alignment|r\n",
    "|cffFFFFFFFixed issues with cast bars not properly lining up exactly as it shows in test mode.|r\n\n",
    
    "|cffFFD700• Friendly Health Bars|r\n",
    "|cffFFFFFFFixed an issue with health bars not being hidden when you use the Hide Friendly Health Bar toggle.|r\n\n",
    
    "|cffFFD700• Trinket Data|r\n",
    "|cffFFFFFFFixed an issue with Trinkets using proper data.|r\n\n",
    
    "|cff44FF44>> NEW FEATURES:|r\n\n",
    
    "|cffB266FF• Link Horizontal Toggle|r\n",
    "|cffFFFFFFAdded a new \"Link Horizontal\" toggle on the More Goodies page for the Class/Pointer Icons on friendly targets\n",
    "so you can easily auto align them pixel perfectly, along with new values it uses so they match up better.|r\n\n",
    
    "|cffB266FF• Easter Egg|r\n",
    "|cffFFFFFFAdded an easter egg to frames for lol's.|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff44FF44              v0.9.2.2 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cff44FF44>> NEW FEATURES:\n\n",
    
    "|cffB266FF• Platynator Addon Support|r\n",
    "|cffFFFFFFAdded support for Platynator addon with various features connecting directly such as Enemy Nameplate Names and more.\n",
    "All functions now work correctly with proper integration between ArenaCore and Platynator.|r\n\n",
    
    "|cffB266FF• Target Highlight Thickness Control|r\n",
    "|cffFFFFFFYou can now edit the thickness/thinness of the Target highlight around the arena frames.\n",
    "Find this in the Arena Frames page at the very bottom using the toggle.|r\n\n",
    
    "|cffB266FF• NEW PAGE: Frames/Nameplates|r\n",
    "|cffFFFFFFVarious new mods coming soon! On this page you can find a new feature for Enemy Nameplate Names\n",
    "with various options. For example, you can set enemy player nameplate names to their Spec, Arena number, and more!|r\n\n",
    
    "|cff00FF00>> BUG FIXES:|r\n\n",
    
    "|cffFFD700• Racial Icons|r\n",
    "|cffFFFFFFFixed small issue with racial icons choosing random icons on first round of solo shuffle or normal arena games.|r\n\n",
    
    "|cffFFD700• Cast Bars|r\n",
    "|cffFFFFFFFixed issue with some cast bars/info not properly clearing per round in solo shuffle.|r\n\n",
    
    "|cffFFD700• Death Icons|r\n",
    "|cffFFFFFFFixed Death icons randomly showing over portraits in prep room and when gates open.|r\n\n",
    
    "|cffFFD700• Settings Persistence|r\n",
    "|cffFFFFFFFixed an issue with certain positioning settings not properly saving on reload/new game load.|r\n\n",
    
    "|cffFFAA00>> PATCH 0.9.2.1 NOTES:|r\n\n",
    
    "|cffB266FF• Added support for Platynator addon|r\n",
    "|cffFFFFFFVarious features connect directly to Platynator with working correct functions such as Enemy Name Plate Names etc.|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    
    "|cffFF6644Please understand there are various issues within the Blizzard default UI that are out of my control,\n",
    "such as Party/Class indicators overlapping on certain UI elements, Health bars of nameplates not properly\n",
    "hiding when you toggle the checkbox for it, and more.\n\n",
    
    "When Blizzard fixes their UI issues, Arena Core will continue to update to ensure everything keeps running\n",
    "as smoothly as it can. Please join the Discord for more active updates and insight with us. <3|r\n\n",
    
    "|cffFFD700-----------------------------------------------------|r\n",
    "|cff8B45FF              v0.9.2.0 CHANGELOG              |r\n",
    "|cffFFD700-----------------------------------------------------|r\n\n",
    
    "|cffFFD700BIG UPDATES AND CHANGES:|r\n\n",
    
    "|cffFF6644COMPLETE Arena Core OVERHAUL: PLEASE READ!|r\n\n",
    
    "|cffFFFFFFMidnight has taken its toll on every addon in the game in some form or light, unfortunately that means Arena Core was hit hard.\n",
    "For the time being, a lot of features you have come to love have been disabled. As Midnight continues to create new addon API's, \n",
    "Arena Core will adjust in real time as needed and re enable features as they become available. (if ever)\n",
    "I will personally be updating any news/big changes coming to Arena Core on my Twitter/X if you would like to stay in the loop\n",
    "https://x.com/PeralexIRL\n\n",
    
    "|cff44FF44Right now, the core values you expect from an Arena Frame addon are working just fine. As well as additional features you will find.\n",
    "Fun and useful additions that range from Party/Class icon indicators for friendly players, Font modding, custom cast bars, textures,\n",
    "even the loved Arena Core reward system etc are all working as intended.\n\n",
    
    "|cffFFFFFFThere will be constant updates as I continue to find new ways to come out with features as well as new cosmetics so this can be the\n",
    "full feature packed addon you know and love.\n\n",
    
    "|cffFFAA00If you are not someone who updates addons very often, I urge you not only for Arena Core, but addons as a whole to check DAILY\n",
    "for the foreseeable future as Midnight addon developers are surely going to be working over time to create bug fixes and new features.\n\n",
    
    "|cff8B45FFBIG INCOMING: Arena Core will be coming out with its own \"weak aura\" style maker for arena prep room, think \"change talents\" reminders etc.\n",
    "along with other goodies people are wanting. As well as a big update to the Blackout feature I have ideas for and more that will be PUMPING OUT,\n",
    "so please keep checking for updates.\n\n",
    
    "|cffFFFFFFYou will find various other areas within the UI that explain certain changes and updates.\n",
    "My core focus for this update was STABILITY and function over form. Some things I went the safe route with to ensure you have virtually no errors or problems as much as possible.\n",
    "Things will change almost daily as I continue to work on things and make improvements and create new features for.\n\n",
    
    "|cff44FF44PLEASE join the discord as I am keeping people updated not only about Arena Core, but addons in general so you can stay in the loop about API changes and what might be coming back.\n\n",
    
    "|cffFF69B4<3 you.\n"
  })
  
  f._body:SetText(notes)
  
  -- Update scroll child height based on text height
  C_Timer.After(0.1, function()
    if f._body and f._scrollChild then
      local textHeight = f._body:GetStringHeight()
      f._scrollChild:SetHeight(math.max(textHeight + 20, f._scrollFrame:GetHeight()))
    end
  end)
  
  -- Reset scroll to top
  if f._scrollFrame then
    f._scrollFrame:SetVerticalScroll(0)
  end
  
  f:Show(); addon._patchFrame = f
end
-- ============================================================================
-- Links Popup (similar to patch notes)
-- ============================================================================
function V:ShowLinksPopup()
  if addon._linksFrame and addon._linksFrame:IsShown() then return end
  -- Create a plain Frame, NOT a BackdropTemplate
  local f = addon._linksFrame or CreateFrame("Frame", "ArenaCoreLinks", UIParent)
  f:SetSize(280, 140); f:SetPoint("CENTER", 0, 60); f:SetFrameStrata("DIALOG")
  f:SetMovable(true); f:SetClampedToScreen(true); f:EnableMouse(true); f:RegisterForDrag("LeftButton")
  f:SetScript("OnDragStart", f.StartMoving); f:SetScript("OnDragStop", f.StopMovingOrSizing)
  if not f._skin then
    -- Apply the dark matte background texture, just like a group box
    local bg = f:CreateTexture(nil, "BACKGROUND")
    bg:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\box-dark-matte.tga")
    bg:SetAllPoints()
    -- Add the hairline border
    addon:AddHairlineRect(f, COLORS.BORDER_LIGHT, 0.9, 6)
    -- Add the purple accent line at the top
    local accent = addon:CreateFlatTexture(f, "OVERLAY", 7, COLORS.PRIMARY, 1)
    accent:SetPoint("TOPLEFT", 0, 0); accent:SetPoint("TOPRIGHT", 0, 0); accent:SetHeight(1)
    -- Style the title text
    f._title = addon:CreateStyledText(f, "Arena Core Social", 13, COLORS.PRIMARY, "OVERLAY", "")
    f._title:SetPoint("TOPLEFT", 14, -12)
    -- Style the close button to match the main panel's
    f._close = addon:CreateProfileStyleButton(f, 30, 30, "", "danger", 14)
    f._close:SetPoint("TOPRIGHT", -8, -8)
    local xText = addon:CreateStyledText(f._close, "×", 14, COLORS.TEXT, "OVERLAY", "")
    xText:SetPoint("CENTER", 0, 0)
    f._close:SetScript("OnClick", function() f:Hide() end)
    -- Create Discord button (using ProfileStyleButton to match Save Settings)
    f._discordBtn = addon:CreateProfileStyleButton(f, 100, 32, "Discord", "primary", 11)
    f._discordBtn:SetPoint("BOTTOM", 0, 50)
    f._discordBtn:SetScript("OnClick", function()
      -- Show chat message
      if ChatFrame1 then
        ChatFrame1:AddMessage("|cff8B45FFArenaCore:|r https://acdiscord.com", 1, 1, 1)
      end
      -- Open copy/paste window
      V:ShowDiscordLinkPopup()
    end)
    -- Create Website button (using ProfileStyleButton to match Save Settings)
    f._websiteBtn = addon:CreateProfileStyleButton(f, 100, 32, "Website", "primary", 11)
    f._websiteBtn:SetPoint("BOTTOM", 0, 14)
    f._websiteBtn:SetScript("OnClick", function()
      if ChatFrame1 then
        ChatFrame1:AddMessage("|cff8B45FFArenaCore:|r https://ArenaCore.io", 1, 1, 1)
      end
    end)
    f._skin = true
  end
  f:Show(); addon._linksFrame = f
end
-- ============================================================================
-- Discord Link Popup (copyable link window)
-- ============================================================================
function V:ShowDiscordLinkPopup()
  if addon._discordLinkFrame and addon._discordLinkFrame:IsShown() then return end
  -- Create a plain Frame, NOT a BackdropTemplate
  local f = addon._discordLinkFrame or CreateFrame("Frame", "ArenaCoreDiscordLink", UIParent)
  f:SetSize(320, 160); f:SetPoint("CENTER", 0, 60); f:SetFrameStrata("FULLSCREEN_DIALOG")
  f:SetMovable(true); f:SetClampedToScreen(true); f:EnableMouse(true); f:RegisterForDrag("LeftButton")
  f:SetScript("OnDragStart", f.StartMoving); f:SetScript("OnDragStop", f.StopMovingOrSizing)
  if not f._skin then
    -- Apply the dark matte background texture, just like a group box
    local bg = f:CreateTexture(nil, "BACKGROUND")
    bg:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\box-dark-matte.tga")
    bg:SetAllPoints()
    -- Add the hairline border
    addon:AddHairlineRect(f, COLORS.BORDER_LIGHT, 0.9, 6)
    -- Add the purple accent line at the top
    local accent = addon:CreateFlatTexture(f, "OVERLAY", 7, COLORS.PRIMARY, 1)
    accent:SetPoint("TOPLEFT", 0, 0); accent:SetPoint("TOPRIGHT", 0, 0); accent:SetHeight(1)
    -- Style the title text
    f._title = addon:CreateStyledText(f, "Arena Core Discord", 13, COLORS.PRIMARY, "OVERLAY", "")
    f._title:SetPoint("TOPLEFT", 14, -12)
    -- Style the close button to match the main panel's
    f._close = addon:CreateProfileStyleButton(f, 30, 30, "", "danger", 14)
    f._close:SetPoint("TOPRIGHT", -8, -8)
    local xText = addon:CreateStyledText(f._close, "×", 14, COLORS.TEXT, "OVERLAY", "")
    xText:SetPoint("CENTER", 0, 0)
    f._close:SetScript("OnClick", function() f:Hide() end)
    -- Instruction text
    f._instructionText = addon:CreateStyledText(f, "Copy the Discord link below:", 11, COLORS.TEXT_2, "OVERLAY", "")
    f._instructionText:SetPoint("TOP", 0, -45)
    -- Create EditBox for copyable link
    local linkBox = CreateFrame("EditBox", nil, f)
    linkBox:SetSize(280, 32)
    linkBox:SetPoint("TOP", 0, -70)
    linkBox:SetAutoFocus(false)
    linkBox:SetMultiLine(false)
    linkBox:SetMaxLetters(0)
    
    -- Set font for EditBox
    local fontSet = linkBox:SetFont("Interface\\AddOns\\ArenaCore\\Media\\Fonts\\arenacore.ttf", 12, "")
    if not fontSet then
      linkBox:SetFont("Fonts\\FRIZQT__.TTF", 12, "")
    end
    
    -- EditBox background
    local linkBg = addon:CreateFlatTexture(linkBox, "BACKGROUND", 1, {0.08, 0.08, 0.08, 1}, 1)
    linkBg:SetAllPoints()
    
    -- EditBox border
    addon:AddHairlineRect(linkBox, COLORS.BORDER_LIGHT, 0.8, 6)
    
    -- Set the Discord link
    linkBox:SetText("https://acdiscord.com")
    linkBox:SetTextColor(1, 1, 1, 1)  -- White text color
    linkBox:SetCursorPosition(0)
    
    -- Select all text when clicked
    linkBox:SetScript("OnEditFocusGained", function(self)
      self:HighlightText()
    end)
    
    linkBox:SetScript("OnEscapePressed", function(self)
      self:ClearFocus()
    end)
    
    linkBox:SetScript("OnEnterPressed", function(self)
      self:ClearFocus()
    end)
    
    f._linkBox = linkBox
    -- Helper text
    f._helperText = addon:CreateStyledText(f, "Click the link to select all, then Ctrl+C to copy", 10, COLORS.TEXT_2, "OVERLAY", "")
    f._helperText:SetPoint("BOTTOM", 0, 14)
    f._skin = true
  end
  -- Auto-select the link when window opens
  if f._linkBox then
    C_Timer.After(0.1, function()
      if f._linkBox then
        f._linkBox:SetFocus()
        f._linkBox:HighlightText()
      end
    end)
  end
  f:Show(); addon._discordLinkFrame = f
end
-- Header vanity -------------------------------------------------------------
function V:AttachHeader()
  if not addon.header or addon._vanityHeader then return end
  
  -- Check if Shade UI theme is active
  local activeTheme = addon.ThemeManager and addon.ThemeManager:GetActiveTheme() or "default"
  local isShadeUI = (activeTheme == "shade_ui")
  -- Header title text next to logo (far left, large) - ONLY for default theme
  if not addon._headerTitle and not isShadeUI then
    -- Create container for title + underline
    local titleContainer = CreateFrame("Frame", nil, addon.header)
    titleContainer:SetPoint("LEFT", 70, 0) -- Position to match original
    titleContainer:SetSize(250, 40)
    
    local title = titleContainer:CreateFontString(nil, "OVERLAY", nil, 7)
    -- Set font BEFORE setting text - large bold size
    local fontSet = title:SetFont("Interface\\AddOns\\ArenaCore\\Media\\Fonts\\arenacore.ttf", 28, "OUTLINE")
    if not fontSet then
      title:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE")
    end
    title:SetTextColor(1, 1, 1, 1)
    title:SetText("ARENA CORE")
    title:SetPoint("TOPLEFT", 0, 0)
    
    -- Purple gradient underline effect using custom texture
    local underline = titleContainer:CreateTexture(nil, "OVERLAY", nil, 6)
    underline:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\purpleheader.tga")
    underline:SetPoint("BOTTOM", title, "BOTTOM", 0, -6)
    underline:SetSize(220, 8) -- Adjust width to match text length
    
    addon._headerTitle = title
    addon._headerTitleUnderline = underline
  end
  -- Version tag click easter egg
  if addon.versionFrame and not addon.versionFrame.__vanityEasterEgg then
    local vClick = CreateFrame("Button", nil, addon.versionFrame)
    vClick:SetAllPoints()
    vClick:SetScript("OnClick", function()
      if IsControlKeyDown() and IsAltKeyDown() then
        local sword = "|T"..ICONS.SWORD..":14:14:0:0:64:64:2:62:2:62|t"
        print("|cff8B45FFArena Core:|r " .. sword .. " Obsidian Mode Unlocked " .. sword)
        if PlaySound and SOUNDKIT then pcall(PlaySound, SOUNDKIT.UI_EPICLOOT_TOAST, "Master") end
      end
    end)
    addon.versionFrame.__vanityEasterEgg = true
  end
  -- Changelog button (was "?")
  local notesBtn = addon:CreateProfileStyleButton(addon.header, 90, 24, GetLocalizedString("COMMON", "button_changelog", "Changelog"), "primary", 12)
  if addon.header.__acSave then
    notesBtn:SetPoint("TOPRIGHT", addon.header.__acSave, "TOPLEFT", 92, 27)
  elseif addon.header.__acClose then
    notesBtn:SetPoint("RIGHT", addon.header.__acClose, "LEFT", -8, 0)
  else
    notesBtn:SetPoint("TOPRIGHT", -140, -8)
  end
  notesBtn:SetScript("OnClick", function() V:ShowPatchNotes() end)
  -- Add "NEW" indicator to Changelog button
  local newIndicator = notesBtn:CreateFontString(nil, "OVERLAY")
  newIndicator:SetFont(addon.FONT_PATH or "Interface\\AddOns\\ArenaCore\\Media\\Fonts\\arenacore.ttf", 8, "OUTLINE")
  newIndicator:SetText("|cffFFD700" .. GetLocalizedString("COMMON", "changelog_new", "NEW") .. "|r")
  newIndicator:SetPoint("LEFT", notesBtn.text, "RIGHT", 3, 0)
  -- Simple pulsing animation for the NEW indicator
  -- NOTE: FontStrings don't support SetScript - use the parent frame instead
  local pulseTime = 0
  notesBtn:SetScript("OnUpdate", function(self, elapsed)
    pulseTime = pulseTime + elapsed
    local alpha = 0.5 + math.sin(pulseTime * 2) * 0.5
    newIndicator:SetAlpha(alpha)
  end)
  -- Subtle pulse on header accent (one-time)
  local target = addon.header._accent
  if target and not addon._accentPulse then
    local ag = target:CreateAnimationGroup()
    local a1 = ag:CreateAnimation("Alpha"); a1:SetFromAlpha(1); a1:SetToAlpha(0.85); a1:SetDuration(1.6); a1:SetSmoothing("IN_OUT")
    local a2 = ag:CreateAnimation("Alpha"); a2:SetFromAlpha(0.85); a2:SetToAlpha(1); a2:SetDuration(1.6); a2:SetSmoothing("IN_OUT")
    ag:SetLooping("REPEAT"); ag:Play()
    addon._accentPulse = ag
  end
  -- Sword logo
  if not addon._swordLogo then
    local logo = addon.header:CreateTexture(nil, "OVERLAY", nil, 7)
    logo:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\logoarena.tga")
    logo:SetSize(160, 160)
    logo:SetPoint("TOPLEFT", addon.header, "TOPLEFT", -60, 50)  -- Moved up from 36 to 50
    logo:SetTexCoord(0.002, 0.998, 0.002, 0.998)
    logo:SetVertexColor(1, 1, 1, 1)
    logo:SetBlendMode("BLEND")
    logo:SetRotation(math.rad(-25))
    addon._swordLogo = logo
  end
  addon._vanityHeader = true
end
-- Content vanity ------------------------------------------------------------
function V:AttachContent()
  if not addon.contentBox or addon._vanityContent then return end
  -- tiny mascot bottom-right
  local m = addon.contentBox:CreateTexture(nil, "OVERLAY", nil, 6)
  m:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\Logo\\arena_core_clean.tga")
  m:SetSize(80, 22)
  m:SetPoint("BOTTOMRIGHT", -12, 10)
  m:SetVertexColor(1, 1, 1, 0.10)
  addon._mascot = m
  addon._vanityContent = true
end
-- Footer vanity -------------------------------------------------------------
local FOOTER_HEIGHT = 28
function V:AttachFooter()
  if not addon.configFrame or addon._footer then return end
  local frame = addon.configFrame
  -- Grow once only
  local w, h = frame:GetSize(); frame:SetSize(w, h + FOOTER_HEIGHT)
  local footer = CreateFrame("Frame", nil, frame)
  footer:SetPoint("BOTTOMLEFT", 1, 1); footer:SetPoint("BOTTOMRIGHT", -1, 1)
  footer:SetHeight(FOOTER_HEIGHT)
  -- Check if Shade UI theme is active
  local activeTheme = addon.ThemeManager and addon.ThemeManager:GetActiveTheme() or "default"
  local isShadeUI = (activeTheme == "shade_ui")
  
  -- Use HEADER_BG for footer (darker, more consistent) - but hide for Shade UI
  local footerColor = addon.COLORS.HEADER_BG or addon.COLORS.INPUT_DARK or {0.102, 0.102, 0.102, 1}
  local fill = addon:CreateFlatTexture(footer, "BACKGROUND", 1, footerColor, 1)
  fill:SetAllPoints()
  if isShadeUI then
    fill:Hide() -- Hide footer background for Shade UI theme
  end
  
  local top  = addon:CreateFlatTexture(footer, "OVERLAY", 1, COLORS.PRIMARY, 0.9)
  top:SetPoint("TOPLEFT", 0, 0); top:SetPoint("TOPRIGHT", 0, 0); top:SetHeight(1)
  
  -- Discord button in footer for both themes
  local discordBtn = CreateFrame("Button", nil, footer)
  discordBtn:SetSize(90, 22)
  if isShadeUI then
    discordBtn:SetPoint("BOTTOMLEFT", footer, "BOTTOMLEFT", 32, 4)
  else
    discordBtn:SetPoint("BOTTOMLEFT", footer, "BOTTOMLEFT", 20, 3)
  end
  -- Background (purple gradient)
  local discordBg = addon:CreateFlatTexture(discordBtn, "BACKGROUND", 1, COLORS.PRIMARY, 1)
  discordBg:SetAllPoints()
  local discordBorder = addon:CreateFlatTexture(discordBtn, "BORDER", 2, {0.4, 0.2, 0.7, 1}, 1)
  discordBorder:SetPoint("TOPLEFT", 1, -1)
  discordBorder:SetPoint("BOTTOMRIGHT", -1, 1)
  local discordIcon = discordBtn:CreateTexture(nil, "OVERLAY")
  discordIcon:SetAtlas("communities-icon-chat")
  discordIcon:SetSize(16, 16)
  discordIcon:SetPoint("LEFT", discordBtn, "LEFT", 6, 0)
  local discordText = discordBtn:CreateFontString(nil, "OVERLAY")
  discordText:SetFont(addon.FONT_PATH, 9)
  discordText:SetText(GetLocalizedString("COMMON", "button_discord", "DISCORD"))
  discordText:SetTextColor(1, 1, 1, 1)
  discordText:SetPoint("LEFT", discordIcon, "RIGHT", 4, 0)
  local glow = discordBtn:CreateTexture(nil, "OVERLAY")
  glow:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\tab-purple-matte.tga")
  glow:SetAllPoints()
  glow:SetBlendMode("ADD")
  glow:SetAlpha(0)
  discordBtn.glow = glow
  discordBtn:SetScript("OnEnter", function()
    discordBg:SetColorTexture(0.645, 0.371, 1.000, 1)
    if discordBtn.glow then
      discordBtn.glow:SetAlpha(0.3)
    end
  end)
  discordBtn:SetScript("OnLeave", function()
    discordBg:SetColorTexture(0.545, 0.271, 1.000, 1)
    if discordBtn.glow then
      discordBtn.glow:SetAlpha(0)
    end
  end)
  discordBtn:SetScript("OnClick", function()
    if addon.Vanity and addon.Vanity.ShowDiscordLinkPopup then
      addon.Vanity:ShowDiscordLinkPopup()
    end
  end)
  local row = CreateFrame("Frame", nil, footer); row:SetPoint("CENTER", 0, 0); row:SetHeight(FOOTER_HEIGHT)
  row:SetWidth(200) -- Set initial width
  
  local pre = addon:CreateStyledText(row, GetLocalizedString("COMMON", "footer_made_with", "made with"), 12, COLORS.TEXT_2); pre:SetPoint("CENTER", -40, 0)
  
  local heart = row:CreateTexture(nil, "OVERLAY", nil, 7)
  heart:SetTexture(ICONS.HEART); heart:SetSize(20, 20); heart:SetPoint("LEFT", pre, "RIGHT", 6, 0)
  heart:SetTexCoord(0.002, 0.998, 0.002, 0.998); heart:SetBlendMode("BLEND"); heart:SetVertexColor(0.95, 0.15, 0.20, 1)
  
  local post = addon:CreateStyledText(row, "by peralex", 12, COLORS.TEXT_2); post:SetPoint("LEFT", heart, "RIGHT", 6, 0)
  -- Add subtle button next to the footer text
  local subtleBtn = CreateFrame("Button", nil, footer)
  subtleBtn:SetSize(110, 20)
  subtleBtn:SetPoint("LEFT", post, "RIGHT", 15, 0)
  -- Add background texture to make it look like a proper button
  local btnBg = addon:CreateFlatTexture(subtleBtn, "BACKGROUND", 1, COLORS.BG, 1)
  btnBg:SetAllPoints()
  -- Add border for definition
  addon:AddHairlineRect(subtleBtn, COLORS.BORDER_LIGHT, 0.6, 6)
  
  local btnText = addon:CreateStyledText(subtleBtn, "click this, do it", 11, COLORS.TEXT_2)
  btnText:ClearAllPoints()
  btnText:SetPoint("CENTER", 0, 0)
  subtleBtn:SetScript("OnClick", function() V:ShowLinksPopup() end)
  -- Add purple glow overlay on hover (same as ProfileStyle buttons)
  local glow = subtleBtn:CreateTexture(nil, "OVERLAY")
  glow:SetTexture("Interface\\AddOns\\ArenaCore\\Media\\UI\\tab-purple-matte.tga")
  glow:SetAllPoints()
  glow:SetBlendMode("ADD")
  glow:SetAlpha(0)
  subtleBtn.glow = glow
  subtleBtn:SetScript("OnEnter", function(self)
    if self.glow then
      self.glow:SetAlpha(0.3)
    end
  end)
  subtleBtn:SetScript("OnLeave", function(self)
    if self.glow then
      self.glow:SetAlpha(0)
    end
  end)
  -- Update width after UI is loaded to ensure proper centering
  C_Timer.After(0.1, function()
    local wpre = pre and pre:GetStringWidth() or 60
    local wpost = post and post:GetStringWidth() or 70
    local wbtn = subtleBtn and subtleBtn:GetWidth() or 80
    local totalWidth = wpre + wpost + heart:GetWidth() + wbtn + 30
    row:SetWidth(totalWidth)
    -- Shift left to compensate for the longer button and center properly
    row:ClearAllPoints()
    row:SetPoint("CENTER", footer, "CENTER", -60, 0)
  end)
  -- Move version badge into the footer (bottom-right)
  if addon.versionFrame then
    addon.versionFrame:SetParent(footer)
    addon.versionFrame:ClearAllPoints()
    addon.versionFrame:SetPoint("BOTTOMRIGHT", footer, "BOTTOMRIGHT", -40, 2)
  end
  addon._footer = footer
  -- Re-anchor sidebar/content bottoms upward by FOOTER_HEIGHT
  -- CRITICAL FIX: Don't override sidebar width - let the theme control it
  -- The hardcoded 240 was causing Shade UI's 160px sidebar to be resized
  if addon.sidebar then 
    -- Don't call ClearAllPoints or SetWidth - let the theme's sidebar positioning stay intact
    -- Just adjust the bottom position for the footer
    -- addon.sidebar:ClearAllPoints(); addon.sidebar:SetPoint("TOPLEFT", 8, -(70 + 8)); addon.sidebar:SetPoint("BOTTOMLEFT", 8, 8 + FOOTER_HEIGHT); addon.sidebar:SetWidth(240)
  end
  if addon.contentArea then 
    -- Don't reposition content area - let the theme control it
    -- addon.contentArea:ClearAllPoints(); addon.contentArea:SetPoint("TOPLEFT", 240 + 8 + 1, -(70 + 8)); addon.contentArea:SetPoint("BOTTOMRIGHT", -8, 8 + FOOTER_HEIGHT)
  end
end
-- Attach everything once -----------------------------------------------------
function V:AttachAll()
  V:AttachHeader(); V:AttachContent(); V:AttachFooter()
  
  if addon.configFrame and addon.tipText then
    local initial_pick = math.random(1, #V.MOTTO_LINES)
    addon.tipText:SetText(V.MOTTO_LINES[initial_pick])
    addon.configFrame:HookScript("OnShow", function()
        -- CRITICAL FIX: Ensure all UI fonts are set before showing
        if addon.EnsureUIFontObjects then
            addon.EnsureUIFontObjects()
        end
        if addon.FixUIFontsRecursively then
            addon.FixUIFontsRecursively(addon.configFrame)
        end
        
        if addon.tipText:IsShown() then
            local pick = math.random(1, #V.MOTTO_LINES)
            addon.tipText:SetText(V.MOTTO_LINES[pick])
        end
    end)
  end
end