.list-group {
	@include border-radius($list-group-border-radius);
	@include box-shadow($list-group-box-shadow);

	color: $list-group-color;
	font-size: $list-group-font-size;
	margin-bottom: $list-group-margin-bottom;
	margin-top: $list-group-margin-top;

	.list-group {
		@if ($list-group-box-shadow != null) {
			@include box-shadow(none);
		}
	}
}

.list-group-bordered {
	.list-group-item-flex {
		padding: 0;

		&.active {
			.autofit-col {
				border-color: $list-group-active-border-color;
			}
		}
	}

	.autofit-col {
		border-left: $list-group-border-width solid $list-group-border-color;
		border-right: $list-group-border-width solid $list-group-border-color;
		margin-left: -$list-group-border-width;
		padding: $list-group-item-padding-y $list-group-item-padding-x;

		&:first-child,
		&:last-child {
			border-left-width: 0;
			border-right-width: 0;
			margin-left: 0;
		}
	}
}

// List Group Header

.list-group-header {
	align-items: center;
	background-color: $list-group-header-bg;
	border: $list-group-border-width solid $list-group-border-color;
	display: flex;
	justify-content: space-between;
	margin-bottom: -$list-group-border-width;
	padding: $list-group-header-padding-y $list-group-header-padding-x;

	&:first-child {
		@include border-top-radius($list-group-border-radius);
	}

	&:last-child {
		@include border-bottom-radius($list-group-border-radius);
	}
}

.list-group-header-title {
	@include clay-text-typography($list-group-header-title);
}

// List Group Title

.list-group-title {
	@include clay-text-typography($list-group-title);
}

// List Group Subtitle

.list-group-subtitle {
	@include clay-text-typography($list-group-subtitle);
}

// List Group Text

.list-group-text {
	@include clay-text-typography($list-group-text);
}

// List Group Subtext

.list-group-subtext {
	@include clay-text-typography($list-group-subtext);
}

// List Group Details

.list-group-detail {
	margin-bottom: $list-group-detail-margin-bottom;
	margin-top: $list-group-detail-margin-top;
}

// List Group Item

.show-dropdown-action-on-active {
	.list-group-item.active {
		.dropdown-action {
			.dropdown-menu {
				background-color: $list-group-active-bg;
			}

			.dropdown-item {
				color: $list-group-active-color;
			}
		}
	}
}

.list-group-item {
	&.active {
		&:focus,
		&.focus {
			z-index: 2;
		}

		.dropdown-action .dropdown-toggle,
		.list-group-link {
			color: $list-group-active-color;
		}

		.list-group-title,
		a.list-group-title,
		.list-group-title a {
			color: $list-group-title-active-color;
		}

		.list-group-text,
		a.list-group-text,
		.list-group-text a {
			color: $list-group-text-active-color;
		}

		.list-group-subtext,
		a.list-group-subtext,
		.list-group-subtext a {
			color: $list-group-subtext-active-color;
		}

		.list-group-link {
			color: $list-group-link-active-color;
		}
	}
}

.list-group-item-flex {
	display: flex;
	margin-bottom: -$list-group-border-width;
	padding-left: $list-group-item-padding-x / 2;
	padding-right: $list-group-item-padding-x / 2;

	&:last-child {
		margin-bottom: 0;
	}

	+ .list-group-item-flex {
		border-top-width: $list-group-border-width;

		&.active {
			margin-top: 0;
		}
	}

	.autofit-col {
		justify-content: $list-group-item-flex-align-items;
		padding-left: $list-group-item-padding-x / 2;
		padding-right: $list-group-item-padding-x / 2;

		.custom-control:only-child {
			margin-bottom: 0;
			margin-top: $list-group-item-flex-offset-top;

			.custom-control-input,
			.custom-control-label::before,
			.custom-control-label::after {
				margin-top: $list-group-item-flex-checkbox-offset-top;
			}
		}

		.form-check:only-child {
			margin-bottom: 0;
			margin-top: $list-group-item-flex-offset-top;
			padding-top: $list-group-item-flex-checkbox-offset-top;
		}

		.sticker:only-child {
			margin-top: $list-group-item-flex-offset-top;
		}

		.list-group-title:only-child {
			align-items: center;
			display: flex;
			min-height: 32px;
			margin-top: 0;

			// IE11 flexbox min-height workaround

			&::after {
				content: '';
				display: block;
				min-height: inherit;
			}
		}

		.dropdown-action {
			margin-top: $list-group-item-flex-offset-top;
		}

		.quick-action-item {
			margin-top: $list-group-item-flex-offset-top;
		}
	}
}

.list-group-item-action:focus {
	z-index: 1;
}

// List Group Link

.list-group-link {
	color: $list-group-link-color;

	&:hover,
	&:focus {
		color: $list-group-link-hover-color;
	}
}

// List Group Flush

%list-group-flush {
	.list-group-item {
		border-left-width: 0;

		@include border-radius(0);

		border-right-width: 0;

		> .autofit-col {
			&:first-child {
				padding-left: 0;
			}

			&:last-child {
				padding-right: 0;
			}
		}
	}
}

%list-group-flush-vertical {
	.list-group-item {
		border-left-width: 0;

		@include border-radius(0);

		border-right-width: 0;

		> .autofit-col {
			&:first-child {
				padding-left: 0;
			}

			&:last-child {
				padding-right: 0;
			}
		}
	}

	&:first-child {
		.list-group-item:first-child {
			border-top-width: 0;
		}
	}

	&:last-child {
		.list-group-item:last-child {
			border-bottom-width: 0;
		}
	}
}

// Show Quick Action

.show-quick-actions-on-hover {
	.list-group-item:not(.active) {
		&:hover {
			.quick-action-menu {
				display: flex;
			}
		}
	}

	.focus:not(.active) {
		.quick-action-menu {
			display: flex;
		}
	}
}

.list-group {
	.quick-action-menu {
		align-items: $list-group-item-flex-align-items;
		background-color: $list-group-bg;
		margin-bottom: -$list-group-item-padding-y;
		margin-top: -$list-group-item-padding-y;
		padding-bottom: $list-group-item-padding-y;
		padding-top: $list-group-item-padding-y;
	}
}

.list-group-bordered .quick-action-menu {
	margin-bottom: 0;
	margin-top: 0;
	padding-bottom: $list-group-item-padding-y;
	padding-top: $list-group-item-padding-y;
}

.list-group-item-flex.active {
	.quick-action-menu {
		background-color: $list-group-active-bg;
	}

	.quick-action-item {
		color: $list-group-active-color;
	}
}

// List Group Notification

.list-group-notification {
	&.list-group-bordered {
		.quick-action-menu {
			margin-bottom: $list-group-notification-item-border-bottom-width;
			margin-top: $list-group-notification-item-border-top-width;
		}
	}

	.list-group-item {
		border-width: 0;

		@include clay-list-group-notification-item-variant($list-group-notification-item);
	}

	.list-group-item-flex {
		&.active {
			border-top-width: 0;
		}
	}

	.list-group-item-primary {
		@include clay-list-group-notification-item-variant($list-group-notification-item-primary);
	}

	.quick-action-menu {
		margin-bottom: -$list-group-item-padding-y + $list-group-notification-item-border-bottom-width;
		margin-top: -$list-group-item-padding-y + $list-group-notification-item-border-top-width;
	}

	.autofit-col .quick-action-item {
		margin-top: $list-group-notification-item-border-top-width - $list-group-item-flex-offset-top;
	}
}

// List Group Sm

.list-group-sm {
	.list-group-item {
		@include clay-container($list-group-sm-item);
	}

	.quick-action-menu {
		@include clay-container($list-group-sm-quick-action-menu);
	}
}