@import "../../../../css/static/properties";
@import "../../../../css/static/mixin";

/* Variables */
html:root {
    --menu-bar-button-background: #454545;
    --menu-bar-button-background-hover: #393c43;
    --menu-bar-button-background-activated: #2f3841;
    --menu-bar-button-background-activated-red: #412f2f;
    --menu-bar-button-background-activated-hover: #263340;
    --menu-bar-button-background-activated-red-hover: #402626;

    --menu-bar-button-border: #454545;
    --menu-bar-button-border-hover: #4a4c55;
    --menu-bar-button-border-activated: #005fa1;
    --menu-bar-button-border-activated-red: #a10000;
    --menu-bar-button-border-activated-hover: #005fa1;
    --menu-bar-button-border-activated-red-hover: #a10000;

    --menu-bar-dropdown: #c4c5c5;
    --menu-bar-dropdown-border: #2c2525;
    --menu-bar-dropdown-background: #2d3032;
    --menu-bar-dropdown-hover-background: #252729;

    --menu-bar-dropdown-arrow-background: #393c43;
    --menu-bar-dropdown-arrow: #4a4c55;
}

/* border etc */
.button, .dropdownArrow {
    text-align: center;

    border: .05em solid var(--menu-bar-button-border);
    border-radius: $border_radius_small;

    background-color: var(--menu-bar-button-background);

    &:hover {
        background-color: var(--menu-bar-button-background-hover);
        border-color: var(--menu-bar-button-border-hover);
        /* box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); */
    }

    &.activated {
        background-color: var(--menu-bar-button-background-activated);
        border-color: var(--menu-bar-button-border-activated);

        &:hover {
            background-color: var(--menu-bar-button-background-activated-hover);
            border-color: var(--menu-bar-button-border-activated-hover);
        }

        &.theme-red {
            background-color: var(--menu-bar-button-background-activated-red);
            border-color: var(--menu-bar-button-border-activated-red);

            &:hover {
                background-color: var(--menu-bar-button-background-activated-red-hover);
                border-color: var(--menu-bar-button-border-activated-red-hover);
            }
        }
    }

    @include transition(background-color $button_hover_animation_time ease-in-out, border-color $button_hover_animation_time ease-in-out);

    :global(.icon_em) {
        font-size: 1.5em;
    }
}

.button {
    display: flex;
    flex-direction: row;
    justify-content: center;

    flex-grow: 0;
    flex-shrink: 0;

    height: 2em;
    width: 2em;

    cursor: pointer;
    align-items: center;

    margin-right: 5px;
    margin-left: 5px;

    &.buttonHostbutton {
        img {
            min-width: 1.5em;
            max-width: 1.5em;

            height: 1.5em;
            width: 1.5em;
        }

        overflow: hidden;
        padding: .25em;
    }
}

.buttonDropdown {
    height: 100%;
    position: relative;

    .buttons {
        height: 2em;

        align-items: center;

        display: flex;
        flex-direction: row;

        .dropdownArrow {
            height: 2em;

            display: inline-flex;
            justify-content: space-around;
            width: 1.5em;
            cursor: pointer;

            border-radius: 0 $border_radius_small $border_radius_small 0;
            align-items: center;
            border-left: 0;
        }

        .button {
            margin-right: 0;
        }

        &:hover {
            .button, .dropdownArrow {
                background-color: #393c43;
                border-color: #4a4c55;
            }

            .button  {
                border-right-color: transparent;

                border-bottom-right-radius: 0;
                border-top-right-radius: 0;
            }
        }
    }

    .dropdown {
        display: none;
        position: absolute;
        margin-left: 5px;

        color: var(--menu-bar-dropdown);

        background-color: var(--menu-bar-dropdown-background);
        align-items: center;
        border: .05em solid var(--menu-bar-dropdown-border);
        border-radius: 0 $border_radius_middle $border_radius_middle $border_radius_middle;

        width: 15em; /* fallback */
        width: max-content;

        max-width: 25em;

        z-index: 1000;
        /*box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);*/

        &:global(.right) {
            right: 0;
        }

        .iconContainer {
            margin-right: .25em;

            display: flex;
            flex-direction: column;

            flex-shrink: 0;
            flex-grow: 0;
        }

        .dropdownEntry {
            position: relative;

            display: flex;
            flex-direction: row;
            cursor: pointer;
            padding: 1px 2px 1px 4px;

            align-items: center;
            justify-content: stretch;

            .entryName {
                flex-grow: 1;
                flex-shrink: 1;

                vertical-align: text-top;
                margin-right: .5em;
            }

            .icon, .arrow {
                flex-grow: 0;
                flex-shrink: 0;

                display: flex;
                flex-direction: column;
                justify-content: center;
            }

            .arrow {
                margin-right: .5em;
            }


            &:first-of-type {
                border-radius: .1em .1em 0 0;
            }

            &:last-of-type {
                border-radius: 0 0 .1em .1em;
            }

            > .dropdown {
                margin-left: 0;
            }

            &:hover {
                background-color: var(--menu-bar-dropdown-hover-background);

                > .dropdown {
                    display: block;
                    margin-left: 0;

                    left: 100%;
                    top: 0;
                }
            }
        }


        &.displayLeft {
            margin-left: -179px;
            border-radius: $border_radius_middle 0 $border_radius_middle $border_radius_middle;
        }
    }

    &.dropdownDisplayed {
        > .dropdown {
            display: block;
        }

        .button, .dropdown-arrow {
            background-color: var(--menu-bar-dropdown-arrow-background);
            border-color: var(--menu-bar-dropdown-arrow);

            border-bottom-right-radius: 0;
            border-bottom-left-radius: 0;
        }

        .button {
            border-right-color: transparent;

            border-bottom-right-radius: 0;
            border-top-right-radius: 0;
        }
    }


    hr {
        margin-top: 5px;
        margin-bottom: 5px;
    }
}

.buttonBookmarks {
    .dropdown {
        width: 300px;
    }
}

.arrow {
    display: inline-block;
    border: solid black;

    border-width: 0 .2em .2em 0;
    padding: .21em;
    height: .5em;
    width: .5em;

    &.right {
        transform: rotate(-45deg);
        -webkit-transform: rotate(-45deg);
    }

    &.left {
        transform: rotate(135deg);
        -webkit-transform: rotate(135deg);
    }

    &.up {
        transform: rotate(-135deg);
        -webkit-transform: rotate(-135deg);
    }

    &.down {
        transform: rotate(45deg);
        -webkit-transform: rotate(45deg);
    }
}