@import '../abstracts/variables';

.treeview {
    margin: 0px;
    padding: 0px;
    list-style: none;
    overflow: auto;

    @each $color in $palette-colors {
        &.treeview-selected-#{$color} {
            .treeview-item-content.treeview-item-selected {
                color: var(--palette-#{$color});
                background-color: var(--palette-#{$color}-hover);
            }
        }
    }

    @each $color in $palette-colors {
        &.treeview-checked-#{$color} {
            .treeview-item-checkbox {
                .button-root.icon-button {
                    color: var(--palette-#{$color});
                }
            }
        }
    }
}

.treeview-group {
    margin: 0px;
    padding: 0px;
    margin-left: 17px;
    margin-inline-start: 17px;
    margin-inline-end: unset;
    list-style: none;
}

.treeview-item {
    margin: 0;
    outline: 0;
    padding: 0;
    cursor: default;
    list-style: none;
    min-height: 2rem;
    align-items: center;
    -webkit-tap-highlight-color: transparent;

    .treeview-item-arrow, .treeview-item-checkbox {
        .icon-button {
            padding: 4px;
        }
    }
}

.treeview-item-content {
    width: 100%;
    display: flex;
    padding: 4px 8px;
    align-items: center;
    transition: background-color 150ms cubic-bezier(.4,0,.2,1) 0ms;
}

.treeview-hover .treeview-item-content:hover {
    background-color: var(--palette-action-default-hover);
}

.treeview-item-arrow {
    width: 2rem;
    display: flex;
    flex-shrink: 0;
    margin: 0 4px;
    min-height: 32px;
    justify-content: center;

    .treeview-item-arrow-expand {
        transition: .3s cubic-bezier(.25,.8,.5,1),visibility 0s;

        &.transform {
            transform: rotate(90deg);
        }
    }

    .treeview-item-arrow-load {
        animation: rotation 1s infinite linear;
    }
}

.treeview-item-icon {
    width: 32px;
    display: flex;
    flex-shrink: 0;
    margin-right: 4px;
    margin-inline-end: 4px;
    margin-inline-start: unset;
    justify-content: center;
}

.treeview-item-label {
    flex-grow: 1;
    padding-left: 4px;
    padding-right: 4px;
}

.treeview-dense {
    .treeview-item {
        min-height: unset;
    }

    .treeview-item-content {
        padding: 1px 4px;
    }

    .treeview-item-arrow {
        min-height: unset;
    }

    .icon-button {
        padding: 0;
    }
}

@keyframes rotation {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(359deg);
    }
}

.application-layout-rtl {
    .treeview-item-arrow {
        transform: scaleX(-1);
    }
}