@use 'mixins/mixins';
@use './common/var';

@include mixins.b(badge) {
	position: relative;
	vertical-align: middle;
	display: inline-block;

	@include mixins.e(content) {
		background-color: var.$badge-background-color;
		border-radius: var.$badge-radius;
		color: var.$color-white;
		display: inline-block;
		font-size: var.$badge-font-size;
		height: var.$badge-size;
		line-height: var.$badge-size;
		padding: 0 var.$badge-padding;
		text-align: center;
		white-space: nowrap;
		border: 1px solid var.$color-white;
		box-sizing: content-box;

		@include mixins.when(fixed) {
			position: absolute;
			top: 0;
			right: #{1 + var.$badge-size * 0.5};
			transform: translateY(-50%) translateX(100%);

			@include mixins.when(dot) {
				right: 5px;
			}
		}

		@include mixins.when(dot) {
			height: 8px;
			width: 8px;
			padding: 0;
			right: 0;
			border-radius: 50%;
		}

		@each $type in (primary, success, warning, info, danger) {
			@include mixins.m($type) {
				@if $type == primary {
					background-color: var(--color-primary);
				} @else if $type == success {
					background-color: var(--color-success);
				} @else if $type == warning {
					background-color: var(--color-warning);
				} @else if $type == info {
					background-color: var(--color-info);
				} @else {
					background-color: var(--color-danger);
				}
			}
		}
	}
}
