// COMPONENT VARIABLES
// -----------------------------------------------------------------------------

$btnPadding: 1em;
$btnRoundedRadius: .2em;
$btnGroupOuterRadius: 5px;
$btnGroupInnerRadius: 2px;



/*==============================================================================
 Buttons

 Styling for buttons

 Markup:
 <a href="#" class="b-btn {$modifiers}"> link </a>
 <button class="b-btn {$modifiers}"> Button </button>
 <input type="submit" class="b-btn {$modifiers}" value="input">

 #{$namespace}btn--primary - Primary button styling
 #{$namespace}btn--secondary - Secondary button styling
 ==============================================================================*/

#{$namespace}btn {
    user-select: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-border-radius:0; // remove border radius in iOS from input[submit]
    display: inline-block;
    width: 100%;
    text-align: center;
    vertical-align: middle;
    border: none;
    padding: $btnPadding/2 $btnPadding;
    line-height: normal;
    text-decoration: none;
    background-color: transparent;
    text-overflow: ellipsis;
    overflow: hidden;
    transition: all 100ms linear;

    &:hover {
        text-decoration: none;
    }

    &:focus {
        outline: thin dotted;
        outline-offset: -5px;
    }

    @include mq(mq-medium){
        width: auto;
    }
}



#{$namespace}btn--full {
    width: 100%;
}



#{$namespace}btn--large {
    font-size: 150%;
}



#{$namespace}btn--small {
    font-size: 50%;
}



#{$namespace}btn--pill {
    border-radius: 100px;
}



#{$namespace}btn--rounded {
    border-radius: $btnRoundedRadius;
}





//==============================================================================
// BUTTON VARIATIONS
//==============================================================================

#{$namespace}btn--primary{
    background-color: $btn-primary-bg;
    color: $btn-primary-text;

    &:hover,
    &:focus{
        background-color: lighten($btn-primary-bg, 50%);
        color: lighten($btn-primary-text, 50%);
    }
}



#{$namespace}btn--secondary{
    background-color: $btn-secondary-bg;
    color: $btn-secondary-text;

    &:hover,
    &:focus{
        background-color: lighten($btn-secondary-bg, 50%);
        color: lighten($btn-secondary-text, 50%);
    }
}



// Disbaled buttons
#{$namespace}btn--disabled,
#{$namespace}btn[disabled],
#{$namespace}btn[disabled="disabled"]{
    &,
    &:hover,
    &:active,{
        background-color: lighten($color-text, 20%);
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }
}



/*==============================================================================
 Buttons with icons

 Buttons with Icons

 Markup:
 <a href="#" class="b-btn bl-btn--icon {$modifiers}"> link </a>
 <button class="b-btn bl-btn--icon {$modifiers}"> Button </button>
 <input type="submit" class="b-btn bl-btn--icon {$modifiers}" value="input">

 #{$namespace}btn--icon
 ==============================================================================*/

#{$namespace}btn--icon {
    padding-left: $btnPadding*2.5;
    background-repeat: no-repeat;
    background-position: $btnPadding 50%;
    background-image: url(http://placehold.it/16x16);
}





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

 Buttons Group

 Markup:
 <div class="b-btn-group">
    <a href="#" class="b-btn bl-btn--icon {$modifiers}"> link </a>
    <button class="b-btn bl-btn--icon {$modifiers}"> Button </button>
    <input type="submit" class="b-btn bl-btn--icon {$modifiers}" value="input">
 </div>

 #{$namespace}btn-group
 ==============================================================================*/

#{$namespace}btn-group {
    @include rem(margin-bottom, $verticalspace);
    @include mq(mq-large){
        margin-right: $btnPadding;
        &:only-of-type {
            margin-right: 0;
        }
    }

    list-style: none;
    margin-left: 0;

    > #{$namespace}btn {
        @include mq(mq-medium){
            display: inline-block;
        }

        vertical-align: top;
    }
}



#{$namespace}btn-group--spaced {
    > #{$namespace}btn {
        margin-bottom: $btnPadding;

        &:last-child {
            margin-bottom: 0;
        }
    }

    @include mq(mq-large){
        > #{$namespace}btn {
            margin-right: $btnPadding;
            margin-bottom: 0;

            &:last-child{
                margin-right: 0;
            }
        }
    }
}



#{$namespace}btn-group--round {
    border-radius: $btnGroupOuterRadius;

    > #{$namespace}btn {
        &:first-child {
            border-radius: $btnGroupInnerRadius $btnGroupInnerRadius 0 0;
        }

        &:last-child {
            border-radius: 0 0 $btnGroupInnerRadius $btnGroupInnerRadius;
        }
    }

    @include mq(mq-medium){
        > #{$namespace}btn {
            &:first-child {
                border-radius: $btnGroupInnerRadius 0 0 $btnGroupInnerRadius;
            }

            &:last-child {
                border-radius: 0 $btnGroupInnerRadius $btnGroupInnerRadius 0;
            }
        }
    };
}
