@import (reference) "../../../App/common.less";

@clips-h-offset: 15px;
@clips-v-offset: 10px;
@clips: 2;
@grid-gap: 10px;
@placeholder-color: #5c5c5c;

.collections-list {
	.pagetransition();

	& > #grid {
		flex-grow: 2;
		position: relative;

		// Disable overlay

		&::before {
			content: "";
			position: absolute;
			top: 0;
			right: 0;
			bottom: 0;
			left: 0;
			z-index: 10;
			background-color: rgba(0, 0, 0, 0.5);
			opacity: 0;
			transition: opacity 0.3s ease-in-out;
			pointer-events: none;
		}

		&[data-disabled="true"] {
			overflow-y: hidden !important;

			&::before {
				opacity: 1;
				pointer-events: all;
			}
		}

		// Children (Robert Miles, R.i.p.)

		& .collection {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			& .preview {
				position: relative;
				width: 140px + @clips-v-offset * @clips;
				height: 120px;
				padding: 4px;
				border-width: 3px;
				border-style: solid;
				border-color: transparent;
				transition: border-color 0.3s ease-in-out;
				border-radius: 3px;

				&.selected {
					border-color: #d85600;
				}

				&:not(.empty-coll),
				&.add-coll {
					cursor: pointer;
				}

				&.empty-coll,
				&.add-coll {
					border-color: #5c5c5c;
					border-style: dashed;
					border-width: 1px;
					-webkit-user-select: none;
					user-select: none;

					/**
					* To make this border and selection border
					* be of the same height
					*/

					padding-bottom: 8px;

					& div:first-child {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 100%;
						height: 100%;
					}
				}

				&.add-coll {
					& div:first-child > svg {
						width: 40px;
						height: 40px;
						fill: #5c5c5c;
					}
				}

				&.empty-coll {
					& div:first-child {
						& span.fade-blink {
							opacity: 1;
							animation-name: fade-blinking;
							animation-duration: 1s;
							animation-timing-function: ease-in-out;
							animation-direction: alternate-reverse;
							animation-iteration-count: infinite;
						}

						@keyframes fade-blinking {
							to {
								opacity: 0;
							}
						}
					}
				}

				& .clipper {
					.clipper-shifter(@clips + 1);

					position: absolute;
					width: 130px;
					height: 100px;
					overflow: hidden;
					.withImagesTrasparencyBackground(false);
				}

				& .collection-actions {
					transition: opacity 0.3s ease-in-out;
					display: flex;
					justify-content: center;
					align-items: center;

					&,
					&::before {
						position: absolute;
						top: 0;
						left: 0;
						right: 0px;
						bottom: 0px;
						z-index: 4;
					}

					&::before {
						content: "";
						background-color: rgba(25, 25, 25, 0.8);
					}

					& > svg {
						width: 35px;
						height: 35px;
						transition: fill 0.1s;
						cursor: pointer;
						z-index: 5;

						&#edit-coll {
							fill: #e6e6e6;

							&:hover {
								fill: #929292;
							}
						}

						&#delete-coll {
							fill: #d82c2c;
							margin-left: 15px;

							&:hover {
								fill: #8c1d1d;
							}
						}
					}

					&:not(.edit-mode-active) {
						opacity: 0;

						&,
						& > svg {
							pointer-events: none;
						}
					}
				}
			}

			& span {
				margin-top: 10px;
				min-height: 20px;
				display: flex;
				justify-content: space-between;
				align-items: center;
				align-self: normal;
			}

			& .add-element-btn {
				width: 130px + @clips-h-offset * @clips;
			}
		}

		& ~ footer {
			flex-shrink: 0;

			display: flex;
			justify-content: space-between;
			align-items: center;
			border-top: 0.5px solid #292929;
			height: 50px;
			padding: 0 20px; /* small sizes */

			& > .the-switcher {
				margin-left: 0;
			}
		}
	}
}

/**
 * 3 | 0 => 2 / 0 / 0
 * 3 | 1 => 1 / 10 / 10
 * 3 | 2 => 0 / 20 / 20
 */

.clipper-shifter(@loops-amount; @counter: 0;) when (@counter <= @loops-amount) {
	@childN: @counter + 1;

	&:nth-child(@{childN}) {
		z-index: @loops-amount - @counter - 1;
		left: 4 + @clips-h-offset * @counter;
		bottom: 4 + @clips-v-offset * @counter;
	}

	.clipper-shifter(@loops-amount, @counter + 1);
}
