/******************************************************************************
 * Copyright 2009-2023 Exactpro (Exactpro Systems Limited)
 *
 * 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.
 ******************************************************************************/

@import "./common/vars";

.report {
    width: 100%;
    height: 100%;
    display: grid;
    padding: 0 10px;
    grid-template-rows: 47px 47px 1fr;
    grid-template-columns: 340px 1fr;
    grid-template-areas: "header header"
                         "summary-title controls"
                         "summary testcases";

    &__header {
        grid-area: header;
    }

    &__summary-title {
        grid-area: summary-title;
        display: flex;
        align-items: center;
        padding-left: 2px;
    }

    &__controls {
        grid-area: controls;

        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-left: 20px;
    }

    &__summary {
        grid-area: summary;
        height: 100%;
        overflow: auto;
        @include scrollbar;
    }

    &__testcases {
        grid-area: testcases;
        
        width: 100%;
        height: 100%;
        padding: 0 5px 0 15px;
    }

    &__title {
        font-size:  17px;
        color: $reportTitleTextColor;
        font-weight: bold;
        width: 100%;
        white-space: nowrap;

        &.disabled {
            opacity: 0.7;
            width: auto;
        }

        &.failed {
            width: auto;
            color: $failedTextColor;
        }
    }

    &__known-bugs-button {
        display: flex;
        flex-direction: row;
        padding-left: 10px;
        cursor: pointer;

        &.disabled {
            cursor: default;
            opacity: 0.4;
        }

        &__text {
            color: $primaryTextColor;
            font-weight: bold;
            margin-left: 10px;
            margin-right: 10px;
            white-space: nowrap;

            &.active {
                color: $conditionallyPassedTextColor;
            }
        }

        &__icon {
            width: 22px;
            height: 22px;
            background-size: contain;
            background-position: center;
            background-repeat: no-repeat;

            &.active {
                background-image: url(../../resources/icons/known-bug-reproduced.svg);
            }

            &.disabled {
                background-image: url(../../resources/icons/known-bug-not-reproduced.svg);
            }

            &.enabled {
                background-image: url(../../resources/icons/known-bug-not-reproduced.svg);
            }
        }
    }
}

.report-header {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: $reportHeaderBackground;
    border-radius: 5px;
    position: relative;
    
    &__title {
        color: $primaryTextColor;
        font-size: 20px;
        font-weight: bold;
    }

    &__old-report-link, &__download-report-link {
        position: absolute;
        height: 100%;
        display: flex;
        align-items: center;
        top: 0;
        color: $primaryTextColor;
        font-size: 14px;
        font-weight: bold;
        text-decoration: none;
    }

    &__old-report-link {
        left: 20px;
    }

    &__download-report-link {
        right: 20px;
    }

    &__live-loader {
        @include spinner(3px,20px, 2s);
        margin-right: 5px;
    }
}

.report-summary {
    padding-top: 6px;

    &__card {
        border: 2px solid $reportBorderColor;
        border-radius: 5px;
        padding: 15px;
        margin-bottom: 12px;
        height: 100%;
    }

    &__logo {
        margin: 10px;
        height: 66px;
        width: 203px;
        background: url(../../resources/icons/sf-logo.svg);
        background-size: 100%;
        background-repeat: no-repeat;
    }

    &__element {
        width: 100%;
        padding: 5px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
    }

    &__vertical_element {
        width: 100%;
        padding: 15px 0;
        display: flex;
        align-items: flex-end;
        flex-direction: column;
    }

    &__button_text {
        font-style: normal;
        font-weight: 600;
        font-size: 12px;
        line-height: 22px;
        white-space: nowrap;

        display: flex;
        align-items: center;
        text-align: center
    }

    &__element-title {
        font-size: 13px;
        color: $secondaryTextColor;
    }

    &__element-value {
        @include status-text;
        font-size: 15px;
        color: $primaryTextColor;

        &.bold {
            font-weight: bold;
        }
    }

    &__divider {
        border: 1px solid $reportBorderColor;
        margin: 10px 0;
    }

    &__tags-header {
        margin-bottom: 5px;
    }

    &__block {
        margin-top: 30px;
    }

    &__alerts {
        margin-top: 10px;
    }

    
}

.run-information {
    
    &__element {
        width: 100%;
        padding: 5px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
    }

    &__element-title {
        font-size: 13px;
        color: $secondaryTextColor;
    }

    &__element-value {
        @include status-text;
        font-size: 15px;
        color: $primaryTextColor;

        &.bold {
            font-weight: bold;
        }
    }
}

.log-button {
    display: flex;
    justify-content: space-between;
    align-items: baseline;

    &__chip {
        margin-left: 12px;
        border-radius: 5px;
        width: 12px;
        height: 12px;

        &.error {
            background: #E23636;
        }

        &.warning {
            background: #F57A3D;
        }

        &.hidden {
            display: none;
        }
    }
}

.ml-stats {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-left: 20px;

    &__title {
        @include unselectable;
        font-weight: 600;
        font-size: 14px;
        line-height: 19px;
        color: #45A155;
        white-space: nowrap;
        margin-right: 8px;
    }

    &__bar {
        width: 200px;
        height: 10px;
        background-color: #CCCCCC;
    }

    &__progress-bar {
        background-color: #59B368;
        height: 100%;
    }

    &__bar, &__progress-bar {
        border-radius: 5px;
    }

    &__percents {
        @include unselectable;
        margin-left: 8px;
        font-weight: 600;
        font-size: 14px;
        line-height: 19px;
        text-align: right;

        color: #3D994D;
    }

    &.hidden {
        display: none;
    }
}

.tc-card {
    @include status-card-with-running;

    width: 100%;
    display: grid;
    grid-template: auto auto / 55px 1fr auto;
    grid-template-areas: "index title status ml"
                        "index info elapsed-time ml"
                        "divider divider divider ml"
                        "bugs-indicator bugs-summary bugs-summary ml";

    border: 2px solid var(--status-secondary-border-color);
    border-radius: 5px;

    font-size: 17px;
    padding: 7px 10px 7px 0;
    margin: 6px 15px 6px 0;
    cursor: pointer;

    &:hover {
        background-color: var(--status-secondary-background-color);
        border-color: var(--status-primary-border-color);
    }

    &.selected {
        border-color: var(--status-primary-border-color);
        background-color: var(--status-secondary-background-color);
    }

    &__index {
        grid-area: index;
        display: flex;
        justify-content: center;
        align-items: center;
        color: $secondaryTextColor;
        font-weight: bold;
    }

    &__live-loader {
        @include spinner(3px, 18px, 2s);
        margin-right: 5px;
    }

    &__title {
        grid-area: title;

        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    &__name {
        color: var(--status-primary-color);
        font-weight: bold;
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }

    &__description {
        color: var(--status-primary-color);
        padding-left: 5px;
        opacity: 0.7;
    }
    
    &__info {
        grid-area: info;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        font-size: 13px;
    }
    
    &__info-element {
        margin-right: 15px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    &__info-title {
        color: $secondaryLightTextColor;
    }
    
    &__info-value {
        color: $secondaryTextColor;
        padding-left: 15px;
    }

    &__ml-submitted {
        margin-left: 16px;
        grid-area: ml;
        align-self: center;

        &.icon {
            @include icon(url(../../resources/icons/ml-message-submitted.svg), 22px, 22px);
        }

        &.hidden {
            display: none;
        }
    }

    &__status {
        grid-area: status;
    }

    &__elapsed-time {
        grid-area: elapsed-time;
    }

    &__status, &__elapsed-time {
        color: var(--status-primary-color);
        font-weight: bold;
        display: flex;
        justify-content: flex-end;
    }

    &__divider {
        grid-area: divider;
        border: 1px solid $reportBorderColor;
        margin: 10px 0 10px 20px;
    }
}

.tc-error {
    background-color: $errorMsgBackgroundColor;
    height: 40px;
    width: 100%;
    border-radius: 4px;
    margin-bottom: 10px;

    &__message {
        color: white;
        font-weight: 600;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
    }

    &__message-text {
        color: inherit;
        font-weight: inherit;
        margin: 0 15px;
    }

    &__attention-icon {
        background-image: url("../../resources/icons/attention-error.svg");
        background-repeat: no-repeat;
        height: 26px;
        width: 24px;
    }

    &__refresh-icon {
        background-image: url("../../resources/icons/refresh.svg");
        background-repeat: no-repeat;
        height: 24px;
        width: 22px;
        margin-right: 10px;
    }

    &__refresh-button {
        display: flex;
        align-items: center;
        cursor: pointer;
    }

    &__refresh-text {
        color: inherit;
        font-weight: inherit;
    }
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background-color:  $tcLoaderBackgroundColor;
    margin-bottom: 10px;
    
    &__filler {
        background-color: $tcLoaderPrimaryColor;
        height: 100%;
        border-radius: inherit;
        max-width: 100%;
    }
}
