/*!
 * Copyright 2018 Telerik EAD
 *
 * 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.
 */
// Default button
.k-button {
    .border-radius();
    border-color: @button-border-color;
    color: @button-text-color;
    background-color: @button-background-color;
    background-position: 50% 50%;
    .composite-background(@button-gradient);
    .box-shadow(@button-shadow);

    // Hover state
    &:hover,
    &.k-state-hover {
        color: @button-hover-text-color;
        border-color: @button-hover-border-color;
        background-color: @button-hover-background-color;
        .composite-background(@button-hover-gradient);
        .box-shadow(@button-hover-shadow);
    }

    // Pressed state
    &:active,
    &.k-state-active {
        color: @button-active-text-color;
        background-color: @button-active-background;
        border-color: @button-active-border-color;
        box-shadow: none;
        .composite-background(@button-active-gradient);
        .box-shadow(@button-active-shadow);
        .box-shadow(none);
    }
    &.k-state-active {
        &:hover {
            color: @primary-hover-text-color;
            border-color: @primary-hover-border-color;
            background-color: @primary-hover-background-color;
        }
    }

    // Focus active
    &:focus:active {
        .box-shadow(@button-focused-active-shadow);
    }

    // Disabled state
    &[disabled],
    .k-state-disabled &,
    .k-state-disabled &:hover,
    &.k-state-disabled,
    &.k-state-disabled:hover {
        color: @disabled-text-color;
        border-color: @disabled-border-color;
        background-color: @disabled-background-color;
        .composite-background(@disabled-gradient);
    }
    &[disabled],
    &.k-state-disabled,
    &.k-state-disabled:active {
        box-shadow: none;
    }

    // Focused state
    &:focus,
    &:focus:hover,
    &.k-state-focused,
    &.k-state-focused.k-state-disabled,
    .k-state-disabled &.k-state-focused {
        border-color: @button-focused-border-color;
        .box-shadow(@button-focused-shadow);
    }

}



//Primary buttons
.k-primary {
    color: @primary-text-color;
    border-color: @primary-border-color;
    background-color: @primary-background-color;
    .composite-background(@primary-gradient);
    .box-shadow(@primary-shadow);

    // Hover state
    &:hover,
    &.k-state-hover {
        color: @primary-hover-text-color;
        border-color: @primary-hover-border-color;
        background-color: @primary-hover-background-color;
        .composite-background(@primary-hover-gradient);
        .box-shadow(@primary-hover-shadow);
    }

    // Pressed
    &:active,
    &.k-state-active {
        color: @primary-active-text-color;
        border-color: @primary-active-border-color;
        background-color: @primary-active-background-color;
        .composite-background(@primary-active-gradient);
        .box-shadow(@primary-active-shadow);
    }

    // Focus active
    &:focus:active:not(.k-state-disabled):not([disabled]) {
        .box-shadow(@primary-focused-active-shadow);
    }

    // Disabled
    &[disabled],
    .k-state-disabled &,
    .k-state-disabled &:hover,
    &.k-state-disabled,
    &.k-state-disabled:hover {
        color: @primary-disabled-text-color;
        border-color: @primary-disabled-border-color;
        background-color: @primary-disabled-background-color;
        box-shadow: none;
        .composite-background(@primary-disabled-gradient);
    }
    &[disabled],
    &.k-state-disabled {
        box-shadow: none;
    }

    // Focused state
    &:focus,
    &.k-state-focused {
        border-color: @primary-focused-border-color;
        .box-shadow(@primary-focused-shadow);
    }

}




// Button group
.k-button-group {
    .border-radius();

    // Border-radius
    .k-button {
        .border-radius( 0 );
    }

    .k-group-start,
    .k-button:first-child {
        .border-left-radius();
    }
    .k-group-end,
    .k-button:last-child {
        .border-right-radius();
    }
    .k-group-start.k-group-end,
    .k-button:first-child:last-child {
        .border-radius();
    }

}
.k-rtl .k-button-group {
    .k-button {
        .border-radius( 0 );
    }

    .k-group-start,
    .k-button:first-child {
        .border-right-radius();
    }
    .k-group-end,
    .k-button:last-child {
        .border-left-radius();
    }
    .k-group-start.k-group-end,
    .k-button:first-child:last-child {
        .border-radius();
    }
}

// Split button
.k-split-button {
    .border-radius();

    // Expanded state
    &.k-state-border-down > .k-button,
    &.k-state-border-up > .k-button {
        color: @button-hover-text-color;
        background-color: @button-hover-background-color;
        border-color: @button-hover-border-color;
        .composite-background(@button-hover-gradient);
        .box-shadow(none);
    }

    // Focus state
    &:focus {
        border-color: @button-focused-border-color;
        outline:none;
        .box-shadow(@button-focused-shadow);

        & > .k-button {
            background: transparent;
            border-color: @button-focused-border-color;
        }

        &:not(.k-state-disabled) > .k-state-active,
        &:not(.k-state-disabled) > .k-button:hover {
            color: @button-hover-text-color;
            background-color: @button-hover-background-color;
            border-color: @button-focused-border-color;
            .composite-background(@button-hover-gradient);
            .box-shadow(none);
        }
    }

    // Disabled state - ensure the disabled background when button is focused
    &.k-state-disabled {
        color: @disabled-text-color;
        background: @disabled-background-color;
        .composite-background(@disabled-gradient);
    }
}

// Edit buttons
.k-edit-buttons {
    border-color: @widget-border-color;
    background: @header-background-color;
}