//
// Button groups
// --------------------------------------------------


// Make the div behave like a button
.neos-button-group {
  position: relative;
  display: inline-block;
  @include ie7-inline-block();
  font-size: 0; // remove as part 1 of font-size inline-block hack
  vertical-align: middle; // match .neos-button alignment given font-size hack above
  white-space: nowrap; // prevent buttons from wrapping when in tight spaces (e.g., the table on the tests page)
  @include ie7-restore-left-whitespace();
}

// Space out series of button groups
.neos-button-group + .neos-button-group {
  margin-left: 5px;
}

// Optional: Group multiple button groups together for a toolbar
.neos-button-toolbar {
  font-size: 0; // Hack to remove whitespace that results from using inline-block
  margin-top: $baseLineHeight / 2;
  margin-bottom: $baseLineHeight / 2;
  > .neos-button + .neos-button,
  > .neos-button-group + .neos-button,
  > .neos-button + .neos-button-group {
    margin-left: 5px;
  }
}

// Float them, remove border radius, then re-add to first and last elements
.neos-button-group > .neos-button {
  position: relative;
  @include border-radius(0);
}
.neos-button-group > .neos-button + .neos-button {
  margin-left: -1px;
}

// Reset fonts for other sizes
.neos-button-group > .neos-button-mini {
  font-size: $fontSizeMini;
}
.neos-button-group > .neos-button-small {
  font-size: $fontSizeSmall;
}
.neos-button-group > .neos-button-large {
  font-size: $fontSizeLarge;
}

// Set corners individual because sometimes a single button can be in a .neos-button-group and we need :first-child and :last-child to both match
.neos-button-group > .neos-button:first-child {
  margin-left: 0;
}

// Reset corners for large buttons
.neos-button-group > .neos-button.neos-large:first-child {
  margin-left: 0;
}

// On hover/focus/active, bring the proper btn to front
.neos-button-group > .neos-button:hover,
.neos-button-group > .neos-button:focus,
.neos-button-group > .neos-button:active,
.neos-button-group > .neos-button.neos-active {
  z-index: 2;
}

// On active and open, don't show outline
.neos-button-group .neos-dropdown-toggle:active,
.neos-button-group.neos-open .neos-dropdown-toggle {
  outline: 0;
}



// Split button .neos-dropdowns
// ----------------------

// Give the line between buttons some depth
.neos-button-group > .neos-button + .neos-dropdown-toggle {
  padding-left: 8px;
  padding-right: 8px;
  @include box-shadow(inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05));
  *padding-top: 5px;
  *padding-bottom: 5px;
}
.neos-button-group > .neos-button-mini + .neos-dropdown-toggle {
  padding-left: 5px;
  padding-right: 5px;
  *padding-top: 2px;
  *padding-bottom: 2px;
}
.neos-button-group > .neos-button-small + .neos-dropdown-toggle {
  *padding-top: 5px;
  *padding-bottom: 4px;
}
.neos-button-group > .neos-button-large + .neos-dropdown-toggle {
  padding-left: 12px;
  padding-right: 12px;
  *padding-top: 7px;
  *padding-bottom: 7px;
}

.neos-button-group.neos-open {

  // The clickable button for toggling the menu
  // Remove the gradient and set the same inset shadow as the :active state
  .neos-dropdown-toggle {
    background-image: none;
    @include box-shadow(inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05));
  }

  // Keep the hover's background when .neos-dropdown is open
  .neos-button-primary.neos-dropdown-toggle {
    background-color: $btnPrimaryBackgroundHighlight;
  }
  .neos-button-warning.neos-dropdown-toggle {
    background-color: $btnWarningBackgroundHighlight;
  }
  .neos-button-danger.neos-dropdown-toggle {
    background-color: $btnDangerBackgroundHighlight;
  }
  .neos-button-success.neos-dropdown-toggle {
    background-color: $btnSuccessBackgroundHighlight;
  }
  .neos-button-info.neos-dropdown-toggle {
    background-color: $btnInfoBackgroundHighlight;
  }
  .neos-button-inverse.neos-dropdown-toggle {
    background-color: $btnInverseBackgroundHighlight;
  }
}


// Reposition the caret
.neos-button .neos-caret {
  margin-top: 8px;
  margin-left: 0;
}
// Carets in other button sizes
.neos-button-large .neos-caret {
  margin-top: 6px;
}
.neos-button-large .neos-caret {
  border-left-width:  5px;
  border-right-width: 5px;
  border-top-width:   5px;
}
.neos-button-mini .neos-caret,
.neos-button-small .neos-caret {
  margin-top: 8px;
}
// Upside down carets for .neos-dropup
.neos-dropup .neos-button-large .neos-caret {
  border-bottom-width: 5px;
}



// Account for other colors
.neos-button-primary,
.neos-button-warning,
.neos-button-danger,
.neos-button-info,
.neos-button-success,
.neos-button-inverse {
  .neos-caret {
    border-top-color: $white;
    border-bottom-color: $white;
  }
}



// Vertical button groups
// ----------------------

.neos-button-group-vertical {
  display: inline-block; // makes buttons only take up the width they need
  @include ie7-inline-block();
}
.neos-button-group-vertical > .neos-button {
  display: block;
  float: none;
  max-width: 100%;
  @include border-radius(0);
}
.neos-button-group-vertical > .neos-button + .neos-button {
  margin-left: 0;
  margin-top: -1px;
}
.neos-button-group-vertical > .neos-button:first-child {
  @include border-radius($baseBorderRadius $baseBorderRadius 0 0);
}
.neos-button-group-vertical > .neos-button:last-child {
  @include border-radius(0 0 $baseBorderRadius $baseBorderRadius);
}
.neos-button-group-vertical > .neos-button-large:first-child {
  @include border-radius($borderRadiusLarge $borderRadiusLarge 0 0);
}
.neos-button-group-vertical > .neos-button-large:last-child {
  @include border-radius(0 0 $borderRadiusLarge $borderRadiusLarge);
}
