/**
 * 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-diff-panel {
    padding: 5px;
    padding-top: 30px;
    position: relative;

    .red-ui-editableList-container {
        border-radius:1px;
        padding:0;
        background: var(--red-ui-tertiary-background);
    }
    .red-ui-diff-list {
        li {
            background: var(--red-ui-tertiary-background);
            padding: 0px;
            border: none;
            min-height: 0;
        }
    }
    .red-ui-editableList-item-content {
        padding: 5px;
        // padding-bottom: 5px;
    }
}
.red-ui-diff-container {
    position: absolute;
    top: 40px;
    right:0;
    bottom: 0;
    left: 0;
    overflow-y: scroll;
}

.red-ui-diff-panel-headers {
    position: absolute;
    left:232px;
    right:12px;
    top: 5px;
    height: 25px;
    div {
        height: 25px;
        display: inline-block;
        box-sizing: border-box;
        padding-top: 2px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 50%;
        background: var(--red-ui-tertiary-background);
        text-align: center;
        border-top: 1px solid var(--red-ui-secondary-border-color);
        border-color:var(--red-ui-secondary-border-color);
        border-left: 1px solid var(--red-ui-secondary-border-color);
    }
    div:last-child {
        border-right: 1px solid var(--red-ui-secondary-border-color);
    }
}

.red-ui-diff-dialog-toolbar {
    box-sizing: border-box;
    color: var(--red-ui-secondary-text-color);
    text-align: right;
    padding: 8px 10px;
    background: var(--red-ui-primary-background);
    border-bottom: 1px solid var(--red-ui-secondary-border-color);
    white-space: nowrap;
}
.red-ui-diff-list-flow {
    background: var(--red-ui-secondary-background);
    border: 1px solid var(--red-ui-secondary-border-color);
    border-radius: 1px;
    overflow: hidden;

    &.collapsed {
        .red-ui-diff-list-flow-title .red-ui-diff-list-chevron {
            transform: rotate(-90deg);
        }
        .red-ui-diff-list-node {
            display: none;
        }
    }
}
.red-ui-diff-list-flow-stats {
    font-size: 0.9em;
}

.red-ui-diff-list-chevron {
    display: inline-block;
    width: 15px;
    text-align: center;
    margin-left: 3px;
    transition: transform 0.1s ease-in-out;

}
.red-ui-diff-list-node {
    margin-left: 20px;
    font-size: 0.9em;

    &:first-child {
        border-top: 1px solid var(--red-ui-tertiary-border-color);
    }
    &:not(:last-child) {
        border-bottom: 1px solid var(--red-ui-tertiary-border-color);
    }

    &.collapsed {
        .red-ui-diff-list-chevron {
            transform: rotate(-90deg);
        }
        .red-ui-diff-list-node-properties {
            display: none;
        }
    }
    &:not(.collapsed) {
        .red-ui-diff-list-node-cell:not(:first-child) {
            //display: none;
        }
        .red-ui-diff-list-node-cell:first-child {
            //width: 100%
        }
    }

    table {
        border-collapse: collapse;
        table-layout:fixed;
        width: calc(100% - 20px);
        margin-left: 20px;
    }
    col:first-child {
        width: 180px;
    }
    col:not(:first-child) {
        width: 100%;
    }
    td, th {
        border-top: 1px solid var(--red-ui-secondary-border-color);
        border-left: 1px solid var(--red-ui-secondary-border-color);
        &:first-child {
            border-left: none;
        }
        padding: 0 0 0 3px;
        text-align: left;
        overflow-x: auto;
    }
    tr {
        vertical-align: top;
        &:first-child td {
            white-space:nowrap;
            overflow:hidden;
        }
        &:hover {
            background: var(--red-ui-secondary-background-selected);
        }

    }

    td  {
        .red-ui-diff-status {
            margin-left: 0;
        }
    }
    tr:not(.red-ui-diff-list-header) {
        .red-ui-diff-status {
            width: 12px;
            margin-left: 0;
            margin-top: 0;
            margin-bottom: 0;
            margin-right: 5px;
        }
    }
}
.red-ui-diff-three-way {
    .red-ui-diff-list-node-cell {
        width: calc((100% - 220px) / 2);
        &:first-child {
            width: 220px;
        }
    }
    col:not(:first-child) {
        width:50%;
    }

    .red-ui-diff-list-node {
        .red-ui-diff-list-node-cell {
            width: calc((100% + 20px - 220px) / 2);
            &:first-child {
                width: 200px;
            }

        }
    }
}

.red-ui-diff-list-flow-title {
    cursor: pointer;
    padding: 0;
    &:hover {
        background: var(--red-ui-secondary-background-selected);
    }
}
.red-ui-diff-list-flow-title-meta {
    vertical-align: middle;
    display: inline-block;
    padding-top: 2px;
}
.red-ui-diff-list-node-header {
    cursor: pointer;
    &:hover {
        background: var(--red-ui-secondary-background-selected);
    }
}
.red-ui-diff-list-node-icon {
    vertical-align: middle;
    display: inline-block;
    margin: 5px;
    width: 18px;
    height: 15px;
    background: var(--red-ui-form-input-background);
    border-radius: 2px;
    border: 1px solid var(--red-ui-node-border);
    background-position: 5% 50%;
    background-repeat: no-repeat;
    background-size: contain;
    position: relative;

    .red-ui-palette-icon {
        background-position: 49% 50%;
        width: 15px;
    }
    .red-ui-palette-icon-fa {
        position: relative;
        top: -2.5px;
        left: 0px;
    }
    .red-ui-palette-icon-container {
        width: 18px;
    }
}
.red-ui-diff-list-flow-empty {
    .red-ui-diff-list-chevron i {
        display: none;
    }
    .red-ui-diff-list-flow-title {
        cursor: default;
        &:hover {
            background: none;
        }
    }
}
.red-ui-diff-status-deleted {
    cursor: default !important;
    .red-ui-diff-status {
        color: var(--red-ui-diff-state-deleted);
    }
    .red-ui-diff-list-node-node {
        opacity: 0.5;
    }
    .red-ui-diff-list-node-description {
        opacity: 0.5;
        text-decoration: line-through;
    }
}
.red-ui-diff-status-added {
    cursor: default !important;
    .red-ui-diff-status {
        color: var(--red-ui-diff-state-added);
    }
}
.red-ui-diff-status-moved {
    .red-ui-diff-status {
        color: var(--red-ui-diff-state-moved);
    }
}

.red-ui-diff-status-changed {
    .red-ui-diff-status {
        color: var(--red-ui-diff-state-changed);
    }
}
.red-ui-diff-status-unchanged {
    .red-ui-diff-status {
        color: var(--red-ui-diff-state-unchanged);
    }
}
.red-ui-diff-status-conflict {
    .red-ui-diff-status {
        color: var(--red-ui-diff-state-conflict);
    }
}
.red-ui-diff-list-node-title {
    display: inline-block;
    .red-ui-diff-status {
        margin-left: 15px;
    }
}
.red-ui-diff-list-node-properties {
    margin: 0;
    color: var(--red-ui-primary-text-color);
}
.red-ui-diff-status {
    display: inline-block;
    height: 20px;
    margin-left: 5px;
    vertical-align: top;
    margin-top: 6px;
    margin-bottom: 6px;
    text-align: center;
}
.red-ui-diff-list-element {
    display: inline-block;
    width: calc(100% - 20px);
}

.red-ui-diff-list-node-description {
    color: var(--red-ui-form-text-color);
    margin-right: 5px;
    padding-top: 5px;
    display: inline-block;
    &:after {
        content: "";
        display: table;
        clear: both;
    }
}

.red-ui-diff-state-added { color: var(--red-ui-diff-state-added); }
.red-ui-diff-state-deleted { color: var(--red-ui-diff-state-deleted); }
.red-ui-diff-state-changed { color: var(--red-ui-diff-state-changed); }
.red-ui-diff-state-unchanged { color: var(--red-ui-diff-state-unchanged); }
.red-ui-diff-state-conflicted { color: var(--red-ui-diff-state-conflicted); }


.red-ui-diff-list-node-cell {
    display: inline-block;
    vertical-align: top;
    box-sizing: border-box;
    width: calc( (100% - 20px) / 2);
    height: 32px;
    border-left: 1px solid var(--red-ui-secondary-border-color);
    padding-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}
.red-ui-diff-empty {
    background: var(--red-ui-secondary-background-disabled);
    background: repeating-linear-gradient(
        20deg,
        var(--red-ui-secondary-background), var(--red-ui-secondary-background) 5px,
        var(--red-ui-secondary-background-disabled) 5px,
        var(--red-ui-secondary-background-disabled) 10px
        );
}
.red-ui-diff-list-node-cell:first-child {
    border-left: none;
}
.red-ui-diff-list-cell-label {
    margin-left: 20px;
    vertical-align: top;
    box-sizing: border-box;
    padding-left: 8px;
    width: 120px;
}
.red-ui-diff-list-wires {
    display: inline-block;
    .red-ui-diff-list-node-node {
        width: 18px;
        height: 15px;
    }
    .red-ui-palette-icon-container {
        width: 18px;
    }
    .red-ui-palette-icon {
        width: 15px;
    }
    ul,li,ol {
        background: none !important;
    }
    ul {
        vertical-align: middle;
        display: inline-block;
        margin-left: 5px;
    }
    li {
        list-style-type: none !important;
    }
    ol {
        font-size: 0.9em;
        margin: 0;
        & > span {
            vertical-align: middle;
            display: inline-block;
            width: 30px;
            text-align: center;
        }
    }

}
.red-ui-diff-list-node-props .red-ui-diff-list-node-cell:first-child {
    padding: 6px 0px;
    span:not(.red-ui-diff-list-chevron) {
        margin-left: 5px;
    }

}
.red-ui-diff-list-cell {
    .red-ui-debug-msg-row:hover {
        background: none;
    }
    &.red-ui-diff-status-changed {
        background: var(--red-ui-diff-state-changed-background);
    }
    &.red-ui-diff-status-conflict {
        background: var(--red-ui-diff-state-conflict-background);
    }
}

label.red-ui-diff-selectbox {
    position: absolute;
    top:0;
    right:0;
    bottom:0;
    width: 35px;
    text-align: center;
    border-left: 1px solid var(--red-ui-secondary-border-color);
    margin:0;
    input[type="radio"] {
        margin-top: 8px;
    }

    &:hover {
        background: var(--red-ui-secondary-background-hover);
    }
}

.red-ui-diff-list-node-conflict.red-ui-diff-select-remote {
    .red-ui-diff-list-node-remote {
        background: var(--red-ui-diff-state-added-background);
        label {
            border-left-color: var(--red-ui-diff-state-added-border);
        }
    }
    .red-ui-diff-list-node-local {
        background: var(--red-ui-diff-state-deleted-background);
        label {
            border-left-color: var(--red-ui-diff-state-deleted-border);
        }
    }
}
.red-ui-diff-list-node-conflict.red-ui-diff-select-local {
    .red-ui-diff-list-node-local {
        background: var(--red-ui-diff-state-added-background);
        label {
            border-left-color: var(--red-ui-diff-state-added-border);
        }
    }
    .red-ui-diff-list-node-remote {
        background: var(--red-ui-diff-state-deleted-background);
        label {
            border-left-color: var(--red-ui-diff-state-deleted-border);
        }
    }
}


ul.red-ui-deploy-dialog-confirm-list {
    font-size: 0.9em;
    width: 400px;
    margin: 10px auto;
    text-align: left;
}

.red-ui-deploy-dialog-confirm-conflict-row {
    img {
        vertical-align:middle;
        height: 30px;
        margin-right: 10px;
    }
    i {
        vertical-align:middle;
        text-align: center;
        font-size: 30px;
        width: 30px;
        margin-right: 10px;
        &.fa-check {
            color: var(--red-ui-text-color-success);
        }
        &.fa-exclamation {
            color: var(--red-ui-secondary-text-color);
        }
    }
    div {
        vertical-align: middle;
        width: calc(100% - 60px);
        display:inline-block;
    }
}

#red-ui-diff-dialog-toolbar-resolved-conflicts .red-ui-diff-status {
    margin:0;
}
.red-ui-diff-text-diff-button {
    float: right;
    margin: 2px 3px;
    line-height: 14px;
    height: 16px;

}
.red-ui-diff-text {
    height: 100%;
    overflow-y:auto;

    table.red-ui-diff-text-content {
        margin: 10px;
        border: 1px solid var(--red-ui-secondary-border-color);
        border-radius: 3px;
        table-layout: fixed;
        width: calc(100% - 20px);
        td {
            vertical-align: top;
            word-wrap: break-word;
        }
        td.lineno {
            font-family: var(--red-ui-monospace-font);
            text-align: right;
            color: var(--red-ui-tertiary-text-color);
            background: var(--red-ui-tertiary-background);
            padding: 1px 5px;
            &.added {
                background: var(--red-ui-diff-state-added-header-background);
            }
            &.removed {
                background: var(--red-ui-diff-state-deleted-header-background);
            }
        }
        td.lineno:nth-child(3) {
            border-left: 1px solid var(--red-ui-secondary-border-color);
        }
        td.linetext {
            font-family: var(--red-ui-monospace-font);
            white-space: pre-wrap;
            padding: 1px 5px;
            border-left: 1px solid var(--red-ui-tertiary-border-color);
            span.prefix {
                width: 30px;
                display: inline-block;
                text-align: center;
                color: var(--red-ui-diff-state-prefix-color);
            }

            &.added {
                border-left-color: var(--red-ui-diff-state-added-header-border);
            }
            &.removed {
                border-left-color: var(--red-ui-diff-state-deleted-header-border);
            }
        }
        td.blank {
            background: var(--red-ui-tertiary-background);
        }
        td.added {
            background: var(--red-ui-diff-state-added-background);
            color: var(--red-ui-diff-state-color);
        }
        td.removed {
            background: var(--red-ui-diff-state-deleted-background);
            color: var(--red-ui-diff-state-color);
        }
        tr.mergeHeader td {
            color: var(--red-ui-diff-merge-header-color);
            background: var(--red-ui-diff-merge-header-background);
            height: 26px;
            vertical-align: middle;
        }
        tr.mergeHeader-separator td {
            color: var(--red-ui-diff-merge-header-color);
            background: var(--red-ui-diff-merge-header-border-color);
            height: 0px;
        }
        tr.mergeHeader-ours td {
            border-top: 2px solid var(--red-ui-diff-merge-header-border-color);
        }
        tr.mergeHeader-theirs td {
            border-bottom: 2px solid var(--red-ui-diff-merge-header-border-color);
        }
        td.unchanged {
            background: var(--red-ui-diff-state-unchanged-background);
            color: var(--red-ui-diff-state-unchanged);
        }
        tr.unchanged {
            background: var(--red-ui-diff-state-unchanged-background);
        }
        tr.start-block {
            border-top: 1px solid var(--red-ui-secondary-border-color);
        }
        tr.end-block {
            border-bottom: 1px solid var(--red-ui-secondary-border-color);
        }
        tr.red-ui-diff-text-file-header td {
            .filename {
                font-family: var(--red-ui-monospace-font);
            }
            background: var(--red-ui-primary-background);
            padding: 5px 10px 5px 0;
            color: var(--red-ui-primary-text-color);
            cursor: pointer;
            i.red-ui-diff-list-chevron {
                width: 30px;
            }
        }
        tr.red-ui-diff-text-file-header.collapsed {
            td i.red-ui-diff-list-chevron {
                transform: rotate(-90deg);
            }
        }
        tr.red-ui-diff-text-commit-header td {
            background: var(--red-ui-primary-background);
            padding: 5px 10px;
            color: var(--red-ui-primary-text-color);
            h3 {
                font-size: 1.4em;
                margin: 0;
            }
            .commit-summary {
                border-top: 1px solid var(--red-ui-secondary-border-color);
                padding-top: 5px;
                color: var(--red-ui-secondary-text-color);
            }
            .commit-body {
                margin-bottom:15px;
                white-space: pre;
                line-height: 1.2em;
            }
        }

        tr.red-ui-diff-text-header > td:not(.red-ui-diff-flow-diff) {
            font-family: var(--red-ui-monospace-font);
            padding: 5px 10px;
            text-align: left;
            color: var(--red-ui-diff-text-header-color);
            background: var(--red-ui-diff-text-header-background);
            height: 30px;
            vertical-align: middle;
            border-top: 1px solid var(--red-ui-secondary-border-color);
            border-bottom: 1px solid var(--red-ui-secondary-border-color);
        }
        tr.red-ui-diff-text-expand td {
            cursor: pointer;
            &:hover {
                background: var(--red-ui-diff-text-header-background);
            }
        }
    }
}
