-------------------------
-- AiB Theme System
-------------------------
-- Nur Dark Theme (Classic)

AiB = AiB or {}
AiB.Themes = {}

-- Theme Definition (nur Dark)
AiB.Themes.List = {
    ["Dark"] = {
        name = "Dark (Classic)",
        colors = {
            -- Backgrounds (transparenter)
            bg_primary = {0.1, 0.1, 0.1, 0.95},
            bg_secondary = {0, 0, 0, 0.5},        -- Viel transparenter!
            bg_tertiary = {0.2, 0.2, 0.2, 1},
            
            -- Borders
            border_primary = {1, 1, 1, 1},
            border_secondary = {0.5, 0.5, 0.5, 1},
            border_accent = {0.6, 0, 0, 1},
            
            -- Text
            text_primary = {1, 1, 1, 1},
            text_secondary = {0.8, 0.8, 0.8, 1},
            text_accent = {0.6, 0, 0, 1},
            text_highlight = {1, 0.8, 0, 1},
            
            -- Buttons & Tabs (transparent)
            button_normal = {0.2, 0.2, 0.2, 1},
            button_hover = {0.3, 0.1, 0.1, 1},
            button_active = {0.6, 0, 0, 1},
            
            tab_normal = {0, 0, 0, 0.3},           -- Fast transparent
            tab_hover = {0.2, 0, 0, 0.5},          -- Leicht rot beim Hover
            tab_selected = {0.4, 0, 0, 0.7},       -- Rot wenn ausgewählt
            
            -- Special
            glow_color = {0.6, 0, 0, 0.5},
            shadow_color = {0, 0, 0, 0.8},
        }
    }
}

-- Current Theme (immer Dark)
AiB.Themes.Current = "Dark"

-- Get Color Function
function AiB.Themes:GetColor(colorKey)
    local theme = self.List["Dark"]
    if theme and theme.colors[colorKey] then
        return unpack(theme.colors[colorKey])
    end
    -- Fallback
    return 1, 1, 1, 1
end

-- Apply Theme to Frame
function AiB.Themes:ApplyToFrame(frame, bgType, borderType)
    bgType = bgType or "bg_primary"
    borderType = borderType or "border_primary"
    
    if frame.SetBackdropColor then
        frame:SetBackdropColor(self:GetColor(bgType))
    end
    if frame.SetBackdropBorderColor then
        frame:SetBackdropBorderColor(self:GetColor(borderType))
    end
end

-- Apply Theme to FontString
function AiB.Themes:ApplyToText(fontString, textType)
    textType = textType or "text_primary"
    if fontString.SetTextColor then
        fontString:SetTextColor(self:GetColor(textType))
    end
end

-- Apply Theme to Texture
function AiB.Themes:ApplyToTexture(texture, colorType)
    colorType = colorType or "button_normal"
    if texture.SetColorTexture then
        texture:SetColorTexture(self:GetColor(colorType))
    elseif texture.SetVertexColor then
        texture:SetVertexColor(self:GetColor(colorType))
    end
end

-- Create Glassmorphism Effect
function AiB.Themes:CreateGlassEffect(frame)
    if not frame.glassOverlay then
        frame.glassOverlay = frame:CreateTexture(nil, "OVERLAY")
        frame.glassOverlay:SetAllPoints(true)
        frame.glassOverlay:SetColorTexture(1, 1, 1, 0.03)
        frame.glassOverlay:SetBlendMode("ADD")
    end
    
    if not frame.glassGradient then
        frame.glassGradient = frame:CreateTexture(nil, "BORDER")
        frame.glassGradient:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1)
        frame.glassGradient:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -1, -100)
        frame.glassGradient:SetColorTexture(1, 1, 1, 0.05)
        frame.glassGradient:SetGradient("VERTICAL", 
            CreateColor(1, 1, 1, 0.08), 
            CreateColor(1, 1, 1, 0))
    end
end

-- Initialize Theme System
function AiB.Themes:Initialize()
    self.Current = "Dark"
    AiB.Config:Log("Themes", "Initialized with Dark theme")
end


