@import '../style/index';

@button-prefix-cls: ~'@{prefix}-button';

@border-radius: 2px;

@normal-bg: #FFFFFF;
@normal-hover-bg: #48BBFF;
@nomal-hover-color: #FFFFFF;
@normal-active-bg: #48BBFF;
@normal-color: #28323C;
@normal-border: 1px solid @color-gray5;

@primary-bg: #48BBFF;
@primary-hover-bg: #32A1E3;
@primary-active-bg: #32A1E3;
@primary-color: #fff;
@primary-border: 1px solid @primary-bg;

@dashed-color: rgba(0,0,0,0.65);
@dashed-hover-color: #00AAF1;
@dashed-active-color: #00A9F0;
@dashed-border: 1px dashed #d9d9d9;

@link-color: #48BBFF;
@link-hover-color: #32A1E3;
@link-active-color: #32A1E3;

@disabled-bg: #EAEDF1;
@disabled-color: #999999;
@disabled-border: 1px solid @disabled-bg;

@large-font-size: 16px;
@default-font-size: 14px;
@small-font-size: 12px;

@large-padding: 10px 15px;
@default-padding: 7px 15px;
@small-padding: 5px 7px;

@translate: 1px;

/* group */
.@{button-prefix-cls}-group {
	padding-left: @translate;
	display: inline-block;
}

.@{button-prefix-cls} {
	border-radius: @border-radius;
	box-sizing: border-box;
	outline: none;
	line-height: 1;
	cursor: pointer;
	transition: .3s;
	i{
		margin-left: 0;
		margin-right: 4px;
	}

	/* group */
	&-group & {
		position: relative;
		margin-left: -@translate;
		border-radius: 0;
		z-index: 1;

		&:first-child {
			border-top-left-radius: @border-radius;
			border-bottom-left-radius: @border-radius;
		}

		&:last-child {
			border-top-right-radius: @border-radius;
			border-bottom-right-radius: @border-radius;
		}

		&[disabled]:not(:first-child)::after,
		&.primary:not(:first-child)::after {
			content: "";
			position: absolute;
			top: -1px;
			left: -1px;
			width: 1px;
			background: currentColor;
			opacity: .1;
			height: 104%
		}

		&:hover {
			z-index: 2;
		}
	}

	/* type */
	&.normal {
		border: @normal-border;
		color: @normal-color;
		background: @normal-bg;

		&:hover {
			background: @normal-hover-bg;
			color: @nomal-hover-color;
		}
		&:active {
			background: @normal-active-bg;
		}
	}
	&.primary {
		border: @primary-border;
		background: @primary-bg;
		color: @primary-color;

		&:hover {
			border-color: @primary-hover-bg;
			background: @primary-hover-bg;
		}
		&:active {
			border-color: @primary-active-bg;
			background: @primary-active-bg;
		}
	}
	&.dashed {
		border: @dashed-border;
		color: @dashed-color;

		&:hover {
			border-color: @dashed-hover-color;
			color: @dashed-hover-color;
		}
		&:active {
			border-color: @dashed-active-color;
			color: @dashed-active-color;
		}
	}
	&.link {
		border: none;
		background: transparent;
		color: @link-color;

		&:hover {
			color: @link-hover-color;
		}
		&:active {
			color: @link-active-color;
		}
	}

	/* size */
	&.large {
		padding: @large-padding;
		font-size: @large-font-size;
		i{
			font-size: 16px;
		}
	}
	&.default {
		padding: @default-padding;
		font-size: @default-font-size;
		i{
			font-size: 14px;
		}
	}
	&.small {
		padding: @small-padding;
		font-size: @small-font-size;
		i{
			font-size: 12px;
		}
	}

	/* block */
	&.block {
		width: 100%;
	}

	/* disabled */
	&[disabled] {
		&.link {
			&, &:hover, &:active {
				color: @disabled-bg;
				cursor: not-allowed;
			}
		}

		&:not(.link) {
			&, &:hover, &:active {
				border: @disabled-border;
				background: @disabled-bg;
				color: @disabled-color;
				cursor: not-allowed;
			}
		}
	}
}
