%base-bullet {
	content: '';
	position: absolute;
	border-radius: $border-radius-max;
}

$components-colors: (
	'positive': $color-positive,
	'negative': $color-negative,
	'warning' : $color-warning,
	'info'    : $color-info,
	'disabled': $color-gray-400,
	'gray'    : $color-gray-400
);

.#{$component-prefix}timeline {
	position: relative;

	margin: 0;

	list-style: none;

	ul {
		list-style: none;
	}

	// Section
	> li {
		position: relative;

		&:not(:last-child) {
			padding-bottom: 8px;

			// Vertical line
			&:before {
				content: '';
				position: absolute;
				top: 16px;
				bottom: 0;
				left: -24px;
				width: 2px;
				height: calc(100%);
				margin: auto;
				background-color: $color-gray-300;
			}
		}

		// Section header
		> *:first-child {
			position: relative;

			// Header bullet
			&:before {
				@extend %base-bullet;
				width: 8px;
				height: 8px;
				left: -27px;
				top: 6px;
				bottom: 0;
				background-color: $color-primary;
				transform: scale(1.2);
			}
		}

		// Timestamp list
		> ul {
			padding: 8px 0 8px 8px;

			// Timestamp list item
			> li {
				position: relative;

				display: block;

				font-size: $font-size-small;
				line-height: 1.3;

				color: $color-gray-500;

				&:before {
					@extend %base-bullet;
					width: 2px;
					height: 2px;
					left: -8px;
					top: 0;
					bottom: 0;
					margin: auto;
					background-color: $color-gray-600;
					transform: scale(1.2);
				}
			}
		}

		&.active,
		&.-active {
			color: $color-primary;

			> *:first-child {
				&:before {
					padding: 2px;
					background-color: $color-primary;
					transform: scale(2.8);
					box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
				}
			}

			> *:first-child {
				&:after {
					@extend %base-bullet;
					width: 8px;
					height: 8px;
					left: -27px;
					top: 6px;
					bottom: 0;
					background-color: $color-primary;
					border: 1px solid white;
					transform: scale(2.2);
				}
			}
		}

		@each $key, $value in $components-colors {
			&.#{$key},
			&.-#{$key} {
				color: $value;

				> *:first-child {
					&:before {
						background-color: $value;
					}
				}
			}
		}
	}
}
