/**
 * Copyright (c) Enalean, 2016-Present. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

@use "pkg:codemirror/addon/scroll/simplescrollbars";

.pull-request-unidiff {
    height: 100%;

    /* stylelint-disable-next-line selector-class-pattern */
    .CodeMirror-gutter-wrapper:hover > .CodeMirror-gutter-elt {
        background: var(--tlp-main-color);
        color: var(--tlp-white-color);
        font-weight: 600;
        cursor: pointer;
    }
}

.pull-request-side-by-side-diff {
    width: 50%;
    height: 100%;
    float: left;

    /* stylelint-disable-next-line selector-class-pattern */
    .CodeMirror-gutter-elt:hover {
        background: var(--tlp-main-color);
        color: var(--tlp-white-color);
        font-weight: 600;
        cursor: pointer;
    }
}

.pull-request-side-by-side-diff:first-child {
    /* stylelint-disable-next-line selector-class-pattern */
    > .CodeMirror {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
}

.pull-request-side-by-side-diff:last-child {
    /* stylelint-disable-next-line selector-class-pattern */
    > .CodeMirror {
        border-left: 0;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
}

.pull-request-file-diff {
    display: flex;
    flex: 1;
    flex-direction: column;

    > .pull-request-file-diff-bidi-warning {
        flex: 0;
    }

    > .pull-request-file-unidiff,
    > .pull-request-file-side-by-side {
        flex: 1;
    }

    /* stylelint-disable selector-class-pattern */
    .CodeMirror {
        border: 1px solid var(--tlp-neutral-normal-color);
        border-radius: var(--tlp-medium-radius);
    }

    .CodeMirror-gutters {
        border: 0;
    }

    .CodeMirror-gutter {
        min-width: 30px;
        border-right: 1px solid #f6f6f6;
        background: #fdfdfd;
    }

    .CodeMirror-lines {
        font-size: 13px;
        line-height: 20px;
    }

    .CodeMirror-gutter-elt {
        color: #8c8c8c;
        font-size: 11px;
        text-align: center;
    }
    /* stylelint-enable */
}

.pull-request-file-diff-loading {
    height: 50px;
    background: url("../../../../../src/www/themes/BurningParrot/images/spinner.gif") no-repeat
        center center;
}

.pull-request-file-diff-section-collapsed {
    cursor: pointer;
}

.pull-request-file-diff-not-displayable-file {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #dddddd;
    border-radius: var(--tlp-medium-radius);
    color: #cccccc;
    line-height: 40px;
    text-align: center;

    > i {
        font-size: 40px;
    }
}

.pull-request-file-diff-added-lines {
    background-color: #eff8ef;

    /* stylelint-disable-next-line selector-class-pattern */
    + .CodeMirror-gutter-wrapper .CodeMirror-gutter-elt {
        color: #58b359;
    }
}

.pull-request-file-diff-deleted-lines {
    background-color: #ffe6e6;

    /* stylelint-disable-next-line selector-class-pattern */
    + .CodeMirror-gutter-wrapper .CodeMirror-gutter-elt {
        color: #da5353;
    }
}

.pull-request-file-diff-placeholder-block {
    margin: 0 0 0 13px;
    border-left: 3px solid var(--tlp-neutral-normal-color);
}

.inline-comment-element {
    > .pull-request-comment-component,
    > .pull-request-new-comment-component {
        $horizontal-padding: 12px;

        padding: var(--tlp-medium-spacing) $horizontal-padding;
        font-family: var(--tlp-font-family);
    }
}

#files,
.pull-request-file-diff-container,
.pull-request-file-diff-view {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.pull-request-file-diff-pane {
    flex: 1;
    margin: 0;
}
