//
// 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;
@button-mini-line-height:                       @global-height-mini;
@button-small-line-height:                      @global-height-small;
@button-large-line-height:                      @global-height-large;

@button-font-size:                              10px;
@button-mini-font-size:                         10px; // 11px / 12px
@button-small-font-size:                        10px; // 12px / 14px
@button-large-font-size:                        11px;

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

@button-primary-background:                     @global-primary-background;
@button-primary-hover-background:               darken(@global-primary-background, 15%);
@button-primary-active-background:              darken(@global-primary-background, 25%);
@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-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;


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

.hook-button() {
    border-radius: @global-border-radius;
    font-weight: bold;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.hook-button-hover() {}

.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() {}


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

.hook-button-link() {
    text-decoration: none !important;

    &:focus {
        outline: none;
    }
}


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

.hook-button-large() {}


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

.hook-button-misc() {


    /* 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: rgba(0,0,0,0.1);
        border-right-color: rgba(0,0,0,0.1);
        border-radius: 0;
    }

    .uk-button-group > .uk-button:first-child,
    .uk-button-group > div:first-child .uk-button {
        border-right-color: rgba(0,0,0,0.1);
        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: rgba(0,0,0,0.1);
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    /*
     * 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 { position: relative; }


    .uk-button-outline {
        background: none;
        color: #222;
        border-width: 1px;
        border-style: solid;
        border-color: currentColor;
        border-radius: 3px;

        &:hover, &:active {
            background: none;
            color: #000;
        }
    }

    .uk-button-outline.uk-button-primary {
        color: @button-primary-background;
        &:hover { color: darken(@button-primary-background, 10%); }
    }
    .uk-button-outline.uk-button-danger {
        color: @button-danger-background;
        &:hover { color: darken(@button-danger-background, 10%); }
    }
    .uk-button-outline.uk-button-success {
        color: @button-success-background;
        &:hover { color: darken(@button-success-background, 10%); }
    }

    .uk-button-group > .uk-button-outline::not(:last-child):not(:first-child) {
        border-left-color: none;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    .uk-button-group > .uk-button-outline:first-child:not(:last-child) {
        border-right-color: currentColor;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

}
