/**
 * Copyright (c) Enalean, 2021 - 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 "sass:map";
@use "pkg:@tuleap/tlp-swatch-colors";

.roadmap-gantt-task-popover {
    &.tlp-popover.tlp-popover-shown {
        transform: translate(calc(var(--tlp-small-spacing) * 0.5));
    }

    > .roadmap-gantt-task-popover-arrow::after {
        background: var(--tlp-dark-color-darker-20);
    }

    &.tlp-popover[data-popover-placement="left-end"],
    &.tlp-popover[data-popover-placement="right-end"] {
        &.tlp-popover-shown {
            transform: translateY(7px);
        }
    }

    &.tlp-popover[data-popover-placement="left"],
    &.tlp-popover[data-popover-placement="right"] {
        &.tlp-popover-shown {
            transform: translateY(0);
        }
    }

    &.tlp-popover[data-popover-placement="left"],
    &.tlp-popover[data-popover-placement="right"],
    &.tlp-popover[data-popover-placement="left-end"],
    &.tlp-popover[data-popover-placement="right-end"] {
        > .roadmap-gantt-task-popover-arrow::after {
            background: var(--tlp-dark-color);
        }
    }

    &.tlp-popover[data-popover-placement^="top"] {
        &.tlp-popover-shown {
            transform: translateY(0);
        }

        > .roadmap-gantt-task-popover-arrow::after {
            background: var(--tlp-dark-color);
        }
    }
}

.roadmap-gantt-task-popover-header {
    border-top: 4px solid transparent;
    border-bottom: 1px solid var(--tlp-dark-color-darker-20);
    background: var(--tlp-dark-color-darker-20);

    @each $color-name, $colors in tlp-swatch-colors.$color-map {
        &.roadmap-gantt-task-popover-header-#{$color-name} {
            border-top-color: map.get($colors, "primary");

            > .roadmap-gantt-task-popover-title > .roadmap-gantt-task-popover-xref {
                color: map.get($colors, "text-on-dark");
            }
        }
    }
}

.roadmap-gantt-task-popover-title {
    display: flex;
    flex-direction: column;
    color: var(--tlp-white-color);
}

.roadmap-gantt-task-popover-xref {
    margin: 0 0 2px;
    font-size: 0.625rem;
    line-height: 0.75rem;
}

.roadmap-gantt-task-popover-task {
    font-size: 0.875rem;
    line-height: 1.125rem;
}

.roadmap-gantt-task-popover-body {
    background: var(--tlp-dark-color);

    &.tlp-popover-body {
        padding: var(--tlp-small-spacing) var(--tlp-medium-spacing) var(--tlp-medium-spacing);
    }
}
