/**
 * Copyright (c) 2017-Present Enalean
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

@use "pkg:@tuleap/burningparrot-theme/css/includes/global-variables";

.sidebar-collapsed {
    .sidebar {
        width: global-variables.$sidebar-collapsed-width;
    }

    .project-sidebar-banner-button {
        justify-content: center;
    }

    .project-sidebar-nav-item {
        justify-content: center;
    }

    .project-sidebar-nav-item-icon {
        margin: 0;
        font-size: 1rem;
    }

    .project-sidebar-nav-item-new-tab {
        right: 0;
        left: auto;
    }

    .sidebar-about-logo-without-product-name {
        display: inline;
    }

    #logo {
        width: global-variables.$sidebar-collapsed-width;
        background: var(--tlp-main-color) var(--logo-small-url) no-repeat center center;
    }

    .project-administration-link {
        margin: var(--tlp-medium-spacing) 0;

        > .project-administration-link-icon {
            position: relative;
            top: -1px;
        }
    }

    .project-title-container {
        align-self: center;
    }

    .project-sidebar-linked-projects {
        flex-direction: row;
        justify-content: center;
        margin: 0;
    }

    .project-sidebar-linked-projects-title {
        margin: 0 var(--tlp-small-spacing);
        padding: var(--tlp-small-spacing);
        border-radius: var(--tlp-large-radius);

        &:focus {
            background-color: var(--tlp-dark-color);
            // stylelint-disable-next-line function-linear-gradient-no-nonstandard-direction
            background-image: linear-gradient(
                0,
                var(--tlp-sidebar-action-background-hover),
                var(--tlp-sidebar-action-background-hover)
            );
            background-blend-mode: overlay;
        }
    }

    .tlp-popover.tlp-popover-shown.project-sidebar-linked-projects-popover {
        display: flex;

        &:not(.project-sidebar-linked-projects-popover-nb-max-exceeded) {
            display: flex;
        }

        > .tlp-popover-header {
            white-space: nowrap;
        }
    }

    .project-sidebar-linked-projects-popover-content {
        $magic-number-to-include-popover-body-in-viewport: 120px;

        max-height: calc(100vh - $magic-number-to-include-popover-body-in-viewport);
    }

    .project-sidebar-project-flags {
        justify-content: center;
    }

    .project-sidebar-project-flags-labels {
        margin: 0;
        padding: var(--tlp-small-spacing) 0;
    }

    .project-sidebar-linked-projects-list,
    .project-sidebar-linked-projects-label,
    .project-sidebar-privacy-badge,
    .project-sidebar-tools-section-label,
    .project-sidebar-banner-button-label,
    .project-sidebar-project-flags-label,
    .project-sidebar-nav-item-label,
    .project-sidebar-promoted-item-nav,
    .sidebar-about-logo,
    .project-sidebar-title,
    .project-title-spacer,
    .sidebar-about-version,
    .sidebar-copyright {
        display: none;
    }

    .sidebar-collapser-icon {
        left: 1px;

        &::before {
            content: "\f054"; // fa-chevron-right
        }
    }

    .project-sidebar-nav {
        margin: var(--tlp-medium-spacing) 0;
    }
}
