//
// Component: Button
//
// ========================================================================


// Variables
// ========================================================================

@button-height:                                 @global-height;
@button-mini-height:                            @global-height-mini;
@button-small-height:                           @global-height-small;
@button-large-height:                           @global-height-large;

@button-line-height:                            @global-height - 2;
@button-mini-line-height:                       @global-height-mini - 2;
@button-small-line-height:                      @global-height-small - 2;
@button-large-line-height:                      @global-height-large - 2;

@button-mini-font-size:                         round((@global-font-size * 0.78)); // 11px / 12px
@button-small-font-size:                        round((@global-font-size * 0.85)); // 12px / 14px
@button-large-font-size:                        round((@global-font-size * 1.14)); // 16px / 18px

@button-background:                             @global-default-background;
@button-color:                                  @global-color;
@button-hover-background:                       @global-default-hover-background;
@button-hover-color:                            @global-color;
@button-active-background:                      @global-default-active-background;
@button-active-color:                           @global-color;

@button-primary-background:                     @global-primary-background;
@button-primary-color:                          @global-contrast-color;
@button-primary-hover-color:                    @global-contrast-color;
@button-primary-active-color:                   @global-contrast-color;

@button-success-background:                     @global-success-background;
@button-success-color:                          @global-contrast-color;
@button-success-hover-color:                    @global-contrast-color;
@button-success-active-color:                   @global-contrast-color;

@button-danger-background:                      @global-danger-background;
@button-danger-color:                           @global-contrast-color;
@button-danger-hover-color:                     @global-contrast-color;
@button-danger-active-color:                    @global-contrast-color;

@button-disabled-background:                    @global-default-hover-background;
@button-disabled-color:                         @global-muted-color;

@button-link-color:                             @global-link-color;
@button-link-hover-color:                       @global-link-hover-color;
@button-link-disabled-color:                    @global-muted-color;

//
// New
//

@button-border:                                 rgba(0,0,0,0.06);
@button-hover-border:                           rgba(0,0,0,0.16);
@button-text-shadow:                            @global-text-shadow;
@button-contrast-text-shadow:                   @global-contrast-text-shadow;
@button-contrast-hover-border:                  rgba(0,0,0,0.21);

@button-group-border:                           rgba(0,0,0,0.1);


// Component
// ========================================================================

.hook-button() {
    border: 1px solid @button-border;
    border-radius: @global-border-radius;
    text-shadow: 0 1px 0 @button-text-shadow;
}

.hook-button-hover() { border-color: @button-hover-border; }

.hook-button-active() {}


// Color modifiers
// ========================================================================

//
// Modifier: `uk-button-primary`
//

.hook-button-primary() {}

.hook-button-primary-hover() {}
.hook-button-primary-active() {}

//
// Modifier: `uk-button-success`
//

.hook-button-success() {}

.hook-button-success-hover() {}
.hook-button-success-active() {}

//
// Modifier: `uk-button-danger`
//

.hook-button-danger() {}

.hook-button-danger-hover() {}
.hook-button-danger-active() {}


// Disabled state
// ========================================================================

.hook-button-disable() {
    border-color: @button-border;
    box-shadow: none;
    text-shadow: 0 1px 0 @button-text-shadow;
}


// Modifier: `uk-button-link`
// ========================================================================

.hook-button-link() {
    box-shadow: none;
    text-shadow: none;
}


// Size modifiers
// ========================================================================

.hook-button-large() { border-radius: @global-border-radius + 1; }


// Miscellaneous
// ========================================================================

.hook-button-misc() {

    /* Color modifiers
     ========================================================================== */

    .uk-button-primary,
    .uk-button-success,
    .uk-button-danger {
        box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
        text-shadow: 0 -1px 0 @button-contrast-text-shadow;
    }

    .uk-button-primary:hover, .uk-button-primary:focus,
    .uk-button-success:hover, .uk-button-success:focus,
    .uk-button-danger:hover, .uk-button-danger:focus { border-color: @button-contrast-hover-border; }


    /* Sub-object `uk-button-group`
     ========================================================================== */

    /*
     * Reset border-radius
     */

    .uk-button-group > .uk-button:not(:first-child):not(:last-child),
    .uk-button-group > div:not(:first-child):not(:last-child) .uk-button {
        border-left-color: @button-group-border;
        border-right-color: @button-group-border;
        border-radius: 0;
    }

    .uk-button-group > .uk-button:first-child,
    .uk-button-group > div:first-child .uk-button {
        border-right-color: @button-group-border;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

    .uk-button-group > .uk-button:last-child,
    .uk-button-group > div:last-child .uk-button {
        border-left-color: @button-group-border;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    /*
     * Collapse border
     */

    .uk-button-group > .uk-button:nth-child(n+2),
    .uk-button-group > div:nth-child(n+2) .uk-button { margin-left: -1px; }

    /*
     * Create position context to superimpose the successor elements border
     * Known issue: If you use an `a` element as button and an icon inside,
     * the active state will not work if you click the icon inside the button
     * Workaround: Just use a `button` or `input` element as button
     */

    .uk-button-group .uk-button:hover,
    .uk-button-group .uk-button:active,
    .uk-button-group .uk-button.uk-active { position: relative; }

}