import QtQuick
import QtQuick.Layouts

RowLayout {
    spacing: Theme.spacing

    Repeater {
        model: niri.workspaces

        // Container com largura fixa — o layout nunca muda
        Item {
            required property var modelData

            readonly property bool focused:  modelData.isFocused
            readonly property bool occupied: modelData.activeWindowId !== null

            width:  24
            height: 8

            Rectangle {
                anchors.centerIn: parent
                height: parent.height
                radius: height / 2

                width: parent.focused ? 20 : 8
                color: {
                    if (parent.focused)  return Theme.accent
                    if (parent.occupied) return Theme.subtle
                    return Theme.muted
                }

                Behavior on width {
                    NumberAnimation { duration: 150; easing.type: Easing.OutCubic }
                }
                Behavior on color {
                    ColorAnimation { duration: 150 }
                }
            }

            MouseArea {
                anchors.fill: parent
                cursorShape:  Qt.PointingHandCursor
                onClicked:    niri.focusWorkspaceById(modelData.id)
            }
        }
    }
}
