@import '../variables.less';
@import '../mixins.less';

@thumbnailSize: 5.5rem;

.orion-sticker {
	--hoverElevation: 1;
	--elevation: calc(1rem * var(--hoverElevation));
	--shadowColor: rgba(0, 0, 0, calc(0.03 * (1 + var(--hoverElevation) / 5)));
	transition: box-shadow 0.3s, transform 0.3s;
	position: relative;
	display: flex;
	align-items: center;
	gap: 1.25rem;
	padding: var(--fluid-20px);
	border-radius: var(--radius-sticker);
	background: white;
	color: var(--grey-dark);
	box-shadow: 0 0.0625rem 0.1875rem fade(black, 10);

	[data-orion-theme='dark'] & {
		background: var(--grey-light);
	}

	+ .orion-sticker {
		margin-top: 1rem;
	}

	&__thumbnail {
		.flex-align();
		align-self: flex-start;

		> * {
			max-width: 100%;
			max-height: 100%;
		}
	}

	&__content {
		flex: 1 1 0%;
		max-width: 100%;
	}

	&__title {
		.ellipsis();
		color: var(--grey-darker);
		font-weight: 600;
	}

	&__actions {
		.flex-align();
		flex: 0 1 auto;
		flex-wrap: wrap;
		margin: 1rem 0;
		color: var(--grey-dark);

		.icon {
			position: relative;
			transition: color 0.3s;
			margin: 0 0.5rem;
			font-size: 1.25rem;

			&__indicator {
				.circle(0.375rem);
				position: absolute;
				bottom: 0;
				background: var(--grey-dark);

				&--info {
					background: var(--info);
				}

				&--mobile {
					.circle(1rem);
					.flex-align();
					left: -0.3rem;
					bottom: -0.5rem;

					&::after {
						font-family: var(--font-family);
						content: attr(data-count);
						color: white;
						font-size: 0.5rem;
						font-weight: bold;
					}
				}
			}

			&:hover:not(.orion-icon--ripple) {
				color: var(--info);
			}
		}
	}

	&__selected {
		transition: transform 0.3s;
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		display: flex;
		align-items: flex-end;
		justify-content: flex-end;
		pointer-events: none;
		border-bottom-right-radius: var(--radius-card);
		overflow: hidden;
		transform-origin: bottom right;
		transform: scale(0);

		.orion-sticker--selected & {
			transform: scale(1);
		}

		svg {
			position: absolute;
			bottom: 0;
			right: 0;
		}

		svg.marker {
			.square(5.625rem);

			.orion-sticker--selected-brand & {
				fill: var(--brand);
			}
			.orion-sticker--selected-info & {
				fill: var(--info);
			}
			.orion-sticker--selected-success & {
				fill: var(--success);
			}
			.orion-sticker--selected-warning & {
				fill: var(--warning);
			}
			.orion-sticker--selected-danger & {
				fill: var(--danger);
			}
			.orion-sticker--selected-pink & {
				fill: var(--pink);
			}
		}

		svg.check {
			transition: all 0.3s ease;
			bottom: 0.25rem;
			right: 0.25rem;
			width: 0.75rem;
			height: 0.5rem;
			fill: none;
			stroke: white;
			stroke-width: 2;
			stroke-linecap: round;
			stroke-linejoin: round;
			stroke-dasharray: 1rem;
			stroke-dashoffset: 1rem;

			.orion-sticker--selected & {
				transition-delay: 0.3s;
				stroke-dashoffset: 0;
			}
		}

		&::after,
		&::before {
			content: '';
			display: block;
			position: absolute;
			bottom: 0;
			right: 0;
		}

		&::before {
			top: 0.5rem;
			width: 0.0625rem;

			.orion-sticker--selected-info & {
				background: linear-gradient(
					to bottom,
					rgba(var(--rgb-info), 0),
					var(--info)
				);
			}
			.orion-sticker--selected-success & {
				background: linear-gradient(
					to bottom,
					rgba(var(--rgb-success), 0),
					var(--success)
				);
			}
			.orion-sticker--selected-warning & {
				background: linear-gradient(
					to bottom,
					rgba(var(--rgb-warning), 0),
					var(--warning)
				);
			}
			.orion-sticker--selected-danger & {
				background: linear-gradient(
					to bottom,
					rgba(var(--rgb-danger), 0),
					var(--danger)
				);
			}
		}

		&::after {
			left: 0.5rem;
			height: 0.0625rem;

			.orion-sticker--selected-brand & {
				background: linear-gradient(
					to right,
					rgba(var(--rgb-brand), 0),
					var(--brand)
				);
			}

			.orion-sticker--selected-info & {
				background: linear-gradient(
					to right,
					rgba(var(--rgb-info), 0),
					var(--info)
				);
			}
			.orion-sticker--selected-success & {
				background: linear-gradient(
					to right,
					rgba(var(--rgb-success), 0),
					var(--success)
				);
			}
			.orion-sticker--selected-warning & {
				background: linear-gradient(
					to right,
					rgba(var(--rgb-warning), 0),
					var(--warning)
				);
			}
			.orion-sticker--selected-danger & {
				background: linear-gradient(
					to right,
					rgba(var(--rgb-danger), 0),
					var(--danger)
				);
			}
			.orion-sticker--selected-pink & {
				background: linear-gradient(
					to right,
					rgba(var(--rgb-pink), 0),
					var(--pink)
				);
			}
		}

		.icon {
			position: absolute;
			bottom: 0.25rem;
			right: 0.25rem;
			font-size: 0.5rem;
			color: white !important;
			margin: 0 !important;
		}
	}

	.orion-sticker-wrapper--floating > .orion-sticker-rotator > & {
		&:hover {
			transform: none;
			box-shadow: none;
		}
	}

	&--muted {
		background: var(--grey-lighter);
		border: 0.0625rem solid var(--grey-light);
		box-shadow: none;

		[data-orion-theme='dark'] & {
			background: var(--grey-lighter);
		}
	}

	&--clickable {
		cursor: pointer;
	}

	&:not(.orion-sticker--muted):not(.orion-sticker--no-elevation):hover {
		body:not(.istouch) & {
			z-index: 1;
			transform: translate3d(0, -0.125rem, 0);
			box-shadow: 0 calc(var(--elevation) / 8) calc(var(--elevation) / 8)
					var(--shadowColor),
				0 calc(var(--elevation) / 4) calc(var(--elevation) / 4)
					var(--shadowColor),
				0 calc(var(--elevation) / 2) calc(var(--elevation) / 2)
					var(--shadowColor),
				0 var(--elevation) var(--elevation) var(--shadowColor),
				0 calc(var(--elevation) * 2) calc(var(--elevation) * 2)
					var(--shadowColor);
		}
	}
}
