/**
 * Copyright (c) Enalean, 2019 - 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 "sass:color";

$taskboard-header-height: 50px;

.taskboard-head {
    display: flex;
    position: sticky;
    z-index: 10;
    top: global-variables.$navbar-height;
}

.has-visible-platform-banner .taskboard-head {
    top: calc(
        #{global-variables.$navbar-height} + #{global-variables.$platform-banner-base-height}
    );
}

.taskboard-header {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    height: $taskboard-header-height;
    padding: var(--tlp-small-spacing);
    border-right: 1px solid var(--tlp-neutral-normal-color);
    border-bottom: 1px solid var(--tlp-neutral-normal-color);
    background: var(--tlp-white-color);
    box-shadow:
        inset 0 2px 0 0 var(--primary-color, var(--tlp-neutral-normal-color)),
        inset 0 -1px 0 var(--tlp-neutral-normal-color);
    color: var(--text-color, var(--tlp-dimmed-color));
    font-weight: 600;
    text-transform: uppercase;

    &:last-child {
        border-right: 0;
    }

    &:hover,
    &:focus-within {
        > .taskboard-header-collapse-column {
            opacity: 1;
        }
    }

    > .taskboard-header-expand-column,
    > .taskboard-header-collapse-column {
        padding: 0 2px;
        border: 0;
        background: none;
        color: var(--primary-color);
        cursor: pointer;
    }
}

.taskboard-header-collapsed {
    flex: 0 0 auto;
    width: 50px;
    min-width: unset;
    overflow: hidden;
}

.taskboard-header-collapsed-show-label,
.taskboard-header-collapsed:hover {
    > .taskboard-header-collapsed-label {
        opacity: 1;
    }
}

.taskboard-header-expand-column,
.taskboard-header-collapse-column {
    font-size: 14px;
    text-transform: none;
    cursor: pointer;

    &:focus {
        box-shadow: var(--tlp-shadow-focus);
    }
}

.taskboard-header-collapse-column {
    transition: opacity ease-in-out 100ms;
    opacity: 0;
}

.taskboard-header-collapsed-label {
    display: flex;
    position: absolute;
    align-items: center;
    height: 48px;
    padding: 10px 12px 10px 50px;
    transform: translateX(-50%) rotate(-90deg) translateX(-25px);
    transform-origin: center right;
    transition: opacity ease-in-out 100ms;
    opacity: 0;
    background: linear-gradient(
        -90deg,
        transparent,
        color.adjust(rgb(255 255 255 / 75%), $lightness: - 2%) 3px,
        color.adjust(rgb(255 255 255 / 75%), $lightness: - 2%) 75%,
        transparent
    );
    white-space: nowrap;
    direction: rtl;
    cursor: pointer;
    pointer-events: none;

    > .taskboard-header-label {
        margin: 0 var(--tlp-small-spacing) 0 0;
    }
}

.taskboard-header-label {
    flex: 1 0 1%;
    margin: 0 var(--tlp-small-spacing);
    overflow: hidden;
    font-size: 0.875rem;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskboard-header-wrong-color-container {
    margin: 0 0 0 5px;
}

.taskboard-header-wrong-color {
    color: var(--tlp-warning-color);
    cursor: pointer;
}

.taskboard-header-wrong-color-preview {
    white-space: nowrap;
}

.taskboard-header-wrong-color-preview-color {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 1px solid var(--tlp-neutral-light-color);
    vertical-align: middle;
}

.taskboard-header-wrong-color-popover {
    z-index: 1001;
}

.taskboard-header-wrong-color-body {
    color: var(--tlp-typo-default-text-color);
    text-transform: none;
}

.taskboard-header-count {
    position: relative;
    top: -1px;
    animation: none;
    opacity: 0.4;
    font-size: 28px;
    font-weight: 300;

    &.taskboard-header-count-loading {
        animation: 250ms linear 0s infinite alternate loading-items;
    }
}

@keyframes loading-items {
    0% {
        opacity: 0.4;
    }

    100% {
        opacity: 0.05;
    }
}
