@use 'sass:map';
@use 'sass:list';
@use 'sass:color';
@use 'theme';

.badge {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	border-radius: 3px;
	text-align: center;
	min-inline-size: 43px;
	min-block-size: 24px;
	display: inline-flex;
	justify-content: center;
	align-items: center;
	padding-block: 0;
	padding-inline: 3px;
	box-sizing: border-box;
	gap: 5px;
	line-height: 1;

	@at-root .row-actions & {
		color: #8c8c8c;
		padding-inline: 0;
		text-transform: capitalize;
		font-weight: 500;
	}

	.dashicons {
		font-size: 18px;
		inline-size: 18px;
		block-size: 18px;
	}
}

.network-shared {
	color: #2271b1; 
	font-size: 22px;
	inline-size: 100%;
	cursor: help;
}

.small-badge {
	block-size: auto;
	inline-size: auto;
	font-size: smaller;
	padding-block: 0;
	padding-inline: 0.5em;
}

.wp-core-ui .button.nav-tab-button {
	margin-inline-start: 0.5em;
	float: inline-end;
	color: #a7aaad;
	background: #f6f7f7;
	border-color: #f6f7f7;
	align-self: center;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 2px;
}

@each $name, $colors in theme.$badges {
	$text-color: #fff;
	$background-color: list.nth($colors, 1);

	@if list.length($colors) > 1 {
		$text-color: list.nth($colors, 2);
	}

	.badge.#{$name}-badge,
	.nav-tab-inactive:hover .badge.#{$name}-badge,
	:hover > .inverted-badges .#{$name}-badge {
		color: $text-color;
		background-color: $background-color;
	}

	.badge.#{$name}-badge:hover {
		color: $text-color;
		background-color: color.adjust($background-color, $lightness: -5%);
	}
}

.nav-tab-inactive .badge,
.inverted-badges .badge {
	color: #fff;
	background-color: #a7aaad;
	border-color: #fff !important;

	.dashicons {
		color: #fff;
	}
}

.nav-tab-inactive {
	$colors: map.get(theme.$badges, 'pro');
	$text-color: list.nth($colors, 2);
	$background-color: list.nth($colors, 1);

	.badge.pro-badge {
		color: $text-color;
		background-color: $background-color;
	}

	&:hover {
		&.button, .dashicons-external {
			color: #3c434a;
		}

		.badge.pro-badge {
			color: $background-color;
			background-color: $text-color;
		}
	}
}

.nav-tab-inactive {
	background: transparent;
}

.nav-tab-button .dashicons-external {
	font-size: 15px;
	color: #666;
}
