@import 'mw.rcfilters.mixins';

.mw-rcfilters-ui-changesListWrapperWidget {
	&-results {
		width: 35em;
		margin: 5em auto;

		&-noresult,
		&-conflict {
			font-weight: bold;
			margin-bottom: 0.5em;
		}
	}

	ul {
		// Each li's margin-left should be the width of the highlights
		// element + the margin
		margin-left: ~'calc( ( @{result-circle-diameter} + @{result-circle-margin} ) * 5 + @{result-circle-general-margin} )';
	}

	&-highlighted {
		ul {
			list-style: none;

			li {
				list-style: none;
			}
		}
	}

	// Correction for Enhanced RC
	// This is outside the scope of the 'highlights' wrapper
	table.mw-enhanced-rc {
		margin-left: ~'calc( ( @{result-circle-diameter} + @{result-circle-margin} ) * 5 + @{result-circle-general-margin} )';

		td:last-child {
			width: 100%;
		}
	}

	&-highlights {
		display: none;
		padding: 0 @result-circle-general-margin 0 0;
		text-align: right;
		// The width is 5 circles times their diameter + individual margin
		// and then plus the general margin
		width: ~'calc( ( @{result-circle-diameter} + @{result-circle-margin} ) * 5 )';
		// And we want to shift the entire block to the left of the li
		position: absolute;
		left: 0;

		.mw-rcfilters-ui-changesListWrapperWidget-highlighted & {
			display: inline-block;
		}

		div {
			.box-sizing( border-box );
			margin-right: @result-circle-margin;
			vertical-align: middle;
			// This is to make the dots appear at the center of the
			// text itself; it's a horrendous hack and blame JamesF for it.
			margin-top: -2px;
		}

		&-color {

			&-none {
				.mw-rcfilters-mixin-circle( @highlight-none, @result-circle-diameter, 0, true );
				display: inline-block;

				.mw-rcfilters-highlight-color-c1 &,
				.mw-rcfilters-highlight-color-c2 &,
				.mw-rcfilters-highlight-color-c3 &,
				.mw-rcfilters-highlight-color-c4 &,
				.mw-rcfilters-highlight-color-c5 & {
					display: none;
				}
			}
			.result-circle( c1 );
			.result-circle( c2 );
			.result-circle( c3 );
			.result-circle( c4 );
			.result-circle( c5 );
		}
	}

	// One color
	.mw-rcfilters-highlight-color-c1 {
		background-color: tint( @highlight-c1, 70% );
	}

	.mw-rcfilters-highlight-color-c2 {
		background-color: tint( @highlight-c2, 70% );
	}

	.mw-rcfilters-highlight-color-c3 {
		background-color: tint( @highlight-c3, 70% );
	}

	.mw-rcfilters-highlight-color-c4 {
		background-color: tint( @highlight-c4, 70% );
	}

	.mw-rcfilters-highlight-color-c5 {
		background-color: tint( @highlight-c5, 70% );
	}

	// Two colors
	.highlight-color-mix( c1, c2 );
	.highlight-color-mix( c1, c3 );
	.highlight-color-mix( c1, c4 );
	.highlight-color-mix( c1, c5 );
	.highlight-color-mix( c2, c3 );
	.highlight-color-mix( c2, c4 );
	.highlight-color-mix( c2, c5 );
	.highlight-color-mix( c3, c4 );
	.highlight-color-mix( c3, c5 );
	.highlight-color-mix( c4, c5 );

	// Three colors
	.highlight-color-mix( c1, c2, c3 );
	.highlight-color-mix( c1, c2, c5 );
	.highlight-color-mix( c1, c2, c4 );
	.highlight-color-mix( c1, c3, c4 );
	.highlight-color-mix( c1, c3, c5 );
	.highlight-color-mix( c1, c4, c5 );
	.highlight-color-mix( c2, c3, c4 );
	.highlight-color-mix( c2, c3, c5 );
	.highlight-color-mix( c2, c4, c5 );
	.highlight-color-mix( c3, c4, c5 );

	// Four colors
	.highlight-color-mix( c1, c2, c3, c4 );
	.highlight-color-mix( c1, c2, c3, c5 );
	.highlight-color-mix( c1, c2, c4, c5 );
	.highlight-color-mix( c1, c3, c4, c5 );
	.highlight-color-mix( c2, c3, c4, c5 );

	// Five colors:
	.mw-rcfilters-highlight-color-c1.mw-rcfilters-highlight-color-c2.mw-rcfilters-highlight-color-c3.mw-rcfilters-highlight-color-c4.mw-rcfilters-highlight-color-c5 {
		background-color: tint( mix( @highlight-c1, mix( @highlight-c2, mix( @highlight-c3, average( @highlight-c4, @highlight-c5 ), 20% ), 20% ), 20% ), 15% );
	}
}
