@use 'sass:list';

.btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: middle;
	color: $text-color;
	text-decoration: none;
	background-color: $co-gray-80;
	text-align: center;

	@include bitSize();

	@if $useBorderRadius { border-radius: $border-radius-1;}

	&.is-active {
		background-color: darken($co-gray-80, 3%);
	}

	&:hover {
		text-decoration: none;
		background-color: lighten($co-gray-80, 3%);
	}

	[data-bs-toggle="tooltip"] {
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		inset: 0;
	}

	.fas,
	.far,
	.fab {
		line-height: $line-height-base;
	}
}

@each $suf, $color in $co-btns {
	$light: lightness(list.nth($color, 1));
	$bg: list.nth($color, 1);
	$text: list.nth($color, 2);

	.btn-#{$suf} {
		color: $text;
		background-color: $bg;
		&.is-active {
			color: $text;
			background-color: if($light < 80%, actionDarken($bg), actionLighten($bg));
		}

		&:focus {
			color: $text;
		}

		&:hover {
			color: $text;
			background-color: if($light < 80%, actionLighten($bg), actionDarken($bg));
		}
	}
}

.btn.has-outline {
	&:hover {
		opacity: .70;
	}
}

.btn-multiselect {
	display: block;
	width: 100%;
	justify-content: start;
	height: 5.6rem;
	max-height: 5.6rem;
	text-overflow: ellipsis;
	text-align: left;
	overflow: hidden;
	border-radius: 0;
	border: 1px solid $co-gray-70;
	background-color: $co-base-1;
	background-repeat: no-repeat;
	background-position: right $sp-1 center;
	background-size: 16px 12px;
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23555555' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");

	&:hover {
		background-color: $co-base-1;
	}

	&[aria-expanded="true"],
	&:focus-visible {
		outline: 0;
		border-color: $co-alpha;
		box-shadow: none;
	}

	.is-label {
		position: absolute;
		top: .4rem;
		left: $sp-4;
		font-size: $font-size-small;
	}

	.is-selected {
		position: relative;
		top: .8rem;
	}
}

// bootstrap for modal, ...
.btn-close {
    width: $sp-6;
    height: $sp-6;
	color: $co-base-0;
	text-align: center;
	// opacity: 1;
	// background-color: #faa;

	&:after {
		content:"✖";
		font-size: 1.5rem;
		font-family: $font-family-monospace;
	}

	@include hover() {
		opacity: .7;
	}
}
