/**
 * Copyright JS Foundation and other contributors, http://js.foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

@mixin disable-selection {
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

@mixin enable-selection {
    -webkit-user-select: auto;
    -khtml-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

@mixin component-border {
   border: 1px solid $primary-border-color;
   box-sizing: border-box;

}

@mixin workspace-button {
    @include disable-selection;
    box-sizing: border-box;
    display: inline-block;
    color: $workspace-button-color !important;
    background: $workspace-button-background;
    border: 1px solid $form-input-border-color;
    text-align: center;
    margin:0;
    text-decoration: none;
    cursor:pointer;

    &.disabled {
        cursor: default;
        color: $workspace-button-color-disabled !important;
    }
    &:hover, &:focus {
        text-decoration: none;
    }
    &:not(.disabled):hover {
        color: $workspace-button-color-hover !important;
        background: $workspace-button-background-hover;
    }
    &:not(.disabled):focus {
        color: $workspace-button-color-focus !important;
    }
    &:not(.disabled):active {
        color: $workspace-button-color-active !important;
        background: $workspace-button-background-active;
        text-decoration: none;
    }
    &.selected:not(.disabled) {
        color: $workspace-button-color-selected !important;
        background: $workspace-button-background-active;
    }
    .button-group &:not(:first-child) {
        border-left: none;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
    .button-group &:not(:last-child) {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .button-group-vertical & {
        display: block;
        min-width: 22px;
    }
    .button-group-vertical &:not(:first-child) {
        border-top: none;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }
    .button-group-vertical &:not(:last-child) {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    &:focus {
        outline: 1px solid $workspace-button-color-focus-outline;
    }
}
.button-group-vertical {
    display: inline-block;
    vertical-align: middle;
}
.button-group:not(:last-child) {
    margin-right: 10px;
}


@mixin workspace-button-toggle {
    @include workspace-button;
    color: $workspace-button-toggle-color !important;
    background:$workspace-button-background-active;
    margin-bottom: 1px;
    &.selected:not(.disabled) {
        color: $workspace-button-toggle-color-selected !important;
        background: $workspace-button-background;
        border-bottom-width: 2px;
        border-bottom-color: $form-input-border-selected-color;
        margin-bottom: 0;
        cursor: default;
    }
    &.disabled {
        color: $workspace-button-toggle-color-disabled !important;
    }
}
@mixin editor-button {
    @include workspace-button;
    font-size: 14px;
    padding: 6px 14px;
    margin-right: 8px;
    color: $editor-button-color !important;
    background: $editor-button-background;

    &.primary {
        border-color: $editor-button-background-primary;
        color: $editor-button-color-primary !important;
        background: $editor-button-background-primary;
        &.disabled, &.ui-state-disabled {
            background: none;
            color: $editor-button-color !important;
            border-color: $form-input-border-color;
        }
        &:not(.disabled):not(.ui-button-disabled):hover {
            border-color: $editor-button-background-primary-hover;
            background: $editor-button-background-primary-hover;
            color: $editor-button-color-primary !important;
        }
    }
    &:not(.disabled):hover {
        //color: $editor-button-color;
    }
    &.disabled {
        background: none;
    }
    &.disabled:focus {
        outline: none;
    }


    &.leftButton {
        float: left;
        margin-top: 1px;
    }
    &:not(.leftButton):not(:last-child) {
        margin-right: 16px;
    }
    &.ui-state-disabled {
        opacity: 1;
    }
}

@mixin component-footer {
    border-top: 1px solid $primary-border-color;
    background: #f3f3f3;
    text-align: right;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25px;
    line-height: 23px;
    padding: 0 10px;


    .button-group:not(:last-child) {
        margin-right: 5px;
    }

}

@mixin component-footer-button {
    @include workspace-button;
    font-size: 11px;
    line-height: 17px;
    width: 18px;
    height: 18px;
    &.text-button {
        width: auto;
        padding: 0 5px;
    }
}
@mixin component-footer-button-toggle {
    @include workspace-button-toggle;
    font-size: 11px;
    line-height: 17px;
    height: 18px;
    &.text-button {
        width: auto;
        padding: 0 5px;
    }
}

@mixin component-shadow {
    border: 1px solid $secondary-border-color;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.2);

}

@mixin shade {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: $shade-color;
}