if not AiB_Content then AiB_Content = {} end

AiB_Content["Vexie Fullthrottle and the The Geargrinders"] = function(frame)
    -- Erst ein Child-Frame erstellen, damit beim Tab-Wechsel alles entfernt wird
    local container = CreateFrame("Frame", nil, frame)
    container:SetAllPoints()

    -- Titel für den Tab
    local title = container:CreateFontString(nil, "OVERLAY")
    title:SetFont("Fonts\\ARIALN.TTF", 14, "OUTLINE")
    title:SetText("Vexie Fullthrottle and the The Geargrinders")
    title:SetTextColor(1, 1, 1, 1)
    title:SetPoint("TOP", container, "TOP", 0, -20)

    -- Web-URLs für Buttons
    local links = {
        { name = "Boss-Taktik", url = "https://wowhead.com/vexie-fullthrottle" },
        { name = "Log-Analyse", url = "https://warcraftlogs.com/vexie-logs" },
        { name = "Raid-Planung", url = "https://raidplaner.de" }
    }

    local startY = -80  -- Startposition für die Buttons

    for i, link in ipairs(links) do
        -- Button erstellen
        local urlButton = CreateFrame("Button", nil, container, "UIPanelButtonTemplate")
        urlButton:SetText(link.name)
        urlButton:GetFontString():SetTextColor(1, 1, 1)
        urlButton:SetSize(160, 30)

        -- Hintergrundfarbe setzen
        urlButton:SetNormalFontObject("GameFontNormal")
        urlButton:SetHighlightFontObject("GameFontHighlight")

        -- Button-Position
        if i == 1 then
            urlButton:SetPoint("TOP", container, "TOP", 0, startY)
        else
            urlButton:SetPoint("TOP", container, "TOP", 0, startY - ((i - 1) * 35))
        end

        -- Klick-Handler: Popup-Fenster erzeugen
        urlButton:SetScript("OnClick", function()
            if AiB_LinkPopup then
                AiB_LinkPopup:Hide()
            end

-- Popup auf "UIParent" erstellen, damit es eigenständig ist
local popup = CreateFrame("Frame", "AiB_LinkPopup", UIParent, "BackdropTemplate")
popup:SetSize(500, 200)
popup:SetPoint("CENTER")
popup:SetFrameStrata("FULLSCREEN_DIALOG")  -- Priorität hochsetzen
popup:SetFrameLevel(100)
popup:SetToplevel(true)  -- Immer oben halten
popup:SetMovable(true)
popup:EnableMouse(true)
popup:RegisterForDrag("LeftButton")
popup:SetScript("OnDragStart", popup.StartMoving)
popup:SetScript("OnDragStop", popup.StopMovingOrSizing)
popup:Raise() -- In den Vordergrund bringen

            -- Design
            popup:SetBackdrop({
                bgFile = "Interface\\Buttons\\WHITE8x8",
                edgeFile = "Interface\\Buttons\\WHITE8x8",
                edgeSize = 2,
                insets = { left = 2, right = 2, top = 2, bottom = 2 }
            })
            popup:SetBackdropBorderColor(1, 1, 1, 1)
            popup:SetBackdropColor(0.2, 0.2, 0.2, 1)

            -- Titel
            local popupTitle = popup:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
            popupTitle:SetPoint("TOP", popup, "TOP", 0, -10)
            popupTitle:SetText("Kopiere den Link")

            -- Eingabefeld für den Link
            local editBox = CreateFrame("EditBox", nil, popup, "InputBoxTemplate")
            editBox:SetSize(400, 30)
            editBox:SetPoint("CENTER", popup, "CENTER", 0, 20)
            editBox:SetAutoFocus(true)
            editBox:SetText(link.url)
            editBox:HighlightText()

            -- Schließen-Button oben rechts
            local closeButton = CreateFrame("Button", nil, popup, "UIPanelCloseButton")
            closeButton:SetPoint("TOPRIGHT", popup, "TOPRIGHT", -5, -5)
            closeButton:SetScript("OnClick", function() popup:Hide() end)

            -- Schließen-Schaltfläche unten
            local closeButtonBottom = CreateFrame("Button", nil, popup, "UIPanelButtonTemplate")
            closeButtonBottom:SetSize(140, 40)
            closeButtonBottom:SetText("Schließen")

            -- Stil
            local buttonBg = closeButtonBottom:CreateTexture(nil, "BACKGROUND")
            buttonBg:SetColorTexture(0.2, 0.2, 0.2, 1)
            buttonBg:SetAllPoints()
            closeButtonBottom:SetNormalTexture(buttonBg)

            local buttonText = closeButtonBottom:CreateFontString(nil, "OVERLAY")
            buttonText:SetFont("Fonts\\ARIALN.TTF", 18, "OUTLINE")
            buttonText:SetTextColor(0.6, 0, 0, 1)
            buttonText:SetText("Schließen")
            buttonText:SetPoint("CENTER", closeButtonBottom, "CENTER")
            closeButtonBottom:SetFontString(buttonText)
            closeButtonBottom:SetPoint("BOTTOM", popup, "BOTTOM", 0, 10)

            closeButtonBottom:SetScript("OnClick", function() popup:Hide() end)

            -- Kopieren & Escape
            editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
            editBox:SetScript("OnEnterPressed", function(self) self:HighlightText() end)

            AiB_LinkPopup = popup
        end)
    end
end
