/**
 * selectize.bootstrap2.css (v0.12.6) - Bootstrap 2 Theme
 * Copyright (c) 2013–2015 Brian Reavis & contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the License at:
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 *
 * @author Brian Reavis <brian@thirdroute.com>
 */

@import "selectize";

@selectize-font-family: @baseFontFamily;
@selectize-font-size: @baseFontSize;
@selectize-line-height: @baseLineHeight;

@selectize-color-text: @textColor;
@selectize-color-highlight: rgba(255,237,40,0.4);
@selectize-color-input: @inputBackground;
@selectize-color-input-full: @inputBackground;
@selectize-color-disabled: @inputBackground;
@selectize-color-item: @btnBackgroundHighlight;
@selectize-color-item-border: @btnBorder;
@selectize-color-item-active: @dropdownLinkBackgroundHover;
@selectize-color-item-active-text: @dropdownLinkColorHover;
@selectize-color-item-active-border: darken(@selectize-color-item-active, 5%);
@selectize-color-optgroup: @dropdownBackground;
@selectize-color-optgroup-text: @grayLight;
@selectize-color-optgroup-border: @dropdownDividerTop;
@selectize-color-dropdown: @dropdownBackground;
@selectize-color-dropdown-border: @inputBorder;
@selectize-color-dropdown-border-top: @dropdownDividerTop;
@selectize-color-dropdown-item-active: @dropdownLinkBackgroundHover;
@selectize-color-dropdown-item-active-text: @dropdownLinkColorHover;
@selectize-color-dropdown-item-create-active-text: @dropdownLinkColorHover;
@selectize-lighten-disabled-item: 8%;
@selectize-lighten-disabled-item-text: 8%;
@selectize-lighten-disabled-item-border: 8%;
@selectize-opacity-disabled: 0.5;
@selectize-shadow-input: none;
@selectize-shadow-input-focus: inset 0 1px 2px rgba(0,0,0,0.15);
@selectize-border-radius: @inputBorderRadius;

@selectize-padding-x: 10px;
@selectize-padding-y: 7px;
@selectize-padding-dropdown-item-x: @selectize-padding-x;
@selectize-padding-dropdown-item-y: 3px;
@selectize-padding-item-x: 3px;
@selectize-padding-item-y: 1px;
@selectize-margin-item-x: 3px;
@selectize-margin-item-y: 3px;
@selectize-caret-margin: 0;

@selectize-arrow-size: 5px;
@selectize-arrow-color: @black;
@selectize-arrow-offset: @selectize-padding-x + 5px;

@selectize-width-item-border: 1px;

.selectize-dropdown {
	margin: 2px 0 0 0;
	z-index: @zindexDropdown;
	border: 1px solid @dropdownBorder;
	border-radius: @baseBorderRadius;
	.box-shadow(0 5px 10px rgba(0,0,0,.2));

	.optgroup-header {
		font-size: 11px;
		font-weight: bold;
		text-shadow: 0 1px 0 rgba(255,255,255,.5);
		text-transform: uppercase;
	}
	.optgroup:first-child:before {
		display: none;
	}
	.optgroup:before {
		content: ' ';
		display: block;
		.nav-divider();
		margin-left: @selectize-padding-dropdown-item-x * -1;
		margin-right: @selectize-padding-dropdown-item-x * -1;
	}

	[data-selectable].active {
		#gradient > .vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%));
	}
}

.selectize-dropdown-content {
	padding: 5px 0;
}

.selectize-dropdown-header {
	padding: @selectize-padding-dropdown-item-y * 2 @selectize-padding-dropdown-item-x;
}

.selectize-input {
	.transition(~"border linear .2s, box-shadow linear .2s");

	&.dropdown-active {
		.selectize-border-radius(@selectize-border-radius);
	}
	&.dropdown-active::before {
		display: none;
	}
	&.input-active, &.input-active:hover, .selectize-control.multi &.focus {
		background: @selectize-color-input !important;
		border-color: rgba(82,168,236,.8) !important;
		outline: 0 !important;
		outline: thin dotted \9 !important;
		.box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)") !important;
	}
}

.selectize-control {
	&.single {
		.selectize-input {
			.buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark, 0 1px 1px rgba(255,255,255,.75));
  			.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
  			&:hover {
				color: @grayDark;
				text-decoration: none;
				background-position: 0 -15px;
				.transition(background-position .1s linear);
  			}
  			&.disabled {
				background: @btnBackgroundHighlight !important;
				.box-shadow(none);
			}
		}
	}
	&.multi {
		.selectize-input {
			.box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
			&.has-items {
				@padding-x: @selectize-padding-x - @selectize-padding-item-x;
				padding-left: @padding-x;
				padding-right: @padding-x;
			}
		}
		.selectize-input > div {
			.gradientBar(@btnBackground, @btnBackgroundHighlight, @selectize-color-item-text, none);
			*background-color: @selectize-color-item;
			border: @selectize-width-item-border solid @selectize-color-item-border;
			.border-radius(@baseBorderRadius);
			.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
			&.active {
				.box-shadow(~"0 1px 2px rgba(0,0,0,.05)");
				.gradientBar(@selectize-color-item-active, @selectize-color-item-active-border, @selectize-color-item-active-text, none);
				*background-color: @selectize-color-item-active;
				border: @selectize-width-item-border solid @dropdownLinkBackgroundHover;
			}
		}
	}
}