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


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

@button-line-height:                            @global-control-height - (@button-border-width * 2);
@button-small-line-height:                      @global-control-small-height - (@button-border-width * 2);
@button-large-line-height:                      @global-control-large-height - (@button-border-width * 2);

//
// New
//

@button-border-mode:                            ;

@button-border-width:                           0;

@button-default-border:                         transparent;
@button-default-hover-border:                   transparent;
@button-default-active-border:                  transparent;

@button-primary-border:                         transparent;
@button-primary-hover-border:                   transparent;
@button-primary-active-border:                  transparent;

@button-secondary-border:                       transparent;
@button-secondary-hover-border:                 transparent;
@button-secondary-active-border:                transparent;

@button-danger-border:                          transparent;
@button-danger-hover-border:                    transparent;
@button-danger-active-border:                   transparent;

@button-disabled-border:                        transparent;


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

.hook-button() {}

.hook-button-hover() {}

.hook-button-focus() {}

.hook-button-active() {}


// Style modifiers
// ========================================================================

.hook-button-default() when not (@button-border-width = 0) {
    border@{button-border-mode}: @button-border-width solid @button-default-border;
}

.hook-button-default-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-default-hover-border;
}

.hook-button-default-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-default-active-border;
}

//
// Primary
//

.hook-button-primary() when not (@button-border-width = 0) {
    border@{button-border-mode}: @button-border-width solid @button-primary-border;
}

.hook-button-primary-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-primary-hover-border;
}

.hook-button-primary-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-primary-active-border;
}

//
// Secondary
//

.hook-button-secondary() when not (@button-border-width = 0) {
    border@{button-border-mode}: @button-border-width solid @button-secondary-border;
}

.hook-button-secondary-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-secondary-hover-border;
}

.hook-button-secondary-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-secondary-active-border;
}

//
// Danger
//

.hook-button-danger() when not (@button-border-width = 0) {
    border@{button-border-mode}: @button-border-width solid @button-danger-border;
}

.hook-button-danger-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-danger-hover-border;
}

.hook-button-danger-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @button-danger-active-border;
}


// Disabled
// ========================================================================

.hook-button-disabled() when not (@button-border-width = 0) {
    border@{button-border-mode}: @button-border-width solid @button-disabled-border;
}


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

.hook-button-small() {}

.hook-button-large() {}


// Text modifier
// ========================================================================

.hook-button-text() {}

.hook-button-text-hover() {}

.hook-button-text-disabled() {}


// Link modifier
// ========================================================================

.hook-button-link() {}


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

.hook-button-misc() when not (@button-border-width = 0) {

    /* Group
     ========================================================================== */

    /*
     * Collapse border
     */

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

    /*
     * 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:focus,
    .uk-button-group .uk-button:active,
    .uk-button-group .uk-button.uk-active {
        position: relative;
        z-index: 1;
    }

}


// Inverse
// ========================================================================

@inverse-button-default-border:                         transparent;
@inverse-button-default-hover-border:                   transparent;
@inverse-button-default-active-border:                  transparent;

@inverse-button-primary-border:                         transparent;
@inverse-button-primary-hover-border:                   transparent;
@inverse-button-primary-active-border:                  transparent;

@inverse-button-secondary-border:                       transparent;
@inverse-button-secondary-hover-border:                 transparent;
@inverse-button-secondary-active-border:                transparent;

.hook-inverse-button-default() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-default-border;
}
.hook-inverse-button-default-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-default-hover-border;
}
.hook-inverse-button-default-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-default-active-border;
}

.hook-inverse-button-primary() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-primary-border;
}
.hook-inverse-button-primary-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-primary-hover-border;
}
.hook-inverse-button-primary-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-primary-active-border;
}

.hook-inverse-button-secondary() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-secondary-border;
}
.hook-inverse-button-secondary-hover() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-secondary-hover-border;
}
.hook-inverse-button-secondary-active() when not (@button-border-width = 0) {
    border@{button-border-mode}-color: @inverse-button-secondary-active-border;
}

.hook-inverse-button-text() {}
.hook-inverse-button-text-hover() {}
.hook-inverse-button-text-disabled() {}
