/**
 * Copyright (c) Enalean, 2020 - 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 "./media-query-definitions" as media-query;
@use "pkg:@tuleap/tlp/src/scss/components/tooltips-mixins" as tooltip;

.test-plan-list-of-test-definitions {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--tlp-small-spacing);
    border: 1px solid var(--tlp-neutral-normal-color);
    border-top: 0;
    border-bottom-right-radius: var(--tlp-large-radius);
    border-bottom-left-radius: var(--tlp-large-radius);
    background: var(--tlp-fade-background-color);
}

.test-plan-list-of-test-definitions-empty-text {
    margin: 24px 0;
    font-size: 16px;
    font-style: italic;
    line-height: 20px;
}

.test-plan-test-definition-skeleton {
    display: flex;
    width: 100%;
    min-height: inherit;
    margin: 0 0 var(--tlp-small-spacing);
    padding: var(--tlp-medium-spacing) var(--tlp-small-spacing);
}

.test-plan-test-definition-skeleton-xref {
    width: 70px;
    margin: 0 var(--tlp-small-spacing) 0 0;
}

.test-plan-test-definition-skeleton-title {
    width: 300px;
}

.test-plan-test-definition-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 0 var(--tlp-small-spacing);
    padding: var(--tlp-small-spacing);
    transition:
        border-color 150ms ease-in-out,
        background-color 150ms ease-in-out;
    border: 1px solid var(--border-color, transparent);
    border-radius: var(--tlp-medium-radius);
    background: var(--secondary-color, var(--tlp-white-color));
    box-shadow: var(--tlp-card-shadow);

    &:last-of-type {
        margin: 0;
    }

    &.test-plan-test-definition-is-just-refreshed {
        transition:
            border-color 150ms ease-in-out,
            background-color 150ms ease-in-out;
        animation: pulse-test-definition 500ms ease-in-out;
        border-color: var(--tlp-success-color-transparent-50);
        background: var(--tlp-success-color-lighter-90);
    }
}

.test-plan-test-definition-metadata {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.test-plan-test-definition-title {
    font-size: 0.875rem;
    line-height: 1.125rem;
}

.test-plan-test-definition-xref {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--tlp-dimmed-color);
    font-size: 0.625rem;
    line-height: 0.8125rem;

    &:hover,
    &:focus,
    &:active {
        text-decoration: none;

        > .test-plan-test-definition-xref-text {
            text-decoration: underline;
        }
    }
}

.test-plan-test-definition-xref-icon {
    font-size: 0.8em;
}

.test-plan-test-definition-category {
    font-size: 0.625rem;
}

.test-plan-test-definition-card-category-status {
    display: flex;
    align-items: center;
    gap: var(--tlp-small-spacing);
}

.test-plan-test-definition-icons {
    display: flex;
    gap: 2px;
    flex: 0 0 auto;
    justify-content: flex-end;
    width: 44px; // magic value so the size is kept even without automated test icon
    height: 1.075em;
}

.test-plan-test-definition-icon-automated-tests {
    width: 1.25em;
    font-size: 1.075em;
    text-align: center;

    &:last-child {
        margin: 0 26px 0 0;
    }
}

.test-plan-test-definition-icon-automated-tests.test-plan-test-definition-icon-status-notrun,
.test-plan-test-definition-icon-automated-tests:last-child {
    opacity: 0.5;
    color: var(--tlp-dimmed-color);
}

.test-plan-test-definition-icon-status-passed {
    color: var(--tlp-success-color);
}

.test-plan-test-definition-icon-status-failed {
    color: var(--tlp-danger-color);
}

.test-plan-test-definition-icon-status-blocked {
    color: var(--tlp-info-color);
}

.test-plan-test-definition-icon-status-notrun {
    color: var(--tlp-dimmed-color);
}

.test-plan-test-definition-icon-status-notplanned {
    color: var(--tlp-dimmed-color);
}

.test-plan-test-definition-test-status-tooltip-position {
    @include tooltip.tlp-tooltip-right;

    @include media-query.not-large-screen {
        @include tooltip.tlp-tooltip-left;
    }
}

@keyframes pulse-test-definition {
    0% {
        transform: scale3d(1, 1, 1);
    }

    50% {
        transform: scale3d(1.02, 1.02, 1.02);
    }

    100% {
        transform: scale3d(1, 1, 1);
    }
}
