/**
 * 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 "pkg:@tuleap/burningparrot-theme/css/includes/global-variables";
@use "pkg:@tuleap/project-background";

.project-with-background {
    .test-campaigns-header-title,
    .test-campaign-header-title,
    .test-administration-title,
    .test-dependency-graph-title {
        @include project-background.title-header-typography;
    }

    .execution-header-button-edit.tlp-button-ellipsis {
        --tlp-button-ellipsis-color: var(--tlp-button-ellipsis-color-on-dark-value);
        --tlp-button-ellipsis-hover-color: var(--tlp-button-ellipsis-hover-color-on-dark-value);
        --tlp-button-ellipsis-focus-border-color: var(
            --tlp-button-ellipsis-focus-border-color-on-dark-value
        );
        --tlp-button-ellipsis-disabled-color: var(
            --tlp-button-ellipsis-disabled-color-on-dark-value
        );
        --tlp-button-ellipsis-disabled-opacity: var(
            --tlp-button-ellipsis-disabled-opacity-on-dark-value
        );
        --tlp-button-ellipsis-text-shadow: var(--tlp-button-ellipsis-text-shadow-on-dark-value);
    }

    .test-campaign-header {
        margin: 0 0 var(--tlp-medium-spacing);
    }

    .test-campaign-testers {
        &:hover {
            background: rgb(0 0 0 / 30%);
        }

        > .test-campaign-testers-more {
            color: var(--tlp-white-color);
        }
    }

    .test-campaign-header-container > .test-campaign-progressions > .test-campaign-progression {
        > .test-campaign-progression-bar {
            box-shadow: 0 0 3px rgb(0 0 0 / 40%);
        }

        > .test-campaign-progression-value {
            text-shadow: 0 0 3px rgb(0 0 0);
        }

        &.passed {
            > .test-campaign-progression-bar {
                background: var(--tlp-success-color-lighter-60);
            }

            > .test-campaign-progression-value {
                color: var(--tlp-success-color-lighter-60);
            }
        }

        &.failed {
            > .test-campaign-progression-bar {
                background: var(--tlp-danger-color-lighter-60);
            }

            > .test-campaign-progression-value {
                color: var(--tlp-danger-color-lighter-60);
            }
        }

        &.blocked {
            > .test-campaign-progression-bar {
                background: var(--tlp-info-color-lighter-60);
            }

            > .test-campaign-progression-value {
                color: var(--tlp-info-color-lighter-60);
            }
        }

        &.notrun {
            > .test-campaign-progression-bar {
                background: var(--tlp-neutral-normal-color);
            }

            > .test-campaign-progression-value {
                color: var(--tlp-neutral-light-color);
            }
        }
    }
}

body {
    $elements-with-project-background: ".test-campaigns-header", ".test-campaign-header",
        ".test-administration-title", ".test-dependency-graph-title";

    @each $element-with-project-background in $elements-with-project-background {
        @include project-background.apply-background(
            $element-with-project-background,
            global-variables.$sidebar-expanded-width,
            global-variables.$sidebar-collapsed-width
        );
    }
}
