@keyframes icon_spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.btn {
	font-family: $font-family-base;
	font-size: $font-size-lg;
	font-weight: $font-weight-semibold;
	line-height: $line-height-base;
	letter-spacing: $letter-spacing-wide;
	padding: $space-3 $space-lg;
	border-radius: 0;
	border-width: 2px;
	border-left-width: 6px;
	border-style: solid;
	border-color: $color-primary;
	text-transform: uppercase;
	background-color: transparent;
	transition-duration: .2s;
	transition-property: background-color, border-color, color;

	&.with-icon {
		border-left-width: 48px;
		position: relative;

		.ph,
		.ph-bold {
			position: absolute;
			color: #0a0a0d;
			left: -48px;
			top: 1px;
			font-size: 28px;
			height: 100%;
			display: inline-flex;
			align-items: center;
			width: 48px;
			justify-content: center;
			transition-duration: .2s;
			transition-property: color, left;
		}
	}

	@include hover_touch {
		&.with-icon:not(.loading-state):not(.btn-small) {
			.ph,
			.ph-bold {
				left: -28px;
			}
		}
	}

	&.btn-primary {
		color: $color-primary;
		border-color: $color-primary;

		@include hover_touch {
			background-color: $color-primary;
			color: $color-black;
		}
	}

	&.btn-secondary {
		color: $color-secondary;
		border-color: $color-secondary;

		@include hover_touch {
			background-color: $color-secondary;
			color: $color-text-light;

			&.with-icon {
				.ph,
				.ph-bold {
					color: $color-text-light;
				}
			}
		}
	}

	&.btn-accent {
		color: $color-accent;
		border-color: $color-accent;

		@include hover_touch {
			background-color: $color-accent;
			color: $color-text-light;

			&.with-icon {
				.ph,
				.ph-bold {
					color: $color-text-light;
				}
			}
		}
	}

	&.btn-danger {
		color: $color-error;
		border-color: $color-error;

		@include hover_touch {
			background-color: $color-error;
			color: $color-black;
		}
	}

	&.btn-warning {
		color: $color-warning;
		border-color: $color-warning;

		@include hover_touch {
			background-color: $color-warning;
			color: $color-black;
		}
	}

	&.btn-success {
		color: $color-success;
		border-color: $color-success;

		@include hover_touch {
			background-color: $color-success;
			color: $color-black;
		}
	}

	&.btn-info {
		color: $color-info;
		border-color: $color-info;

		@include hover_touch {
			background-color: $color-info;
			color: $color-text-light;

			&.with-icon {
				.ph,
				.ph-bold {
					color: $color-text-light;
				}
			}
		}
	}

	&[disabled]:not(.loading-state) {
		color: $color-text-dark;
		border-color: $color-dark;
		background-color: $color-dark;

		&.with-icon {
			.ph,
			.ph-bold {
				color: $color-text-dark;
			}
		}

		@include hover_touch {
			background-color: $color-dark;
			color: $color-text-dark;

			&.with-icon {
				.ph,
				.ph-bold {
					color: $color-text-dark;
				}
			}
		}

		&.with-icon:not(.btn-small) {
			.ph,
			.ph-bold {
				left: -28px;
			}
		}
	}

	&.btn-small {
		font-size: $font-size-md;
		font-weight: $font-weight-medium;
		padding: $space-sm $space-sm;

		&.with-icon {
			border-left-width: 32px;

			.ph,
			.ph-bold {
				top: 0;
				left: -40px;
				font-size: 23px;
			}

			&.loading-state {
				.ph, .ph-bold {
					font-size: 30px;
				}
			}
		}
	}

	&.btn-large {
		font-size: $font-size-xl;
		font-weight: $font-weight-bold;
		padding: $space-md $space-xxl;
	}

	&.loading-state {
		color: $color-black !important;
		border-color: $color-primary !important;
		background-color: $color-primary !important;

		.ph, .ph-bold {
			font-size: 31px;
			transform-origin: 50% 50%;
  		animation: icon_spin 1.2s linear infinite;
		}
	}
}

.btn-icon {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 30px;
	height: 30px;

	background: transparent;
	color: $color-text-light;
	font-size: $font-size-xl;
	border: 0;

	transition-duration: .2s;
	transition-property: color, background;

	
	.ph {
		transform: rotate(0);
		transition-duration: .2s;
		transition-property: transform;
	}

	&:not(.without-hover) {
		@include hover_touch {
			color: $color-text-dark;

			.ph {
				transform: rotate(90deg);
			}
		}
	}
}
