/**
 * 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 "sass:map";
@use "pkg:@tuleap/tlp-dropdown";

.dropdown-menu-item {
    padding: 8px 16px;
    white-space: nowrap;
    cursor: pointer;

    &:focus,
    &:hover {
        background: #f3f3f3;
        text-decoration: none;
    }

    > .tlp-dropdown-menu-item-icon {
        margin: 0 5px 0 0;
    }
}

.tlp-dropdown-menu {
    transform: translateY(-10px);
    transition: opacity 75ms ease-out;
    border: 1px solid var(--tlp-dark-color);
    opacity: 0;
    background: var(--tlp-dark-color);
    font-size: 13px;
    font-weight: 400;
    line-height: 14px;

    &.help-dropdown-menu[data-placement^="top"]::after {
        border: 10px solid transparent;
        border-top-color: var(--tlp-dark-color);
    }

    &.tlp-dropdown-shown {
        transform: translateY(0);
        opacity: 1;
    }

    .dropdown-menu-separator {
        margin: 8px 0;
        border-top: 1px solid #f3f3f3;
        opacity: 0.1;
        background: #d4d7e1;
    }

    .help-dropdown-link {
        &.dropdown-menu-item {
            background: var(--tlp-dark-color);
            color: #d4d7e1;
            font-size: 13px;
            text-align: left;

            &:hover {
                background: var(--tlp-dark-color-darker-05);
            }

            > .dropdown-menu-item-icon {
                margin: 0 5px 0 0;
            }
        }

        &.help-dropdown-link-highlight {
            color: var(--tlp-warning-color);
        }
    }

    .dropdown-menu-item-alt {
        display: flex;
        align-items: baseline;
        padding: 10px 20px;
        font-size: 12px;

        > a {
            margin: 0 10px 0 0;
            opacity: 0.6;
            color: var(--tlp-neutral-light-color);
        }
    }
}

.help-dropdown {
    position: fixed;
    z-index: 1000;
    right: 16px;
    bottom: 16px;
}

#help {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tlp-dark-color) !important;

    @keyframes pulse {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.15);
        }

        100% {
            transform: scale(1);
        }
    }

    &.new-release-note-available {
        animation: pulse 300ms ease-in-out 1s 3 both;
        border-color: var(--tlp-warning-color);
        background: var(--tlp-warning-color) !important;
        color: var(--tlp-white-color);

        > .new-release-note-available-icon {
            display: inline-block;
        }

        > .svg-question-mark {
            display: none;
        }
    }

    > .new-release-note-available-icon {
        display: none;
        margin: 0;
        transition: color 200ms ease-in-out;
        font-size: 1.25rem;
    }
}

.help-modal-shortcuts-kbds {
    white-space: nowrap;
}

.help-modal-shortcuts-action {
    width: 100%;
}
