/**
 * 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:@tuleap/tlp/src/scss/components/tables";
@use "./popovers";

.ttm-definition-step-draggable {
    padding: 5px 0 0;
    background-color: var(--tlp-white-color);

    &:first-child {
        margin: 5px 0 0;
    }

    &:hover {
        .btn,
        .ttm-definition-step-add-bar {
            opacity: 1;
            pointer-events: auto;
        }
    }

    .btn,
    .ttm-definition-step-add-bar {
        margin: 3px 0 0;
        transition: opacity ease-in-out 100ms;
        opacity: 0;
        pointer-events: none;
    }

    .button-commonmark-preview,
    .button-commonmark-syntax-helper {
        margin: 0 0 0 5px;
        opacity: 1;
    }
}

.ttm-definition-step-draggable-drop-before,
.ttm-definition-step-draggable-drop-after {
    position: relative;

    &::before {
        content: "";
        position: absolute;
        width: 100%;
        height: var(--tlp-large-spacing);
        border-radius: var(--tlp-small-radius);
        background: var(--tlp-main-color-transparent-90);
    }
}

.ttm-definition-step-draggable-drop-before {
    padding-top: var(--tlp-large-spacing);

    &::before {
        top: 0;
    }
}

.ttm-definition-step-draggable-drop-after {
    padding-bottom: var(--tlp-large-spacing);

    &::before {
        bottom: 0;
    }
}

.step-definition-drag-icon {
    width: 20px;
    height: 24px;
    padding: 5px 0 0;
    background: url("../drag.png") no-repeat 5px 8px;
}

.ttm-definition-step-add-bar {
    display: flex;
    position: relative;
    justify-content: center;
    transition: opacity ease-in-out 100ms;
    opacity: 0;

    &:hover {
        opacity: 1;
        pointer-events: auto;

        .btn-primary {
            opacity: 1;
            pointer-events: auto;
        }
    }

    .btn-primary {
        margin: 5px 0;
        transition: opacity ease-in-out 100ms;
        opacity: 0;
        pointer-events: none;
    }

    > .btn {
        z-index: 1;
        font-weight: bold;
    }

    &::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        width: 100%;
        height: 1px;
        opacity: 0.5;
        background: var(--tlp-main-color);
    }
}

.ttm-step-definition-navicon {
    position: relative;
    top: 7px;
    padding: 0 6px;

    &:hover {
        cursor: pointer;
    }
}

.draggable-step-description-text {
    max-width: 90%;
    padding: 5px 0 0 6px;

    // stylelint-disable-next-line selector-class-pattern
    > .rte_format {
        margin: 0 0 10px;
    }
}

.draggable-step-definition {
    padding: 0;

    &:hover {
        cursor: move;
    }
}

.ttm-definition-step,
.ttm-execution-step {
    display: flex;
    align-items: flex-start;
}

.ttm-execution-step {
    padding: 10px 0;

    &:last-child {
        padding: 10px 0 0;
    }
}

.ttm-definition-step-rank,
.ttm-execution-step-rank {
    padding: 0 6px;
    border: 1px solid var(--tlp-main-color);
    border-radius: 10px;
    color: var(--tlp-main-color);

    &.ttm-execution-step-rank-edition {
        position: relative;
        top: 3px;
    }
}

.ttm-definition-step-description {
    width: 100%;
    margin: 0 0 0 10px;
}

.ttm-definition-step-description-action > div {
    // stylelint-disable-next-line selector-class-pattern
    > .rte_format {
        margin: 0 0 10px;

        > select {
            margin: 0;
        }
    }

    > textarea {
        margin: 0;
    }
}

.ttm-execution-step-description {
    margin: 0 0 0 10px;
}

.ttm-definition-step-description-format {
    margin: 0 0 0 5px;
}

.ttm-definition-step-expected,
.ttm-execution-step-expected {
    display: flex;
    align-items: baseline;
    margin: 10px 0 0 5px;
}

.ttm-definition-step-expected-arrow,
.ttm-execution-step-expected-arrow {
    margin: 0 5px 0 0;
    fill: #333333;
}

.ttm-definition-step-expected-edit {
    width: 100%;
}

.ttm-definition-step-expected-edit-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: bold;
}

.ttm-execution-step-status {
    margin: 0 0 0 20px;
}

.ttm-definition-step-actions {
    display: flex;
    justify-content: space-between;
    margin: 0 0 10px;
}

.ttm-definition-step-description-deleted {
    text-decoration: line-through;
}

.ttm-definition-step-description-text {
    white-space: pre-line;
}

.ttm-definition-step-expected-results-textarea,
.ttm-definition-step-description-textarea {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
}

.ttm-definition-step-actions-format-and-helper-container {
    display: flex;
    align-items: center;
}
