@import (once) "../../include/vars";
@import (once) "../../include/mixins";

:root {
    --t-menu-border-radius: 6px;
    --t-menu-border-color: #ececec;
    --t-menu-background: #fefefe;
    --t-menu-color: #191919;
    --t-menu-dropdown-color: #191919;
}

.dark-side {
    --t-menu-border-color: #484b4c;
    --t-menu-background: #343637;
    --t-menu-color: #dbdfe7;
    --t-menu-dropdown-color: #dbdfe7;
}

.t-menu {
    list-style: none inside;
    margin: 0;
    padding: 0;
    position: relative;
    width: auto;
    float: left;
    background-color: var(--t-menu-background);
    color: var(--t-menu-color);
    display: none;
    border: 1px var(--t-menu-border-color) solid;
    border-radius: var(--t-menu-border-radius);

    &.open {
        display: block;
    }

    & > li:first-child, & > li:first-child a {
        border-top-left-radius: var(--t-menu-border-radius);
        border-top-right-radius: var(--t-menu-border-radius);
    }
    & > li:last-child, & > li:last-child a {
        border-bottom-left-radius: var(--t-menu-border-radius);
        border-bottom-right-radius: var(--t-menu-border-radius);
    }
    
    & > li {
        position: relative;
        background-color: inherit;
        color: inherit;
        display: block;
        height: 60px;
        width: 60px;

        & > a {
            display: flex;
            align-items: center;
            justify-content: center;
            border-bottom: 1px var(--t-menu-border-color) solid;
            position: relative;
            color: inherit;
            background-color: inherit;
            height: 100%;
            width: 100%;
            overflow: hidden;

            * {
                width: 1.5rem;
                height: 1.5rem;
                font-size: 1.5rem;
                display: flex;
                align-items: center;
                justify-content: center;
            }
        }

        @media (hover: hover) {
            &:hover {
                background-color: @hoverBackground;
            }
        }

        @media (hover: none) {
            &:active {
                background-color: @hoverBackground;
            }
        }
    }

    a {
        text-decoration: none!important;
        &:hover {
            text-decoration: none!important;
        }
    }
}

.t-menu {
    &.horizontal {
        & > li {
            float: left;
        }
        & > li:first-child a {
            border-radius: var(--t-menu-border-radius) 0 0 var(--t-menu-border-radius);
        }
        & > li:last-child a {
            border-radius: 0 var(--t-menu-border-radius) var(--t-menu-border-radius) 0;
        }
    }
}

.t-menu {
    .t-menu {
        position: absolute;
        left: 100%;
        margin-left: .3125rem ;
        top: 0;
        float: none;
    }
}

.t-menu.horizontal {
    .t-menu {
        left: 0 ;
        top: 100% ;
        margin-top: .3125rem ;
        margin-left: 0 ;
    }
}

.t-menu {
    .dropdown-toggle {
        padding-right: 0!important;
        &:after {
            content: "";
            background-color: @transparent;
            position: absolute;
            left: auto;
            top: auto;
            bottom: 0;
            right: 0;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 0 0 8px 8px;
            border-color: transparent transparent var(--t-menu-dropdown-color) transparent;
            .rotate(0);
        }

        &:before {
            display: none;
        }
    }
    
    .dropdown-caret {
        display: none;
    }
}

.t-menu.horizontal {
    & > li {

        & > a {
            border-right: 1px var(--t-menu-border-color) solid;
            border-bottom: 0;
        }

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

.t-menu.horizontal {
    .t-menu:not(.horizontal) {
        left: 0;
        top: 100% ;
        margin-top: .3125rem ;
        margin-left: 0 ;

        .t-menu.horizontal {
            left: 100% ;
            margin-left: .3125rem ;
            top: -.3rem ;
            float: left;
        }
    }
}

.t-menu {
    &.compact {
        li {
            width: 40px;
            height: 40px;

            a {
                * {
                    width: 1rem;
                    height: 1rem;
                    font-size: 1rem;
                }
            }
        }
    }
}

.t-menu {
    z-index: @z-index-dropdown;
}
