//
// PLASTIC
// Buttons
// Site-wide button styles
//

@import 'plastic_typography.less';
@import 'plastic_elements.less';
@import 'plastic_colors.less';
@import '../slack_kit/slack_kit_colors.less';

@transparent_outline_text_color: fade(@white, 90%);

// Buttons
.btn {

	// Color
	background: @seafoam_green;
	color: @white;

	// Text
	font-size: 1rem;
	line-height: 1.2rem;
	font-weight: 900;
	.user-select(none);
	text-decoration: none;
	cursor: pointer;
	text-shadow: 0 1px 1px fade(@black, 10%);

	// Border
	border: none;
	.rounded(0.25rem);
	.box-shadow(none);

	// Alignment
	position: relative;
	display: inline-block;
	vertical-align: bottom;
	text-align: center;
	white-space: nowrap;
	margin: 0;

	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;

	&:after {
		position: absolute;
		content: '';
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		.rounded(0.25rem);
	}
}
// this is to override the default link color of <a> buttons
a.btn {
	color: @white;
}

// States
.no_touch {
	.btn:hover,
	.btn.hover,
	.btn:focus {
		outline: none;
		text-decoration: none;
	}
}
.btn:hover,
.btn.hover,
.btn:focus {
	background: @seafoam_green;
	color: @white;

	&:after {
		box-shadow: inset 0 -2px fade(@black, 25%);
	}
}
.btn:active,
.btn.active {
	color: @white;

	&:after {
		box-shadow: inset 0 2px 1px fade(@black, 20%);
	}
}

// Secondary / Outlined
.btn_outline {
	background: @neutral_grey;
	color: @indifferent_grey !important;
	font-weight: 700;
	text-shadow: none;

	&:after {
		border: 1px solid @sk_soft_gray_hex;
	}

	&.btn_transparent {
		background-color: transparent !important;
		color: @transparent_outline_text_color !important;

		&:after {
			border: 1px solid fade(@white, 50%);
		}

		&:hover,
		&.hover,
		&:focus,
		&:active,
		&.active {
			color: @blue_link !important;
			background: fade(@white, 90%) !important;

			&:after {
				box-shadow: none;
				border-color: transparent;
			}
		}

		&:active,
		&.active {
			background-color: fade(@white, 80%) !important;
		}
	}
}
.btn_outline:hover,
.btn_outline.hover,
.btn_outline:focus {
	background: @white;
	color: @blue_link !important;

	&:after {
		box-shadow: none;
	}
}
.btn_outline:active {
	color: @blue_link;

	&:after {
		box-shadow: inset 0 1px 1px fade(@black, 20%);
	}
}
.btn_outline.active {
	color: #666 !important;
	margin-top: 0;
	font-weight: 900;
}
.btn.btn_outline.btn_warning,
.btn.btn_outline.btn_danger {
	background: @neutral_grey !important;
}
.btn.btn_outline.btn_warning,
.btn.btn_outline.btn_danger {
	&:hover,
	&:focus {
		background: @white !important;
	}
}
.btn.btn_outline.btn_warning {
	&:hover,
	&:focus {
		color: @mustard_yellow !important;

		&:after {
			border-color: @mustard_yellow;
		}
	}
}
.btn.btn_outline.btn_danger {
	&:hover,
	&:focus {
		color: @candy_red !important;

		&:after {
			border-color: @candy_red;
		}
	}
}

.btn.btn_outline.disabled,
.btn.btn_outline.disabled:hover {
	color: @sk_dark_gray_hex !important;
	background: @white !important;
}

.btn_unstyle {
	background: none;
	border: none;
	padding: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	outline: 0;	// TODO: Temporarily remove the focus outline until design for focus styles are complete (A11Y-381)
}

// Basic button to be based on `btn_unstyle` with hover and focus states
.btn_basic {
	.btn_unstyle;
	outline: 0;
	color: inherit;

	&:hover,
	&:focus {
		color: @blue_hover;
	}
}

// Button to look like a link while maintaining button behaviors
.btn_link {
	.btn_unstyle;
	outline: 0;
	color: @blue_link;
	vertical-align: baseline;
	cursor: pointer;

	&:hover,
	&:focus {
		color: @blue_hover;
		text-decoration: underline;
	}
}

// Border Buttons
.btn.btn_border {
	background: transparent;
	border: 2px solid @white;

	&:after {
		box-shadow: none;
	}
}

// Disabled
.btn.disabled,
.btn.disabled:hover,
.btn.disabled:active,
.btn:disabled,
.btn:disabled:hover,
.btn:disabled:active {
	background-color: @sk_soft_gray_hex !important;
	color: fade(@sk_black, 75%);
	text-shadow: none;
	.box-shadow(none) !important;
	pointer-events: none;
}

// Sizes
.btn {
	padding: 8px 14px 9px;
	font-size: 15px;
}
.btn_small {
	padding-top: 5px;
	padding-bottom: 5px;
	padding-left: 10px;
	padding-right: 10px;
	font-size: 14px;

	i:before {
		font-size: 15px;
	}
}
