/** Button Borders **/
.button-border(@gradient, @color) when (@gradient = false) {
	border: 1px solid @button-border-color;
}
.button-border (@gradient, @color) when (default()) {
	border: none;
}

.button-border-gradient (@gradient, @top, @bottom) when (@gradient = true) {
	.border-gradient(@top, @bottom);
}
.button-border-gradient (@gradient, @top, @bottom) when (default()) {
}

/** Button Backgrounds **/
.button-background (@gradient, @color, @image) when (@gradient = false) {
	background: @color;
}
.button-background (@gradient, @color, @image) when (default()) {
	background: none;
}

.button-background-gradient (@gradient, @top, @bottom) when (@gradient = true) {
	.gradient (@top, @bottom);
}

.button-background-gradient (@gradient, @top, @bottom) when (default()) {
}

.button-layout(@background-color, @text-color) {
	.button-border(@button-gradient, @button-border-color);
	.button-border-gradient(@button-gradient, @button-border-gradient-top, @button-border-gradient-bottom);
	.button-background(@button-gradient, @background-color, @button-image);
	.button-background-gradient(@button-gradient, @button-background-gradient-top, @button-background-gradient-bottom);
	color: @text-color;
	display: inline-block;
	position: relative;
	line-height: 1.42857143;
	touch-action: manipulation;
	cursor: pointer;
	vertical-align: middle;
	text-align: center;
	overflow: visible;
	font-size: 14px;
	padding: 5px 18px;
	font-weight: bold;
	min-height: 31px;
	min-width: 45px;
	margin: 0; //reset the margins
	margin-right: 5px;
	white-space: nowrap;
}

.button-hover() {
	.button-border(@button-gradient, @button-hover-border-color);
	.button-border-gradient(@button-gradient, @button-hover-border-gradient-top, @button-hover-border-gradient-bottom);
	.button-background(@button-gradient, @button-hover-background-color, @button-hover-image);
	.button-background-gradient(@button-gradient, @button-hover-background-gradient-top, @button-hover-background-gradient-bottom);
	color: @button-hover-text-color;
	background-color: @button-hover-background-color;
	border-color: @button-hover-border-color;
}

.button-focus() {
	.button-border(@button-gradient, @button-hover-border-color);
	.button-border-gradient(@button-gradient, @button-hover-border-gradient-top, @button-hover-border-gradient-bottom);
	.button-background(@button-gradient, @button-hover-background-color, @button-hover-image);
	.button-background-gradient(@button-gradient, @button-hover-background-gradient-top, @button-hover-background-gradient-bottom);
	color: @button-hover-text-color;
	background-color: @button-hover-background-color;
	border-color: @border-color;
	box-shadow: 0 1px 1px rgba(0,0,0,.075) inset, 0 0 8px fadeout(darken(@background-color, 50%),40%);
	outline: 0 none;
}

.button-active() {
	.button-border(@button-gradient, @button-active-border-color);
	.button-border-gradient(@button-gradient, @button-active-border-gradient-top, @button-active-border-gradient-bottom);
	.button-background(@button-gradient, @form-button-active-background-color, @button-active-image);
	.button-background-gradient(@button-gradient, @button-active-background-gradient-top, @button-active-background-gradient-bottom);
	color: @form-button-active-text-color;
	background-color: @form-button-active-background-color;
	border-color: @button-active-border-color;
}

.button-disabled() {
	opacity: .50;
	filter: Alpha(Opacity=50);
	.button-background(@button-gradient, @button-background-color, @button-image);
	.button-background-gradient(@button-gradient, @button-background-gradient-top, @button-background-gradient-bottom);
	.button-border(@button-gradient, @button-border-color);
	.button-border-gradient(@button-gradient, @button-border-gradient-top, @button-border-gradient-bottom);
	cursor: not-allowed;
	color: @button-disabled-text-color;
}

/* BUTTON CSS STATES */

//dialog default action buttons (first child)
.ui-dialog-buttonpane .ui-dialog-buttonset .ui-button,
.ui-dialog-buttonset .ui-button {
	.button-layout(@button-text-color, @background-color);
	.button-active;

//	alternates
//	.button-layout(darken(@submit-button-background-color,10%), @button-text-color);
//	.button-layout(darken(@submit-button-background-color,20%), @button-text-color);
//	border-radius: @button-radius;
}

.ui-dialog-buttonset .ui-button:not(:first-child),
.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only,
.btn,
.btn:visited,
.btn.visited,
.btn[visited],
fieldset[visited] .btn,
input[type="button"],
input[type="reset"],
input[type="submit"],
input[type="button"]:visited,
input[type="reset"]:visited,
input[type="submit"]:visited {
	.button-layout(@submit-button-background-color, @button-text-color);
	border-radius: @button-radius;
}

.ui-dialog-buttonset .ui-button:hover,
.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only.ui-state-hover,
.btn:hover,
.btn.hover,
.btn[hover],
fieldset[hover] .btn,
input[type="button"]:hover,
input[type="reset"]:hover,
input[type="submit"]:hover{
	.button-hover();
}

.ui-dialog-buttonset .ui-button:focus,
.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only.ui-state-active,
.btn:focus,
.btn.focus,
.btn[focus],
fieldset[focus] .btn,
input[type="button"]:focus,
input[type="reset"]:focus,
input[type="submit"]:focus{
	.button-focus();
}

.ui-dialog-buttonset .ui-button:active,
.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only.ui-state-focus,
.btn:active,
.btn.active,
.btn[active],
fieldset[active] .btn,
input[type="button"]:active,
input[type="reset"]:active,
input[type="submit"]:active{
	.button-active();
}

.ui-dialog-buttonset .ui-button:disabled,
.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only.ui-state-disabled,
.btn:disabled,
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn,
input[type="button"]:disabled,
input[type="reset"]:disabled,
input[type="submit"]:disabled{
	.button-disabled();
}

/* RADIOSET/CHECKSET */
.radioset {
	white-space: nowrap;
}
.radioset input[type="radio"],
.radioset input[type="checkbox"] {
	display:none;
}
.radioset input[type="radio"] + label,
.radioset input[type="checkbox"] ~ label {
	.button-layout(@form-button-background-color, @form-button-text-color);
	margin-right: -5px;
}
.radioset input[type="radio"] + label:first-of-type {
	margin-left: 0px;
}
.nav-pills{
	.nav-link.active, .nav-link.active:hover, .nav-link.active:focus {
		background-color: @nav-pills-bg-color !important;
	}
}
.input-group-btn {
	.btn {
		margin-right: 0px;
	}
	.btn:last-of-type {
		margin-right: 5px;
		background: @submit-button-background-color;
		color: @button-text-color;
	}
	.btn:last-of-type:hover {
		background: @btn-group-bg-color;
		color: @button-hover-text-color;
	}
}

.btn-group input[type="button"],
.btn-group input[type="submit"],
.radioset input[type="radio"] + label:last-of-type {
	margin-right: 0px;
}
.btn-group input[type="button"]:last-of-type,
.btn-group input[type="submit"]:last-of-type,
.radioset input[type="checkbox"] ~ label:last-of-type {
	margin-right: 5px;
}
.radioset input[type="radio"] + label:first-of-type,
.radioset input[type="checkbox"] ~ label:first-of-type {
	border-top-left-radius: @button-radius;
	border-bottom-left-radius: @button-radius;
}
.radioset input[type="radio"] + label:last-of-type,
.radioset input[type="checkbox"] ~ label:last-of-type {
	border-top-right-radius: @button-radius;
	border-bottom-right-radius: @button-radius;
}
.radioset input[type="radio"] + label:hover,
.radioset input[type="checkbox"] ~ label:hover {
	.button-hover();
}
.radioset input[type="radio"]:checked + label, .radioset input[type="checkbox"]:checked + label {
	.button-active();
}

.radioset input[type="radio"]:disabled + label, .radioset input[type="checkbox"]:disabled + label {
	.button-disabled();
}

.radioset input[type="radio"]:disabled:checked + label, .radioset input[type="checkbox"]:disabled:checked + label {
	background-color: darken(@button-background-color,10%);
}

.has-error {
	.radioset input[type="radio"] + label:first-of-type, .radioset input[type="checkbox"] ~ label:first-of-type,
	.radioset input[type="radio"] + label, .radioset input[type="checkbox"] ~ label,
	.radioset input[type="radio"] + label:last-of-type, .radioset input[type="checkbox"] ~ label:last-of-type {
		background-color: fade(@button-has-error, 60%);
		border-color: @button-has-error;
		color: white
	}
	.radioset input[type="radio"]:checked + label:first-of-type, .radioset input[type="checkbox"]:checked ~ label:first-of-type,
	.radioset input[type="radio"]:checked + label, .radioset input[type="checkbox"]:checked ~ label,
	.radioset input[type="radio"]:checked + label:last-of-type, .radioset input[type="checkbox"]:checked ~ label:last-of-type {
		background-color: @button-has-error;
		border-color: @button-has-error;
		color: white
	}
}

.has-warning {
	.radioset input[type="radio"] + label:first-of-type, .radioset input[type="checkbox"] ~ label:first-of-type,
	.radioset input[type="radio"] + label, .radioset input[type="checkbox"] ~ label,
	.radioset input[type="radio"] + label:last-of-type, .radioset input[type="checkbox"] ~ label:last-of-type {
		background-color: fade(@button-has-warning, 60%);
		border-color: @button-has-warning;
		color: white
	}
	.radioset input[type="radio"]:checked + label:first-of-type, .radioset input[type="checkbox"]:checked ~ label:first-of-type,
	.radioset input[type="radio"]:checked + label, .radioset input[type="checkbox"]:checked ~ label,
	.radioset input[type="radio"]:checked + label:last-of-type, .radioset input[type="checkbox"]:checked ~ label:last-of-type {
		background-color: @button-has-warning;
		border-color: @button-has-warning;
		color: white
	}
}

.has-success {
	.radioset input[type="radio"] + label:first-of-type, .radioset input[type="checkbox"] ~ label:first-of-type,
	.radioset input[type="radio"] + label, .radioset input[type="checkbox"] ~ label,
	.radioset input[type="radio"] + label:last-of-type, .radioset input[type="checkbox"] ~ label:last-of-type {
		background-color: fade(@button-has-success, 60%);
		border-color: @button-has-success;
		color: white
	}
	.radioset input[type="radio"]:checked + label:first-of-type, .radioset input[type="checkbox"]:checked ~ label:first-of-type,
	.radioset input[type="radio"]:checked + label, .radioset input[type="checkbox"]:checked ~ label,
	.radioset input[type="radio"]:checked + label:last-of-type, .radioset input[type="checkbox"]:checked ~ label:last-of-type {
		background-color: @button-has-success;
		border-color: @button-has-success;
		color: white
	}
}

.btn-success.focus, .btn-success:focus {
	color: #fff;
	background-color: #449d44;
	border-color: #255625;
}

.btn-success:hover {
	color: #fff;
	background-color: #449d44;
	border-color: #398439;
}

.btn-success.active, .btn-success:active {
	color: #fff;
	background-color: #449d44;
	border-color: #398439;
}

.btn-success {
	color: #fff;
	background-color: #5cb85c;
	border-color: #4cae4c;
}

.btn-info.focus, .btn-info:focus {
	color: #fff;
	background-color: #31b0d5;
	border-color: #1b6d85;
}

.btn-info:hover {
	color: #fff;
	background-color: #31b0d5;
	border-color: #269abc;
}

.btn-info.active, .btn-info:active {
	color: #fff;
	background-color: #31b0d5;
	border-color: #269abc;
}

.btn-info {
	color: #fff;
	background-color: #5bc0de;
	border-color: #46b8da;
}

.btn-danger.focus, .btn-danger:focus {
	color: #fff;
	background-color: #c9302c;
	border-color: #761c19;
}

.btn-danger.active, .btn-danger:active {
	color: #fff;
	background-color: #c9302c;
	border-color: #ac2925;
}

.btn-danger:hover {
	color: #fff;
	background-color: #c9302c;
	border-color: #ac2925;
}

.btn-danger, .btn-danger:visited {
	color: #fff;
	background-color: #d9534f;
	border-color: #d43f3a;
}

.btn-warning.active, .btn-warning:active {
	color: #fff;
	background-color: #ec971f;
	border-color: #d58512;
}

.btn-warning.focus, .btn-warning:focus {
	color: #fff;
	background-color: #ec971f;
	border-color: #985f0d;
}

.btn-warning, .btn-warning:visited {
	color: #fff;
	background-color: #f0ad4e;
	border-color: #eea236;
}

.btn-warning:hover {
	color: #fff;
	background-color: #ec971f;
	border-color: #d58512;
}

.btn-danger.disabled,
.btn-danger.disabled.active,
.btn-danger.disabled.focus,
.btn-danger.disabled:active,
.btn-danger.disabled:focus,
.btn-danger.disabled:hover,
.btn-danger[disabled],
.btn-danger[disabled].active,
.btn-danger[disabled].focus,
.btn-danger[disabled]:active,
.btn-danger[disabled]:focus,
.btn-danger[disabled]:hover,
.btn-danger[disabled]:visited,
fieldset[disabled] .btn-danger,
fieldset[disabled] .btn-danger.active,
fieldset[disabled] .btn-danger.focus,
fieldset[disabled] .btn-danger:active,
fieldset[disabled] .btn-danger:focus,
fieldset[disabled] .btn-danger:hover {
	color: #fff;
	background-color: #d9534f;
	border-color: #d43f3a;
}

.btn-warning.disabled,
.btn-warning.disabled.active,
.btn-warning.disabled.focus,
.btn-warning.disabled:active,
.btn-warning.disabled:focus,
.btn-warning.disabled:hover,
.btn-warning[disabled],
.btn-warning[disabled].active,
.btn-warning[disabled].focus,
.btn-warning[disabled]:active,
.btn-warning[disabled]:focus,
.btn-warning[disabled]:hover,
.btn-warning[disabled]:visited,
fieldset[disabled] .btn-warning,
fieldset[disabled] .btn-warning.active,
fieldset[disabled] .btn-warning.focus,
fieldset[disabled] .btn-warning:active,
fieldset[disabled] .btn-warning:focus,
fieldset[disabled] .btn-warning:hover {
	color: #fff;
	background-color: #f0ad4e;
	border-color: #eea236;
}

.btn-info.disabled,
.btn-info.disabled.active,
.btn-info.disabled.focus,
.btn-info.disabled:active,
.btn-info.disabled:focus,
.btn-info.disabled:hover,
.btn-info[disabled],
.btn-info[disabled].active,
.btn-info[disabled].focus,
.btn-info[disabled]:active,
.btn-info[disabled]:focus,
.btn-info[disabled]:hover,
.btn-info[disabled]:visited,
fieldset[disabled] .btn-info,
fieldset[disabled] .btn-info.active,
fieldset[disabled] .btn-info.focus,
fieldset[disabled] .btn-info:active,
fieldset[disabled] .btn-info:focus,
fieldset[disabled] .btn-info:hover {
	color: #fff;
	background-color: #5bc0de;
	border-color: #46b8da;
}

.btn-success.disabled,
.btn-success.disabled.active,
.btn-success.disabled.focus,
.btn-success.disabled:active,
.btn-success.disabled:focus,
.btn-success.disabled:hover,
.btn-success[disabled],
.btn-success[disabled].active,
.btn-success[disabled].focus,
.btn-success[disabled]:active,
.btn-success[disabled]:focus,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success,
fieldset[disabled] .btn-success.active,
fieldset[disabled] .btn-success.focus,
fieldset[disabled] .btn-success:active,
fieldset[disabled] .btn-success:focus,
fieldset[disabled] .btn-success:hover {
	color: #fff;
	background-color: #5cb85c;
	border-color: #4cae4c;
}

.btn-sm {
	padding: 2px 10px;
	font-size: 12px;
	line-height: 1.5;
	border-radius: @button-radius - 1px;
	min-height: 24px;
}

.navbar-btn {
	margin-top: 8px;
	margin-bottom: 8px;
}
.btn-primary:not(:disabled):not(.disabled).active:focus, 
.btn-primary:not(:disabled):not(.disabled):active:focus, 
.show>.btn-primary.dropdown-toggle:focus {
    box-shadow: 0 0 0 0.2rem @background-color;
}
.btn-primary:not(:disabled):not(.disabled).active, 
.btn-primary:not(:disabled):not(.disabled):active, 
.show>.btn-primary.dropdown-toggle {
   	.button-active();
}
.keep-open.btn-group{
		line-height: 1.42857143;
	}