/// <reference path="../shared/_mixins.scss" />
/// <reference path="../bs4/scss/bootstrap.scss" />
//
// Variables
// --------------------------------------------------
// Variables directly translating Bootstrap variables
// -------------------------
$s2bs-border-radius-base: $input-border-radius !default;
$s2bs-border-radius-large: $input-border-radius-lg !default;
$s2bs-border-radius-small: $input-border-radius-sm !default;
$s2bs-btn-default-bg: theme-color("secondary") !default;
$s2bs-btn-default-border: $input-border-color !default;
$s2bs-caret-width-base: 0.35rem !default;
$s2bs-caret-width-large: 0.35rem !default;
$s2bs-cursor-disabled: not-allowed !default;
$s2bs-dropdown-header-color: $gray-700 !default;
$s2bs-dropdown-link-active-bg: $gray-100 !default;
$s2bs-dropdown-link-active-color: $yiq-text-dark !default;
$s2bs-dropdown-link-disabled-color: $dropdown-link-disabled-color !default;
$s2bs-dropdown-link-hover-bg: $gray-100 !default;
$s2bs-dropdown-link-hover-color: $yiq-text-dark !default;
$s2bs-font-size-base: $font-size-base !default;
$s2bs-font-size-large: $font-size-lg !default;
$s2bs-font-size-small: $font-size-sm !default;
$s2bs-padding-base-horizontal: $input-btn-padding-x !default;
$s2bs-padding-large-horizontal: $input-btn-padding-x-lg !default;
$s2bs-padding-small-horizontal: $input-btn-padding-x-sm !default;
$s2bs-padding-base-vertical: $input-btn-padding-y !default;
$s2bs-padding-large-vertical: $input-btn-padding-y-lg !default;
$s2bs-padding-small-vertical: $input-btn-padding-y-sm !default;
$s2bs-line-height-base: $line-height-base !default;
$s2bs-line-height-large: $line-height-lg !default;
$s2bs-line-height-small: $line-height-sm !default;
$s2bs-input-bg: $input-bg !default;
$s2bs-input-bg-disabled: $input-disabled-bg !default;
$s2bs-input-color: $input-color !default;
$s2bs-input-color-placeholder: $input-placeholder-color !default;
$s2bs-input-border: $input-border-color !default;
$s2bs-input-border-focus: $s2bs-input-border; // $input-focus-border-color !default;
$s2bs-input-border-radius: $input-border-radius !default;
$s2bs-input-height-base: $input-height !default;
$s2bs-input-height-large: $input-height-lg !default;
$s2bs-input-height-small: $input-height-sm !default;
// Theme-specific variables
// -------------------------
$s2bs-dropdown-arrow-color: $input-color !default;
$s2bs-dropdown-box-shadow: $dropdown-box-shadow !default;
$s2bs-dropdown-box-shadow-above: 0 -3px 12px rgba(27, 31, 35, 0.15) !default;
$s2bs-clear-selection-color: $s2bs-input-color-placeholder !default;
$s2bs-clear-selection-hover-color: $body-color !default;
$s2bs-remove-choice-color: $input-placeholder-color !default;
$s2bs-remove-choice-hover-color: $body-color !default;
$s2bs-selection-choice-border-radius: $input-border-radius-sm !default;
$s2bs-dropdown-header-padding-vertical: $s2bs-padding-base-vertical !default;
$s2bs-dropdown-header-font-size: $s2bs-font-size-base !default;
// SMNET extra styling
// -------------------------
$s2sm-inner-border-color: rgba(#000, 0.08);
$s2sm-option-padding-vertical: 0.5rem;
$s2sm-option-font-size: 0.75rem;
$s2sm-shade-bg: $gray-100;
$s2sm-caret-width: $input-height;
$s2sm-caret-width-lg: $input-height-lg;
$s2sm-caret-width-sm: $input-height-sm;
// Bootstrap defaults not available as pre-defined variables
// These should not be overridden.
// -------------------------
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L126
$s2bs-form-control-default-box-shadow: $input-box-shadow;
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/mixins/_forms.scss#L60
$s2bs-form-control-focus-box-shadow: $dropdown-box-shadow; // $input-focus-box-shadow;
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L127
$s2bs-form-control-transition: none; // border-color ease-in-out .15s, box-shadow ease-in-out .15s !default;
//
// Mixins
// --------------------------------------------------
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L115
@mixin bootstrap-input-defaults {
	@include box-shadow($s2bs-form-control-default-box-shadow);
	background-color: $s2bs-input-bg;
	border: 1px solid $s2bs-input-border;
	border-radius: $s2bs-input-border-radius;
	color: $s2bs-input-color;
	font-size: $s2bs-font-size-base;
}

// @see http://getbootstrap.com/css/#forms-control-validation
// @see https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_forms.scss#L388
@mixin validation-state-focus($color) {
	$shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px lighten($color, 20%);

	.select2-dropdown,
	.select2-selection {
		border-color: $color;
	}
	/*.select2-container--focus .select2-selection,
  .select2-container--open .select2-selection {
    box-shadow: $shadow;
    border-color: darken($color, 10%);
  }

  &.select2-drop-active {
    border-color: darken($color, 10%);

    &.select2-drop.select2-drop-above {
      border-top-color: darken($color, 10%);
    }
  }*/
}

// dropdown arrow when dropdown is open
@mixin dropdown-arrow {
	.select2-selection--single {
		/**
     * Make the dropdown arrow point up while the dropdown is visible.
     */
		.select2-selection__arrow b {
			border-color: transparent transparent $s2bs-dropdown-arrow-color transparent;
			border-width: 0 $s2bs-caret-width-large $s2bs-caret-width-large $s2bs-caret-width-large;
		}
	}
}

.select2-container--bootstrap {
	display: block;
	/*------------------------------------*\
      #COMMON STYLES
  \*------------------------------------*/
	.select2-selection {
		@include bootstrap-input-defaults;
		outline: 0;

		&.form-control {
			border-radius: $s2bs-border-radius-base;
		}
	}
	/**
   * Search field in the Select2 dropdown.
   */
	.select2-search--dropdown {
		.select2-search__field {
			@include bootstrap-input-defaults;
			border-radius: 0;
		}
	}
	/**
   * No outline for all search fields - in the dropdown
   * and inline in multi Select2s.
   */
	.select2-search__field {
		outline: 0;

		&:focus {
			border-color: $input-focus-border-color;
		}

		&::-webkit-input-placeholder {
			color: $s2bs-input-color-placeholder;
		}
		/* Firefox 18- */
		&:-moz-placeholder {
			color: $s2bs-input-color-placeholder;
		}
		/**
     * Firefox 19+
     *
     * @see http://stackoverflow.com/questions/24236240/color-for-styled-placeholder-text-is-muted-in-firefox
     */
		&::-moz-placeholder {
			color: $s2bs-input-color-placeholder;
			opacity: 1;
		}

		&:-ms-input-placeholder {
			color: $s2bs-input-color-placeholder;
		}
	}
	/**
   * Adjust Select2's choices hover and selected styles to match
   * Bootstrap 4's default dropdown styles.
   *
   * @see http://getbootstrap.com/components/#dropdowns
   */
	.select2-results__option {
		padding: $input-btn-padding-y-sm $s2bs-padding-base-horizontal;

		&[role=group] {
			padding: 0;
		}

		&[aria-disabled=true] {
			color: $s2bs-dropdown-link-disabled-color;
			cursor: $s2bs-cursor-disabled;
		}

		&[aria-selected=true] {
			color: $s2bs-dropdown-link-hover-color;
			font-weight: $font-weight-medium;
		}

		&--highlighted[aria-selected] {
			background-color: $s2bs-dropdown-link-active-bg;
			color: $s2bs-dropdown-link-active-color;
		}

		.select2-results__option {
			padding: $input-btn-padding-y-sm $s2bs-padding-base-horizontal;

			.select2-results__group {
				padding-left: 0;
			}

			.select2-results__option {
				margin-left: -$s2bs-padding-base-horizontal;
				padding-left: $s2bs-padding-base-horizontal*2;

				.select2-results__option {
					margin-left: -$s2bs-padding-base-horizontal*2;
					padding-left: $s2bs-padding-base-horizontal*3;

					.select2-results__option {
						margin-left: -$s2bs-padding-base-horizontal*3;
						padding-left: $s2bs-padding-base-horizontal*4;

						.select2-results__option {
							margin-left: -$s2bs-padding-base-horizontal*4;
							padding-left: $s2bs-padding-base-horizontal*5;

							.select2-results__option {
								margin-left: -$s2bs-padding-base-horizontal*5;
								padding-left: $s2bs-padding-base-horizontal*6;
							}
						}
					}
				}
			}
		}
	}

	.select2-results__group {
		color: inherit; // $s2bs-dropdown-header-color;
		display: block;
		padding: $s2bs-dropdown-header-padding-vertical $s2bs-padding-base-horizontal;
		white-space: nowrap;
		font-weight: 600;
		border-bottom: 1px solid rgba(#000, 0.1);

		.select2-option {
			font-size: $s2bs-dropdown-header-font-size;
			line-height: $s2bs-line-height-base;
		}
	}

	&.select2-container--focus {
		.select2-selection {
			border-color: $input-focus-border-color;
		}
	}

	&.select2-container--open {
		.select2-selection {
			@include box-shadow($s2bs-form-control-focus-box-shadow);
			border-color: $s2bs-input-border-focus;
		}

		&.select2-container--above .select2-selection {
			@include box-shadow(0 0px 12px rgba(27, 31, 35, 0.15));
		}
	}

	&.select2-container--open {
		// Make the dropdown arrow point up while the dropdown is visible.
		.select2-selection .select2-selection__arrow b {
			border-color: transparent transparent $s2bs-dropdown-arrow-color transparent;
			border-width: 0 $s2bs-caret-width-base $s2bs-caret-width-base $s2bs-caret-width-base;
		}
		// Handle border radii of the container when the dropdown is showing.
		&.select2-container--below {
			.select2-selection {
				@include border-bottom-radius(0);
				border-bottom-color: transparent;
			}
		}

		&.select2-container--above {
			.select2-selection {
				@include border-top-radius(0);
				border-top-color: transparent;
			}
		}
	}

	.select2-selection__clear {
		color: $s2bs-clear-selection-color;
		cursor: pointer;
		float: right;
		font-weight: bold;
		//margin-right: 10px;
		&:hover {
			color: $s2bs-clear-selection-hover-color;
		}
	}

	&.select2-container--disabled {
		.select2-selection {
			border-color: $s2bs-input-border;
			box-shadow: none;
		}

		.select2-selection,
		.select2-search__field {
			cursor: $s2bs-cursor-disabled;
		}

		.select2-selection,
		.select2-selection--multiple .select2-selection__choice {
			background-color: $s2bs-input-bg-disabled;
		}

		.select2-selection__clear,
		.select2-selection--multiple .select2-selection__choice__remove {
			display: none;
		}
	}
	/*------------------------------------*\
      #DROPDOWN
  \*------------------------------------*/
	/**
   * Dropdown border color and box-shadow.
   */
	.select2-dropdown {
		box-shadow: $s2bs-dropdown-box-shadow;
		border-color: $s2bs-input-border-focus;
		overflow-x: hidden;
		margin-top: -1px;

		&--above {
			box-shadow: $s2bs-dropdown-box-shadow-above;
			margin-top: 1px;
		}
	}
	/**
   * Limit the dropdown height.
   */
	.select2-results > .select2-results__options {
		max-height: 320px;
		overflow-y: auto;
	}
	/*------------------------------------*\
      #SINGLE SELECT2
  \*------------------------------------*/
	.select2-selection--single {
		height: $s2bs-input-height-base;
		line-height: $s2bs-line-height-base;
		padding-top: $s2bs-padding-base-vertical;
		padding-bottom: $s2bs-padding-base-vertical;
		padding-left: $s2bs-padding-base-horizontal;
		padding-right: calc(#{$s2sm-caret-width} + #{$s2bs-padding-base-horizontal / 2});
		//padding-right: ($s2bs-padding-base-horizontal + ($s2bs-caret-width-base * 3));
		/**
     * Adjust the single Select2's dropdown arrow button appearance.
     */
		.select2-selection__clear {
			margin-top: -2px;
			margin-right: 4px;
		}

		.select2-selection__arrow {
			position: absolute;
			top: 1px;
			bottom: 1px;
			right: 1px;
			border: 0 solid $input-border-color;
			border-left-width: 1px;
			width: $s2sm-caret-width;
			background-color: $s2sm-shade-bg;

			b {
				border-color: $s2bs-dropdown-arrow-color transparent transparent transparent;
				border-style: solid;
				border-width: $s2bs-caret-width-base $s2bs-caret-width-base 0 $s2bs-caret-width-base;
				height: 0;
				margin-left: -$s2bs-caret-width-base;
				margin-top: -$s2bs-caret-width-base/2;
				position: absolute;
				top: 50%;
				width: 0;
				left: 50%;
			}
		}

		.select2-selection__rendered {
			color: $s2bs-input-color;
			padding: 0;
		}

		.select2-selection__placeholder {
			color: $s2bs-input-color-placeholder;
		}
	}
	/*------------------------------------*\
    #MULTIPLE SELECT2
  \*------------------------------------*/
	.select2-selection--multiple {
		min-height: $s2bs-input-height-base;
		padding: 0;
		height: auto;

		.select2-selection__rendered {
			box-sizing: border-box;
			display: block;
			line-height: $s2bs-line-height-base;
			list-style: none;
			margin: 0;
			overflow: hidden;
			padding: 0;
			width: 100%;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.select2-selection__placeholder {
			color: $s2bs-input-color-placeholder;
			float: left;
			margin-top: 5px;
		}
		/**
     * Make Multi Select2's choices match Bootstrap 3's default button styles.
     */
		.select2-selection__choice {
			color: $s2bs-input-color;
			background: $s2bs-btn-default-bg;
			background: $gray-100;
			border: 1px solid $s2bs-btn-default-border;
			border-radius: 2px; // $s2bs-selection-choice-border-radius;
			cursor: default;
			float: left;
			margin: ($s2bs-padding-base-vertical) 0 0 $s2bs-padding-base-horizontal/2;
			transform: translateY(-1px);
			padding: 0 $s2bs-padding-base-vertical;
		}
		/**
     * Minus 2px borders.
     */
		.select2-search--inline {
			.select2-search__field {
				background: transparent;
				padding: 0 $s2bs-padding-base-horizontal;
				height: calc(#{$s2bs-input-height-base} - #{$border-width * 2});
				line-height: $s2bs-line-height-base;
				margin-top: 0;
				min-width: 5em;
			}
		}

		.select2-selection__choice__remove {
			color: $s2bs-remove-choice-color;
			cursor: pointer;
			display: inline-block;
			font-weight: bold;
			margin-right: $s2bs-padding-base-vertical / 2;

			&:hover {
				color: $s2bs-remove-choice-hover-color;
			}
		}
		/**
     * Clear the selection.
     */
		.select2-selection__clear {
			margin-top: $s2bs-padding-base-vertical;
			margin-right: $s2bs-padding-base-horizontal;
		}
	}
	/**
   * Address Bootstrap control sizing classes
   *
   * 1. Reset Bootstrap defaults.
   * 2. Adjust the dropdown arrow button icon position.
   *
   * @see http://getbootstrap.com/css/#forms-control-sizes
   */
	/* 1 */
	.select2-selection--single.input-sm,
	.form-control-sm + & .select2-selection--single,
	.input-group-sm & .select2-selection--single,
	.form-group-sm & .select2-selection--single {
		border-radius: $s2bs-border-radius-small;
		font-size: $s2bs-font-size-small;
		height: $s2bs-input-height-small;
		line-height: $s2bs-line-height-small;
		padding: $s2bs-padding-small-vertical $s2bs-padding-small-horizontal + $s2bs-caret-width-base*3 $s2bs-padding-small-vertical $s2bs-padding-small-horizontal;
		/* 2 */
		.select2-selection__arrow {
			width: calc(#{$input-height-sm} - 1px);
		}
	}

	.select2-selection--multiple.input-sm,
	.form-control-sm + & .select2-selection--multiple,
	.input-group-sm & .select2-selection--multiple,
	.form-group-sm & .select2-selection--multiple {
		min-height: $s2bs-input-height-small;
		border-radius: $s2bs-border-radius-small;

		.select2-selection__choice {
			font-size: $s2bs-font-size-small;
			line-height: $s2bs-line-height-small;
			margin: ($s2bs-padding-small-vertical - 1) 0 0 $s2bs-padding-small-horizontal/2;
			padding: 0 $s2bs-padding-small-vertical;
		}

		.select2-search--inline .select2-search__field {
			padding: 0 $s2bs-padding-small-horizontal;
			font-size: $s2bs-font-size-small;
			height: $s2bs-input-height-small - 2;
			line-height: $s2bs-line-height-small;
		}

		.select2-selection__clear {
			margin-top: $s2bs-padding-small-vertical;
		}
	}

	.select2-selection--single.input-lg,
	.form-control-lg + & .select2-selection--single,
	.input-group-lg & .select2-selection--single,
	.form-group-lg & .select2-selection--single {
		border-radius: $s2bs-border-radius-large;
		font-size: $s2bs-font-size-large;
		height: $s2bs-input-height-large;
		line-height: $s2bs-line-height-large;
		//padding: $s2bs-padding-large-vertical $s2bs-padding-large-horizontal + $s2bs-caret-width-large*3 $s2bs-padding-large-vertical $s2bs-padding-large-horizontal;
		padding-top: $s2bs-padding-large-vertical;
		padding-right: calc(#{$s2bs-input-height-large} + #{$s2bs-caret-width-large*2});
		padding-bottom: $s2bs-padding-large-vertical;
		padding-left: $s2bs-padding-large-horizontal;
		/* 1 */
		.select2-selection__arrow {
			width: $input-height-lg;
		}
	}

	.select2-selection--multiple.input-lg,
	.form-control-sm + & .select2-selection--multiple,
	.input-group-lg & .select2-selection--multiple,
	.form-group-lg & .select2-selection--multiple {
		min-height: $s2bs-input-height-large;
		border-radius: $s2bs-border-radius-large;

		.select2-selection__choice {
			font-size: $s2bs-font-size-large;
			line-height: $s2bs-line-height-large;
			border-radius: $s2bs-selection-choice-border-radius;
			margin: ($s2bs-padding-large-vertical - 1) 0 0 $s2bs-padding-large-horizontal/2;
			padding: 0 $s2bs-padding-large-vertical;
		}

		.select2-search--inline .select2-search__field {
			padding: 0 $s2bs-padding-large-horizontal;
			font-size: $s2bs-font-size-large;
			height: $s2bs-input-height-large - 2;
			line-height: $s2bs-line-height-large;
		}

		.select2-selection__clear {
			margin-top: $s2bs-padding-large-vertical;
		}
	}
	/*.form-control-lg + .select2-container--open select2-selection,
	.input-group-lg & .select2-container--open .select2-selection {
		@include dropdown-arrow;
	}*/
	/*------------------------------------*\
      #SMNET SPECIFIC STYLES
	\*------------------------------------*/
	&.select2-container--open .select2-selection {
		background-color: $s2sm-shade-bg;
	}

	&.select2-container--open .select2-selection__arrow {
		border-color: transparent;
	}

	.select2-results {
		background: $dropdown-bg;
	}

	.select2-results__option {
		//font-size: $s2sm-option-font-size;
		position: relative;
		border-bottom: 1px solid $s2sm-inner-border-color;

		> .select2-option {
			display: block;
			font-size: $s2sm-option-font-size;
			padding-left: 18px;

			&:before {
				position: absolute;
				left: $s2bs-padding-base-horizontal;
				@include fontawesome("\f00c");
				color: $success;
				text-align: left;
				width: 18px;
				line-height: $line-height-base;
				visibility: hidden;
			}
		}

		&[aria-selected=true] > .select2-option:before {
			visibility: visible;
		}
	}

	.select2-results__option:last-child {
		border-bottom-width: 0;
	}

	.select2-dropdown--below .select2-results {
		border-top: 1px solid darken($s2sm-shade-bg, 10%);
	}

	.select2-dropdown--above .select2-results {
		border-bottom: 1px solid darken($s2sm-shade-bg, 10%);
	}

	.select2-search--dropdown {
		padding: 0 $s2bs-padding-base-horizontal 0.5rem $s2bs-padding-base-horizontal;
		background-color: $s2sm-shade-bg;
	}

	.select2-dropdown--above .select2-search--dropdown {
		padding-bottom: 0.5rem;
		padding-top: 0.5rem;
	}

	.select2-selection--single.select-customtemplate,
	.drop-customtemplate .select2-results__option {
		padding-left: 0.5rem;
		padding-top: 0.25rem;
		padding-bottom: 0.25rem;
	}

	.select2-selection--single.select-customtemplate {
		display: flex;
		align-items: center;

		> .select2-selection__rendered {
			width: 100%;

			> .select2-selection__clear {
				margin-top: 5px;
			}
		}
	}
	/*------------------------------------*\
    #RTL SUPPORT
  \*------------------------------------*/
	&[dir="rtl"] {
		.select2-selection--single {
			padding-right: $s2bs-padding-base-horizontal;
			padding-left: calc(#{$s2sm-caret-width} + #{$s2bs-padding-base-horizontal / 2});

			.select2-selection__rendered {
				padding-right: 0;
				padding-left: 0;
				text-align: right;
			}

			.select2-selection__clear {
				float: left;
				margin-left: 4px;
				margin-right: initial;
			}

			.select2-selection__arrow {
				left: 1px;
				right: auto;
				border-left-width: 0;
				border-right-width: 1px;
			}
		}

		.select2-selection--multiple {
			.select2-search--inline {
				float: right;
			}

			.select2-selection__choice,
			.select2-selection__placeholder {
				float: right;
			}

			.select2-selection__choice {
				margin-left: 0;
				margin-right: $s2bs-padding-base-horizontal/2;
			}

			.select2-selection__choice__remove {
				margin-left: 2px;
				margin-right: auto;
			}
		}
	}

	// RTL for dropdown
	> [dir="rtl"] {
		.select2-results__option > .select2-option {
			padding-right: 18px;
			padding-left: initial;

			&:before {
				right: $s2bs-padding-base-horizontal;
				left: auto;
				text-align: right;
			}
		}
	}
}


/*------------------------------------*\
  #ADDITIONAL GOODIES
\*------------------------------------*/


/**
 * Address Bootstrap's validation states
 *
 * If a Select2 widget parent has one of Bootstrap's validation state modifier
 * classes, adjust Select2's border colors and focus states accordingly.
 * You may apply said classes to the Select2 dropdown (body > .select2-container)
 * via JavaScript match Bootstraps' to make its styles match.
 *
 * @see http://getbootstrap.com/css/#forms-control-validation
 */


/*select.is-valid + .select2:not(.select2-container--open) {
	@include validation-state-focus($form-feedback-valid-color);
}*/


/*.has-warning {
  @include validation-state-focus(theme-color-level("warning", 1));
}*/

select.is-invalid + .select2:not(.select2-container--open) {
	@include validation-state-focus($form-feedback-invalid-color);
}


/**
 * Select2 widgets in Bootstrap Input Groups
 *
 * When Select2 widgets are combined with other elements using Bootstraps
 * "Input Group" component, we don't want specific edges of the Select2
 * container to have a border-radius.
 *
 * Use .select2-bootstrap-prepend and .select2-bootstrap-append on
 * a Bootstrap 3 .input-group to let the contained Select2 widget know which
 * edges should not be rounded as they are directly followed by another element.
 *
 * @see http://getbootstrap.com/components/#input-groups
 */


/**
 * Mimick Bootstraps .input-group .form-control styles.
 *
 * @see https://github.com/twbs/bootstrap/blob/master/less/input-groups.less
 */

.input-group .select2-container--bootstrap {
	display: table;
	table-layout: fixed;
	position: relative;
	z-index: 2;
	float: left;
	width: 100%;
	margin-bottom: 0;
	/**
   * Adjust z-index like Bootstrap does to show the focus-box-shadow
   * above appended buttons in .input-group and .form-group.
   */
	&.select2-container--open,
	/* .form-group */
	&.select2-container--focus /* .input-group */ {
		z-index: 3;
	}
}

.input-group.select2-bootstrap-prepend .select2-container--bootstrap {
	.select2-selection {
		@include border-left-radius(0);
	}
}

.input-group.select2-bootstrap-append .select2-container--bootstrap {
	.select2-selection {
		@include border-right-radius(0);
	}
}


/**
 * Adjust alignment of Bootstrap buttons in Bootstrap Input Groups to address
 * Multi Select2's height which - depending on how many elements have been selected -
 * may grow taller than its initial size.
 *
 * @see http://getbootstrap.com/components/#input-groups
 */

.select2-bootstrap-append,
.select2-bootstrap-prepend {
	.select2-container--bootstrap,
	.input-group-btn,
	.input-group-btn .btn {
		vertical-align: top;
	}
}


/**
 * Temporary fix for https://github.com/select2/select2-bootstrap-theme/issues/9
 *
 * Provides `!important` for certain properties of the class applied to the
 * original `<select>` element to hide it.
 *
 * @see https://github.com/select2/select2/pull/3301
 * @see https://github.com/fk/select2/commit/31830c7b32cb3d8e1b12d5b434dee40a6e753ada
 */

.form-control.select2-hidden-accessible {
	position: absolute !important;
	width: 1px !important;
}


/**
 * Display override for inline forms
 */

.form-inline .select2-container--bootstrap {
	display: inline-block;
}
