@use "mixins";

/**
 * Copyright JS Foundation and other contributors, http://js.foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/


#red-ui-palette{
    position: absolute;
    top: 0px;
    bottom: 0px;
    left:0px;
    background: var(--red-ui-primary-background);
    width: 180px;
    text-align: center;
    @include mixins.disable-selection;
    @include mixins.component-border;
    transition: width 0.2s ease-in-out;

    &:before {
        content: '';
        top: 0px;
        bottom: 0px;
        right: 0px;
        width: 7px;
        height: 100%;
        z-index: 4;
        position: absolute;
        -webkit-mask-image: url(images/grip.svg);
        mask-image: url(images/grip.svg);
        -webkit-mask-size: auto;
        mask-size: auto;
        -webkit-mask-position: 50% 50%;
        mask-position: 50% 50%;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        background-color: var(--red-ui-grip-color);
    }
}

.red-ui-palette-closed {
    #red-ui-palette {
        width: 8px;
        .red-ui-component-footer {
            display: none;
        }
    }
    #red-ui-palette-search { display: none; }
    #red-ui-palette-container { display: none; }
}

.red-ui-palette-scroll {
    position: absolute;
    top: 35px;
    right: 0;
    bottom: 25px;
    left:0;
    padding: 0;
    overflow-y: auto;
    box-sizing:border-box;
}
#red-ui-palette> .red-ui-palette-spinner {
    padding-top: 80px;
}
.red-ui-palette-search {
    position: relative;
    // overflow: hidden;
    background: var(--red-ui-form-input-background);
    text-align: center;
    height: 35px;
    padding: 3px;
    border-bottom: 1px solid var(--red-ui-primary-border-color);
    box-sizing:border-box;
}

.red-ui-palette-category {
    border-bottom: 1px solid var(--red-ui-secondary-border-color);
}
.red-ui-palette-content {
    background: var(--red-ui-palette-content-background);
    padding: 3px;
}

.red-ui-palette-header {
    position: relative;
    background: var(--red-ui-palette-header-background);
    color: var(--red-ui-palette-header-color);
    cursor: pointer;
    text-align: left;
    padding: 9px;
    font-weight: bold;
    padding-left: 30px;
    overflow: hidden;
    user-select: none;
    &:hover {
        background: var(--red-ui-palette-header-background) !important;
    }
}
.red-ui-palette-header > i {
    position: absolute;
    left: 11px;
    top: 12px;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
}
.red-ui-palette-header i.expanded {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
}
.red-ui-palette-header span {
    clear: both;
}
.red-ui-palette-label {
    color: var(--red-ui-node-label-color);
    font-size: 13px;
    margin: 4px 0 4px 32px;
    line-height: 20px;
    overflow: hidden;
    text-align: center;
    @include mixins.disable-selection;
}
.red-ui-palette-label-right {
    margin: 4px 32px 4px 0;
}

.red-ui-palette-node {
    // display: inline-block;
    cursor: move;
    background: var(--red-ui-secondary-background);
    margin: 10px auto;
    height: 25px;
    border-radius: 5px;
    border: 1px solid var(--red-ui-node-border);
    background-position: 5% 50%;
    background-repeat: no-repeat;
    width: 120px;
    background-size: contain;
    position: relative;
    z-index: 4;
    &:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):first-child {
        margin-top: 15px;
    }
    &:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):last-child {
        margin-bottom: 15px;
    }
}
.red-ui-palette-node:hover {
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--red-ui-node-selected-color);
}
.red-ui-palette-port {
    position: absolute;
    top:8px;
    left: -5px;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    background: var(--red-ui-node-port-background);
    border-radius: 3px;
    width: 10px;
    height: 10px;
    border: 1px solid var(--red-ui-node-border);
}
.red-ui-palette-port-output {
    left:auto;
    right: -6px;
}

.red-ui-palette-node:hover .red-ui-palette-port {
    background-color: var(--red-ui-node-port-background-hover);
}
.red-ui-palette-icon-container {
    position: absolute;
    text-align: center;
    top:0;
    bottom:0;
    left:0;
    width: 30px;
    border-right: 1px solid var(--red-ui-node-icon-background-color);
    border-radius: 4px 0px 0px 4px;
    background-color: var(--red-ui-node-icon-background-color);
}
.red-ui-palette-icon-container-right {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--red-ui-node-icon-background-color);
    border-radius: 0px 4px 4px 0px;
}
.red-ui-palette-icon {
    display: inline-block;
    width: 20px;
    height: 100%;
    background-position: 50% 50%;
    background-size: contain;
    background-repeat: no-repeat;
}
.red-ui-search-result-node {
    &.red-ui-palette-icon-flow,
    &.red-ui-palette-icon-group,
    &.red-ui-palette-icon-junction,
    &.red-ui-palette-icon-selection {
        background: none;
        border-color: transparent;
        .red-ui-palette-icon-container {
            background: none;
        }
        .red-ui-palette-icon-fa {
            color: var(--red-ui-secondary-text-color);
            font-size: 18px;
        }
    }
}
.red-ui-palette-icon-fa {
    color: white;
    position: absolute;
    top: calc(50% - 7px);
    left: 3px;
}
.red-ui-palette-node-small {
    display: inline-block;
    position: relative;
    width: 18px;
    height: 15px;
    margin: 3px 0px;
    vertical-align: middle;
    cursor: default;

    .red-ui-palette-icon-container {
        width: 18px;
        border-right: none;
    }
    .red-ui-palette-icon {
        margin-left: -1px;
        width: 15px;
    }
    .red-ui-palette-icon-fa {
        top: 2px;
        left: 1px;
    }
}

////////////////

.red-ui-node-list-item {
    display: inline-block;
    padding: 0;
    font-size: 13px;
    border: none;
}
.red-ui-node-icon {
    display: inline-block;
    width: 24px;
    height: 20px;
    line-height: 20px;
    margin-top: 1px;
    // width: 30px;
    // height: 25px;
    border-radius: 3px;
    border: 1px solid var(--red-ui-node-border);
    background-position: 5% 50%;
    background-repeat: no-repeat;
    background-size: contain;
    position: relative;
    background-color: var(--red-ui-node-icon-background-color);
    text-align: center;

    .red-ui-palette-icon {
        width: 20px;
    }

    .red-ui-palette-icon-fa {
        font-size: 14px;
        position: relative;
        top: -1px;
        left: 0px;
    }

    &.red-ui-palette-icon-flow,
    &.red-ui-palette-icon-group,
    &.red-ui-palette-icon-junction,
    &.red-ui-palette-icon-selection {
        background: none;
        border-color: transparent;
        .red-ui-palette-icon-container {
            background: none;
        }
        .red-ui-palette-icon-fa {
            color: var(--red-ui-secondary-text-color);
            font-size: 16px;
        }
    }


}
.red-ui-node-icon-container {
    display: inline-flex;
    align-items: center;
}
.red-ui-node-icon-container.red-ui-node-icon-small {
    .red-ui-node-icon {
        width: 18px;
        height: 15px;
        line-height: 15px;
        .red-ui-palette-icon {
            width: 15px;
        }
        .red-ui-palette-icon-fa {
            font-size: 11px;
        }
        .red-ui-icons-flow {
            width: 14px;
        }
        &.red-ui-palette-icon-flow {
            margin-top: -2px;
        }
        &.red-ui-palette-icon-junction .red-ui-palette-icon-fa,
        &.red-ui-palette-icon-group .red-ui-palette-icon-fa {
            font-size: 14px;
        }
    }
    .red-ui-node-label {
    }
}

.red-ui-node-label {
    white-space: nowrap;
    margin-left: 4px;
    color: var(--red-ui-secondary-text-color);
}
