/**
 * 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 "navbar";
@use "variables-common";

.popover.current-project-nav-popover {
    width: 400px;
    padding: 0;
    border: 0;
    border-radius: var(--tlp-large-radius);
    background: var(--tlp-dark-color-darker-20);
    color: var(--tlp-neutral-dark-color);
    font-size: 0.875rem;
    font-weight: normal;
    letter-spacing: normal;
    line-height: 1.5rem;
    text-transform: none;

    &.right > .arrow::after {
        border-right-color: var(--tlp-dark-color-darker-20);
        border-bottom-color: transparent;
    }

    &.bottom > .arrow {
        left: var(--tlp-x-large-spacing);

        &::after {
            border-bottom-color: var(--tlp-dark-color-darker-20);
        }

        + .popover-content {
            border-radius: navbar.$nav-dropdown-content-border-radius;
        }
    }

    > h3 {
        margin: 0;
        padding: var(--tlp-medium-spacing) var(--tlp-medium-spacing) 0;
        border-bottom: 0;
        border-top-left-radius: navbar.$nav-dropdown-content-border-radius;
        border-top-right-radius: navbar.$nav-dropdown-content-border-radius;
        background-color: var(--tlp-dark-color-darker-20);
        color: var(--tlp-white-color);
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: normal;
        line-height: 1.5rem;
        cursor: initial;
    }

    > .popover-content {
        padding: var(--tlp-medium-spacing);
        border-bottom-right-radius: navbar.$nav-dropdown-content-border-radius;
        border-bottom-left-radius: navbar.$nav-dropdown-content-border-radius;
        background: var(--tlp-dark-color-darker-20);
        color: var(--tlp-neutral-dark-color);

        .current-project-nav-flag-popover-separator {
            margin: var(--tlp-medium-spacing) calc(-1 * var(--tlp-medium-spacing));
            border-top: 1px solid var(--tlp-dark-color-lighter-10);
            border-bottom: 0;
            background: none;
        }

        .current-project-nav-flag-popover-content-title {
            margin: 0 0 4px;
            padding: 0;
            border: 0;
            color: var(--tlp-neutral-light-color);
            font-size: 1rem;
            font-weight: 600;
            line-height: 1.5rem;

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

        .current-project-nav-flag-popover-flag {
            position: relative;
            margin: 0 0 var(--tlp-medium-spacing);
            padding: 0 0 0 20px; // magic value independant of density so that it looks nice with svg flag

            &:last-child {
                margin: 0;
            }

            > .fas,
            > .fa,
            > .tuleap-svg-project-shield {
                position: absolute;
                left: 0;
            }

            > .fas,
            > .fa {
                top: 6px;
                color: var(--tlp-neutral-light-color);
                font-size: 0.75rem;
            }

            > .tuleap-svg-project-shield {
                top: 3px;
                width: 12px;

                > path {
                    fill: var(--tlp-neutral-light-color);
                }
            }

            > .current-project-nav-flag-popover-content-description:last-child {
                margin: 0;
            }
        }
    }
}

.current-project-sidebar-popover-privacy {
    left: variables-common.$sidebar-width - 6px !important;

    > .arrow {
        top: calc(50% - 4px);
    }

    > .popover-content > .privacy-description {
        margin: 0;
    }
}

.current-project-nav-popover-privacy {
    top: 28px !important; // Override bootstrap inline position
    left: 0 !important; // Override bootstrap inline position
    min-width: 400px;

    > .arrow {
        left: 62px;
    }
}

:not(.breadcrumb-project-privacy-icon-with-flags) + .current-project-nav-popover-privacy {
    top: 28px !important; // Override bootstrap inline position
    left: -18px !important; // Override bootstrap inline position

    > .arrow {
        left: 30px;
    }
}

#current-project-nav-title-popover {
    display: none;
}

/* stylelint-disable selector-no-qualifying-type */
body.sidebar-expanded .project-sidebar-project-flags-popover {
    left: calc(#{variables-common.$sidebar-width} - 2px) !important; // override inset popers

    > .arrow {
        top: calc(50% - var(--tlp-large-spacing));
    }

    &.in {
        margin: var(--tlp-large-spacing) 4px;
    }
}
