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

.tool-button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: darken(@light, 5%);
    color: @dark;
    user-select: none;
    border: 1px solid transparent;
    transition: @transition-short;
    padding: 0;
    cursor: pointer;
    outline: none;
    margin: 0 2px;
    position: relative;
    font-size: 14px;

    [class*=mif], .icon, img {
        height: 1rem;
        max-height: 1rem;
        font-size: 1rem;
    }

    &.text-button {
        width: auto;
        padding-left: .5rem;
        padding-right: .5rem;
    }

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

    &:hover {
        background-color: @hoverBackground;
    }

    &:active {
        outline: 0;
        box-shadow: none;
    }

    &.outline {
        background: transparent none;
        border-width: 1px;
        border-color: @borderColor;
    }

    &.disabled, &:disabled {
        opacity: .65;
    }
}

a.tool-button {
    text-decoration: none;
    color: @dark;
}

.toolbar {
    display: inline-flex;
    position: relative;
    padding: 0;
    top: 2px;
    flex-flow: row nowrap;
    margin-left: 4px;

    &.no-divider {
        &::before {
            display: none;
        }
    }

    &::before {
        position: absolute;
        content: "";
        width: 4px;
        height: 32px;
        top: 0;
        left: 0;
        background-color: rgba(red(@grayMouse), green(@grayMouse), blue(@grayMouse), .20);
        cursor: default;
        display: none;
    }

    &::after {
        content: attr(data-caption);
        position: absolute;
        left: 2px;
        bottom: 100%;
        font-size: 8px;
        text-transform: uppercase;
    }

    &.movable {
        padding-left: .5725rem;
        &::before {
            display: block;
            cursor: move;
        }
    }

    &.vertical {
        flex-flow: column nowrap;
        padding: .5725rem 0 0 0;
        width: 32px;
        margin-left: 0;
        margin-top: 4px;

        &::before {
            width: 32px;
            height: 4px;
        }

        // TODO Need test this
        &::after {
            transform: rotate(-90deg);
            right: 100%;
            top: auto;
        }

        .tool-button {
            margin: 2px 0;
        }
    }
}
