local addonName, BM = ...

BM.FontChoices = {
    { key = "FRIZQT__", name = "Friz Quadrata", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\FRIZQT__.TTF" },
    { key = "ARIALN", name = "Arial Narrow", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\ARIALN.TTF" },
    { key = "MORPHEUS", name = "Morpheus", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\MORPHEUS.TTF" },
    { key = "SKURRI", name = "Skurri", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\skurri.TTF" },
    { key = "XERWO_BOLD", name = "Xerwo Bold", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Xerwo-Bold.TTF" },
    { key = "ACCIDENTAL_PRESIDENCY", name = "Accidental Presidency", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Accidental Presidency.ttf" },
    { key = "CARLITO_REGULAR", name = "Carlito Regular", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Carlito-Regular.ttf" },
    { key = "EL_MESSIRI", name = "El Messiri", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\ElMessiri-VariableFont_wght.ttf" },
    { key = "EXPRESSWAY", name = "Expressway", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Expressway.ttf" },
    { key = "FORCED_SQUARE", name = "Forced Square", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\FORCED SQUARE.ttf" },
    { key = "HARRYP", name = "Harry P", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\HARRYP__.TTF" },
    { key = "NOTO_NASKH_ARABIC", name = "Noto Naskh Arabic", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\NotoNaskhArabic-Regular.ttf" },
    { key = "NUEVA_STD_COND", name = "Nueva Std Cond", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Nueva Std Cond.ttf" },
    { key = "OSWALD_REGULAR", name = "Oswald Regular", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Oswald-Regular.ttf" },
    { key = "TRASH_HAND", name = "Trash Hand", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\TrashHand.TTF" },
    { key = "UBUNTU_ARABIC", name = "Ubuntu Arabic", path = "Interface\\AddOns\\BetterMailbox\\Fonts\\Ubuntu Arabic Regular.otf" },
}

function BM:GetFontConfig()
    local selected = BetterMailboxDB and BetterMailboxDB.fontFace or "FRIZQT__"
    for _, font in ipairs(BM.FontChoices or {}) do
        if font.key == selected then
            return font
        end
    end
    return {
        key = "DEFAULT",
        name = "Default",
        path = STANDARD_TEXT_FONT,
        scale = 1.00,
    }
end

function BM:GetFontPath()
    local font = BM.GetFontConfig and BM:GetFontConfig() or nil
    if font then
        return font.path, font.name, font.key
    end
    return STANDARD_TEXT_FONT, "Default", "DEFAULT"
end

function BM:GetFontDisplayName(key)
    if not key then
        return "Default"
    end
    for _, font in ipairs(BM.FontChoices or {}) do
        if font.key == key then
            return font.name
        end
    end
    return "Default"
end

function BM:GetFontPreviewObject(key)
    if not key then
        return GameFontHighlightSmallLeft
    end

    BM.FontPreviewObjects = BM.FontPreviewObjects or {}
    if BM.FontPreviewObjects[key] then
        return BM.FontPreviewObjects[key]
    end

    local fontConfig = nil
    for _, font in ipairs(BM.FontChoices or {}) do
        if font.key == key then
            fontConfig = font
            break
        end
    end

    if not fontConfig then
        return GameFontHighlightSmallLeft
    end

    local objectName = "BetterMailboxFontPreview_" .. key
    local fontObject = _G[objectName] or CreateFont(objectName)
    fontObject:SetFont(fontConfig.path, 14, "")
    BM.FontPreviewObjects[key] = fontObject
    return fontObject
end

function BM:ApplyScale()
    if BM.MainFrame then
        BM.MainFrame:SetScale(BetterMailboxDB and BetterMailboxDB.scale or 1)
        BM.MainFrame:Raise()
    end
    if BM.ApplyInboxLayout then BM:ApplyInboxLayout() end
    if BM.RefreshMetricLayout then BM:RefreshMetricLayout() end
    if BM.ApplyPremiumWindowLayout then BM:ApplyPremiumWindowLayout() end
end

function BM:ApplyFontSize()
    local size = BetterMailboxDB and BetterMailboxDB.fontSize or 12
    local font = BM.GetFontConfig and BM:GetFontConfig() or { path = STANDARD_TEXT_FONT }
    local fontPath = font.path or STANDARD_TEXT_FONT
    local function scaled(value)
        return math.max(8, value)
    end

    if BM.TitleText then BM.TitleText:SetFont(fontPath, 24, "OUTLINE") end
    if BM.SubtitleText then BM.SubtitleText:SetFont(fontPath, 20, "") end
    if BM.StatusText then BM.StatusText:SetFont(fontPath, scaled(size), "") end
    if BM.HeaderKicker then BM.HeaderKicker:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.HeaderMeta then BM.HeaderMeta:SetFont(fontPath, scaled(size), "") end

    if BM.HeaderTexts then
        for _, text in ipairs(BM.HeaderTexts) do
            text:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
        end
    end

    if BM.Rows then
        for _, row in ipairs(BM.Rows) do
            if row.item then row.item:SetFont(fontPath, scaled(size), "OUTLINE") end
            if row.meta then row.meta:SetFont(fontPath, scaled(size), "") end
            if row.coinDisplay and row.coinDisplay.Gold then
                row.coinDisplay.Gold:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
                row.coinDisplay.Silver:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
                row.coinDisplay.Copper:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
            end
            if row.expire then row.expire:SetFont(fontPath, scaled(math.max(10, size - 1)), "") end
            if row.sender then row.sender:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE") end
        end
    end

    if BM.InboxCountLabel then BM.InboxCountLabel:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE") end
    if BM.LootLabel then BM.LootLabel:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE") end
    if BM.GoldLabel then BM.GoldLabel:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE") end
    if BM.MetricInboxCount then BM.MetricInboxCount:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE") end
    if BM.MetricLootCount then BM.MetricLootCount:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE") end
    if BM.MetricGoldValue then BM.MetricGoldValue:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE") end
    if BM.MetricGoldCoinDisplay and BM.MetricGoldCoinDisplay.Gold then
        BM.MetricGoldCoinDisplay.Gold:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE")
        BM.MetricGoldCoinDisplay.Silver:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE")
        BM.MetricGoldCoinDisplay.Copper:SetFont(fontPath, scaled(math.max(9, size - 2)), "OUTLINE")
    end
    if BM.EmptyState then BM.EmptyState:SetFont(fontPath, scaled(size + 1), "OUTLINE") end
    if BM.EmptyStateSub then BM.EmptyStateSub:SetFont(fontPath, scaled(size), "") end
    if BM.OpenMailTitle then BM.OpenMailTitle:SetFont(fontPath, scaled(size + 2), "OUTLINE") end
    if BM.OpenMailSenderValue then BM.OpenMailSenderValue:SetFont(fontPath, scaled(size), "") end
    if BM.OpenMailExpiresValue then BM.OpenMailExpiresValue:SetFont(fontPath, scaled(size), "") end
    if BM.OpenMailBodyText then BM.OpenMailBodyText:SetFont(fontPath, scaled(size), "") end
    if BM.OpenMailAttachmentsLabel then BM.OpenMailAttachmentsLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OpenMailBodyLabel then BM.OpenMailBodyLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OpenMailNoAttachments then BM.OpenMailNoAttachments:SetFont(fontPath, scaled(size), "") end
    if BM.OpenMailAttachedGoldLabel then BM.OpenMailAttachedGoldLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OpenMailAttachedGoldValue and BM.OpenMailAttachedGoldValue.Gold then
        BM.OpenMailAttachedGoldValue.Gold:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
        BM.OpenMailAttachedGoldValue.Silver:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
        BM.OpenMailAttachedGoldValue.Copper:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
    end

    if BM.ThemedButtons then
        for _, button in ipairs(BM.ThemedButtons) do
            if button.label then
                button.label:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE")
            end
        end
    end

    if BM.OptionsHeroTitle then BM.OptionsHeroTitle:SetFont(fontPath, scaled(size + 2), "OUTLINE") end
    if BM.OptionsHeroSubtitle then BM.OptionsHeroSubtitle:SetFont(fontPath, scaled(size), "") end
    if BM.SendMoneyLabel then BM.SendMoneyLabel:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE") end
    if BM.OptionsSkinLabel then BM.OptionsSkinLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsLanguageLabel then BM.OptionsLanguageLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsScaleLabel then BM.OptionsScaleLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsScaleValue then BM.OptionsScaleValue:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsFontLabel then BM.OptionsFontLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsFontValue then BM.OptionsFontValue:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsFontFaceLabel then BM.OptionsFontFaceLabel:SetFont(fontPath, scaled(size), "OUTLINE") end
    if BM.OptionsAuthorLabel then BM.OptionsAuthorLabel:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE") end
    if BM.OptionsAuthorValue then BM.OptionsAuthorValue:SetFont(fontPath, scaled(math.max(10, size - 1)), "") end
    if BM.OptionsVersionLabel then BM.OptionsVersionLabel:SetFont(fontPath, scaled(math.max(10, size - 1)), "OUTLINE") end
    if BM.OptionsVersionValue then BM.OptionsVersionValue:SetFont(fontPath, scaled(math.max(10, size - 1)), "") end
    if BM.ApplyInboxLayout then BM:ApplyInboxLayout() end
    if BM.RefreshMetricLayout then BM:RefreshMetricLayout() end
    if BM.ApplyPremiumWindowLayout then BM:ApplyPremiumWindowLayout() end
end

function BM:CreateOptionsPanel()
    local panel = BM.OptionsPanel

    local hero = BM:CreatePanel(panel)
    hero:SetPoint("TOPLEFT", 16, -16)
    hero:SetPoint("TOPRIGHT", -16, -16)
    hero:SetHeight(82)
    hero.themePalette = "hero"
    BM:ApplyThemeToPanel(hero)

    local heroTitle = hero:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
    heroTitle:SetPoint("TOPLEFT", 18, -14)
    heroTitle:SetTextColor(unpack(BM.Theme.text))

    local heroSub = hero:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
    heroSub:SetPoint("TOPLEFT", heroTitle, "BOTTOMLEFT", 0, -8)
    heroSub:SetTextColor(unpack(BM.Theme.mutetext))

    local settings = BM:CreatePanel(panel)
    settings:SetPoint("TOPLEFT", 16, -114)
    settings:SetPoint("BOTTOMRIGHT", -16, 16)
    settings.themePalette = "settings"
    BM:ApplyThemeToPanel(settings)

    local langLabel = settings:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    langLabel:SetPoint("TOPLEFT", 22, -22)
    langLabel:SetTextColor(unpack(BM.Theme.mutetext))

    local skinLabel = settings:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    skinLabel:SetPoint("TOPLEFT", 300, -22)
    skinLabel:SetTextColor(unpack(BM.Theme.mutetext))

    local skinDropdown = CreateFrame("Frame", "BetterMailboxSkinDropdown", settings, "UIDropDownMenuTemplate")
    skinDropdown:SetPoint("TOPLEFT", 288, -40)
    UIDropDownMenu_SetWidth(skinDropdown, 220)

    UIDropDownMenu_Initialize(skinDropdown, function(self, level)
        local order = {
            "blackgrey", "premium", "warrior", "paladin", "hunter", "rogue", "priest",
            "deathknight", "shaman", "mage", "warlock", "monk", "druid",
            "demonhunter", "evoker"
        }
        for _, key in ipairs(order) do
            local skin = BM.Skins and BM.Skins[key]
            if skin then
                local info = UIDropDownMenu_CreateInfo()
                info.text = BM.GetSkinColorizedName and BM:GetSkinColorizedName(key) or skin.name
                info.func = function()
                    BetterMailboxDB.skin = key
                    if BM.ApplyCurrentSkin then BM:ApplyCurrentSkin() end
                    if BM.UpdateOptionsTexts then BM:UpdateOptionsTexts() end
                end
                info.value = key
                info.checked = (BM:GetSkin() == key)
                UIDropDownMenu_AddButton(info, level)
            end
        end
    end)

    local dropdown = CreateFrame("Frame", "BetterMailboxLanguageDropdown", settings, "UIDropDownMenuTemplate")
    dropdown:SetPoint("TOPLEFT", 10, -40)
    UIDropDownMenu_SetWidth(dropdown, 220)

    UIDropDownMenu_Initialize(dropdown, function(self, level)
        for _, lang in ipairs(BM.LanguageOrder or {}) do
            local info = UIDropDownMenu_CreateInfo()
            info.text = BM:GetLanguageDisplay(lang)
            info.func = function()
                BM:SetLanguage(lang)
                UIDropDownMenu_SetSelectedValue(dropdown, lang)
                UIDropDownMenu_SetText(dropdown, BM:GetLanguageDisplay(lang))
            end
            info.value = lang
            info.checked = (BM:GetLocale() == lang)
            UIDropDownMenu_AddButton(info, level)
        end
    end)

    local scaleLabel = settings:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    scaleLabel:SetPoint("TOPLEFT", 22, -118)
    scaleLabel:SetTextColor(unpack(BM.Theme.mutetext))

    local scaleDown = BM:CreateFlatActionButton(settings, 34, 30, "-")
    scaleDown:SetPoint("TOPLEFT", 22, -142)
    scaleDown:SetScript("OnClick", function()
        BetterMailboxDB.scale = math.max(0.8, (BetterMailboxDB.scale or 1) - 0.05)
        BM:ApplyScale()
        BM:UpdateOptionsTexts()
    end)

    local scaleValue = settings:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
    scaleValue:SetPoint("LEFT", scaleDown, "RIGHT", 16, 0)
    scaleValue:SetTextColor(unpack(BM.Theme.text))

    local scaleUp = BM:CreateFlatActionButton(settings, 34, 30, "+")
    scaleUp:SetPoint("LEFT", scaleDown, "RIGHT", 124, 0)
    scaleUp:SetScript("OnClick", function()
        BetterMailboxDB.scale = math.min(1.35, (BetterMailboxDB.scale or 1) + 0.05)
        BM:ApplyScale()
        BM:UpdateOptionsTexts()
    end)

    local fontFaceLabel = settings:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    fontFaceLabel:SetPoint("TOPLEFT", 300, -118)
    fontFaceLabel:SetTextColor(unpack(BM.Theme.mutetext))

    local fontDropdown = CreateFrame("Frame", "BetterMailboxFontDropdown", settings, "UIDropDownMenuTemplate")
    fontDropdown:SetPoint("TOPLEFT", 288, -136)
    UIDropDownMenu_SetWidth(fontDropdown, 220)

    UIDropDownMenu_Initialize(fontDropdown, function(self, level)
        for _, font in ipairs(BM.FontChoices or {}) do
            local info = UIDropDownMenu_CreateInfo()
            info.text = font.name
            info.fontObject = BM.GetFontPreviewObject and BM:GetFontPreviewObject(font.key) or GameFontHighlightSmallLeft
            info.func = function()
                BetterMailboxDB.fontFace = font.key
                if BM.UpdateTexts then
                    BM:UpdateTexts()
                elseif BM.ApplyFontSize then
                    BM:ApplyFontSize()
                end
                if BM.UpdateOptionsTexts then BM:UpdateOptionsTexts() end
            end
            info.value = font.key
            info.checked = (BetterMailboxDB.fontFace == font.key)
            UIDropDownMenu_AddButton(info, level)
        end
    end)

    local fontLabel = settings:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    fontLabel:SetPoint("TOPLEFT", 22, -210)
    fontLabel:SetTextColor(unpack(BM.Theme.mutetext))

    local fontDown = BM:CreateFlatActionButton(settings, 34, 30, "-")
    fontDown:SetPoint("TOPLEFT", 22, -234)
    fontDown:SetScript("OnClick", function()
        BetterMailboxDB.fontSize = math.max(10, (BetterMailboxDB.fontSize or 12) - 1)
        BM:ApplyFontSize()
        BM:UpdateOptionsTexts()
    end)

    local fontValue = settings:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
    fontValue:SetPoint("LEFT", fontDown, "RIGHT", 16, 0)
    fontValue:SetTextColor(unpack(BM.Theme.text))

    local fontUp = BM:CreateFlatActionButton(settings, 34, 30, "+")
    fontUp:SetPoint("LEFT", fontDown, "RIGHT", 124, 0)
    fontUp:SetScript("OnClick", function()
        BetterMailboxDB.fontSize = math.min(18, (BetterMailboxDB.fontSize or 12) + 1)
        BM:ApplyFontSize()
        BM:UpdateOptionsTexts()
    end)

    local metaBlock = CreateFrame("Frame", nil, settings)
    metaBlock:SetSize(220, 110)
    metaBlock:SetPoint("BOTTOMRIGHT", settings, "BOTTOMRIGHT", 28, -6)

    local authorLabel = metaBlock:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    authorLabel:SetPoint("TOP", metaBlock, "TOP", 0, 0)
    authorLabel:SetWidth(220)
    authorLabel:SetTextColor(unpack(BM.Theme.mutetext))
    authorLabel:SetJustifyH("CENTER")

    local authorValue = metaBlock:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
    authorValue:SetPoint("TOP", authorLabel, "BOTTOM", 0, -4)
    authorValue:SetWidth(220)
    authorValue:SetTextColor(unpack(BM.Theme.text))
    authorValue:SetJustifyH("CENTER")

    local versionLabel = metaBlock:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
    versionLabel:SetPoint("TOP", authorValue, "BOTTOM", 0, -12)
    versionLabel:SetWidth(220)
    versionLabel:SetTextColor(unpack(BM.Theme.mutetext))
    versionLabel:SetJustifyH("CENTER")

    local versionValue = metaBlock:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
    versionValue:SetPoint("TOP", versionLabel, "BOTTOM", 0, -4)
    versionValue:SetWidth(220)
    versionValue:SetTextColor(unpack(BM.Theme.text))
    versionValue:SetJustifyH("CENTER")

    BM.OptionsHeroTitle = heroTitle
    BM.OptionsHeroSubtitle = heroSub
    BM.OptionsSkinLabel = skinLabel
    BM.OptionsSkinDropdown = skinDropdown
    BM.OptionsLanguageLabel = langLabel
    BM.OptionsLanguageDropdown = dropdown
    BM.OptionsScaleLabel = scaleLabel
    BM.OptionsScaleValue = scaleValue
    BM.OptionsFontFaceLabel = fontFaceLabel
    BM.OptionsFontDropdown = fontDropdown
    BM.OptionsFontLabel = fontLabel
    BM.OptionsFontValue = fontValue
    BM.OptionsAuthorLabel = authorLabel
    BM.OptionsAuthorValue = authorValue
    BM.OptionsVersionLabel = versionLabel
    BM.OptionsVersionValue = versionValue
end

function BM:ToggleOptions()
    BM:SelectTab("options")
end

function BM:UpdateOptionsTexts()
    if BM.OptionsHeroTitle then BM.OptionsHeroTitle:SetText(BM:L("options")) end
    if BM.OptionsHeroSubtitle then BM.OptionsHeroSubtitle:SetText(BM:L("subtitle")) end
    if BM.OptionsSkinLabel then BM.OptionsSkinLabel:SetText(BM:L("skin")) end
    if BM.OptionsSkinDropdown then
        UIDropDownMenu_SetSelectedValue(BM.OptionsSkinDropdown, BM:GetSkin())
        UIDropDownMenu_SetText(BM.OptionsSkinDropdown, BM.GetSkinColorizedName and BM:GetSkinColorizedName(BM:GetSkin()) or BM:GetSkinDisplay())
    end
    if BM.OptionsLanguageLabel then BM.OptionsLanguageLabel:SetText(BM:L("language")) end
    if BM.OptionsLanguageDropdown then
        UIDropDownMenu_SetSelectedValue(BM.OptionsLanguageDropdown, BM:GetLocale())
        UIDropDownMenu_SetText(BM.OptionsLanguageDropdown, BM:GetLanguageDisplay(BM:GetLocale()))
    end
    if BM.OptionsScaleLabel then BM.OptionsScaleLabel:SetText(BM:L("ui_scale")) end
    if BM.OptionsScaleValue then BM.OptionsScaleValue:SetText(string.format("%.2f", BetterMailboxDB.scale or 1)) end
    if BM.OptionsFontFaceLabel then BM.OptionsFontFaceLabel:SetText(BM:L("font_face")) end
    if BM.OptionsFontDropdown then
        UIDropDownMenu_SetSelectedValue(BM.OptionsFontDropdown, BetterMailboxDB.fontFace or "FRIZQT__")
        UIDropDownMenu_SetText(BM.OptionsFontDropdown, BM:GetFontDisplayName(BetterMailboxDB.fontFace or "FRIZQT__"))
    end
    if BM.OptionsFontLabel then BM.OptionsFontLabel:SetText(BM:L("font_size")) end
    if BM.OptionsFontValue then BM.OptionsFontValue:SetText(tostring(BetterMailboxDB.fontSize or 12)) end
    if BM.OptionsAuthorLabel then BM.OptionsAuthorLabel:SetText("Author:") end
    if BM.OptionsAuthorValue then BM.OptionsAuthorValue:SetText("CRAZUDEMZY") end
    if BM.OptionsVersionLabel then BM.OptionsVersionLabel:SetText("Aktuelle Version:") end
    if BM.OptionsVersionValue then BM.OptionsVersionValue:SetText("0.6.10 BETA") end
    if BM.OptionsHeroTitle then BM.OptionsHeroTitle:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsHeroSubtitle then BM.OptionsHeroSubtitle:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsSkinLabel then BM.OptionsSkinLabel:SetTextColor(unpack(BM.Theme.accent)) end
    if BM.OptionsLanguageLabel then BM.OptionsLanguageLabel:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsScaleLabel then BM.OptionsScaleLabel:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsScaleValue then BM.OptionsScaleValue:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsFontFaceLabel then BM.OptionsFontFaceLabel:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsFontLabel then BM.OptionsFontLabel:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsFontValue then BM.OptionsFontValue:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsAuthorLabel then BM.OptionsAuthorLabel:SetTextColor(unpack(BM.Theme.mutetext)) end
    if BM.OptionsAuthorValue then BM.OptionsAuthorValue:SetTextColor(unpack(BM.Theme.text)) end
    if BM.OptionsVersionLabel then BM.OptionsVersionLabel:SetTextColor(unpack(BM.Theme.mutetext)) end
    if BM.OptionsVersionValue then BM.OptionsVersionValue:SetTextColor(unpack(BM.Theme.text)) end
end






