/**
 * @copyright   2010-2013, The Titon Project
 * @license     http://opensource.org/licenses/bsd-license.php
 * @link        http://titon.io
 */

@import "../common";

.#{$vendor-prefix}button-group {
    @include reset-inline-block;
    @include reset-list;
    white-space: nowrap;

    > li,
    > .#{$vendor-prefix}button {
        float: left;
        margin-left: -1px;
        border-radius: 0;

        &:first-child { margin-left: 0; }

        &:hover,
        &.#{$state-is-prefix}active { z-index: 1; }
    }

    > li {
        position: relative;
        list-style: none;

        .#{$vendor-prefix}button {
            display: block;
            border-radius: 0;
        }
    }

    &.#{$shape-round-class} {
        border-radius: $round;

        @include button-group-first-child {
            border-top-left-radius: $round;
            border-bottom-left-radius: $round;
        }

        @include button-group-last-child {
            border-top-right-radius: $round;
            border-bottom-right-radius: $round;
        }
    }

    @include clear-fix;
}

// Space out groups
.#{$vendor-prefix}button-group + .#{$vendor-prefix}button-group {
    margin-left: $margin;
}

//-------------------- Modifiers --------------------//

.#{$vendor-prefix}button-group--vertical {
    @extend .#{$vendor-prefix}button-group;
    vertical-align: top;

    > li,
    > .#{$vendor-prefix}button {
        float: none;
        display: block;
        margin: -1px 0 0 0;
        width: auto;
        max-width: 100%;

        &:first-child { margin-top: 0; }
        &:hover { z-index: 1; }
    }

    &.#{$shape-round-class},
    &.#{$shape-pill-class},
    &.#{$shape-skew-class},
    &.#{$shape-skew-class}-reverse {
        .#{$vendor-prefix}button { border-radius: 0; }
    }

    &.#{$shape-round-class} {
        @include button-group-first-child {
            border-top-left-radius: $round;
            border-top-right-radius: $round;
        }

        @include button-group-last-child {
            border-bottom-left-radius: $round;
            border-bottom-right-radius: $round;
        }
    }
}

.#{$vendor-prefix}button-group--justified {
    @extend .#{$vendor-prefix}button-group;
    display: table;
    width: 100%;

    > li,
    > .#{$vendor-prefix}button {
        float: none;
        display: table-cell;
        margin: 0 !important;
    }

    > li:not(:first-child) .#{$vendor-prefix}button,
    > .#{$vendor-prefix}button:not(:first-child) { border-left: 0; }
}