local RUI = LibStub("RUI-1.0")
if not RUI then return end

-- RUI.Section(parent, title, width, height) → Frame
-- A standalone labeled group box: PANEL background + GOLD 1px border + title text.
-- Use when you need a self-contained sub-frame to lay widgets on directly.
-- For the y-cursor Builder pattern use b:BeginSection() / b:EndSection() instead.
function RUI.Section(parent, title, width, height)
    local f = CreateFrame("Frame", nil, parent)
    f:SetSize(width, height)

    RUI.Draw.Background(f, RUI.C.PANEL)
    RUI.Draw.Border(f, RUI.C.GOLD)

    if title and title ~= "" then
        local fs = f:CreateFontString(nil, "ARTWORK")
        RUI.Draw.SetFont(fs, RUI.F.SMALL)
        fs:SetTextColor(RUI.C.DIM.r, RUI.C.DIM.g, RUI.C.DIM.b)
        fs:SetPoint("TOPLEFT", f, "TOPLEFT", 8, -5)
        fs:SetText(title)
    end

    return f
end
