/**
 * Copyright (c) Enalean, 2018-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 "./backlog-item-moves";

.backlog-item {
    &.gu-transit {
        border-radius: var(--tlp-medium-radius);
        border-color: transparent;
        opacity: 1;
        background: var(--tlp-neutral-normal-color);
        box-shadow: none;

        > .backlog-item-show-children,
        > .backlog-item-details {
            visibility: hidden;
        }
    }

    &.gu-mirror {
        height: auto !important;
        opacity: 1;

        > .backlog-item-show-children {
            display: none;
        }

        > .backlog-item-details {
            @extend %hide-moves-icons;
        }
    }

    &.appending-child {
        > .backlog-item-details {
            border: 1px solid var(--tlp-info-color);
            background: var(--tlp-info-color-transparent-90);
        }
    }

    &[data-nodrag="true"] > .backlog-item-details {
        @extend %hide-moves-icons;

        cursor: auto;
    }
}

.backlog-item-details {
    &.selected {
        transition:
            border-color 75ms ease-in-out,
            background-color 75ms ease-in-out;
        border-color: var(--tlp-info-color);
        background: var(--tlp-info-color-transparent-90);
    }

    &.shaking {
        transition:
            border-color 75ms ease-in-out,
            background-color 75ms ease-in-out;
        animation: shake 750ms ease-in-out;
        border-color: var(--tlp-danger-color);
        background-color: var(--tlp-danger-color-transparent-90);
    }

    &.multiple {
        &::before,
        &::after {
            content: "";
            visibility: visible;
            position: absolute;
            z-index: -1;
            top: 0;
            width: 100%;
            height: 100%;
            border-radius: 3px;
            background: var(--tlp-white-color);
            box-shadow: var(--tlp-flyover-shadow);
        }

        &::before {
            animation: stacked-first-card 100ms ease-in-out forwards;
        }

        &::after {
            animation: stacked-second-card 100ms ease-in-out forwards;
        }
    }

    &.hidden {
        display: none;

        + .backlog-item-show-children {
            display: none;
        }
    }
}

@keyframes stacked-first-card {
    0% {
        left: -8px;
        transform: rotate(-1deg);
    }

    100% {
        left: -8px;
        transform: rotate(-2.5deg);
    }
}

@keyframes stacked-second-card {
    0% {
        left: 8px;
        transform: rotate(1deg);
    }

    100% {
        left: 8px;
        transform: rotate(2.5deg);
    }
}
