@import "../common/mixin.scss";

%size {
	width: 100%;
	height: 100%;
}

@include b(image) {
	position: relative;
	display: inline-block;
	overflow: hidden;

	@include e(inner) {
		@extend %size;
		vertical-align: top;

		@include m(center) {
			position: relative;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			display: block;
		}
	}

	@include e(placeholder) {
		@extend %size;
		background: $--image-background-color;
	}

	@include e(error) {
		@extend %size;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 14px;
		background: $--image-background-color;
		color: $--color-text-primary;
		vertical-align: middle;
	}

	@include e(preview) {
		cursor: pointer;
	}
}

@include b(image-viewer) {
	@include e(wrapper) {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
	}

	@include e(btn) {
		position: absolute;
		z-index: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		opacity: 0.8;
		cursor: pointer;
		box-sizing: border-box;
		user-select: none;
	}

	@include e(close) {
		top: 36px;
		right: 36px;
		width: 32px;
		height: 32px;
		font-size: 14px;
		color: #fff;
		background-color: rgba(255, 255, 255, 0.38);
		transition: background-color 0.3s;
		&:hover {
			background-color: rgba(255, 255, 255, 0.5);
		}
	}

	@include e(canvas) {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	@include e(actions) {
		left: 50%;
		bottom: 30px;
		transform: translateX(-50%);
		width: 282px;
		height: 38px;
		padding: 0 23px;
		background-color: #606266;
		border-color: #fff;
		border-radius: 22px;

		@include e(actions__inner) {
			width: 100%;
			height: 100%;
			text-align: justify;
			cursor: default;
			font-size: 18px;
			display: flex;
			align-items: center;
			justify-content: space-around;
			i {
				cursor: pointer;
				color: rgba(255, 255, 255, 0.5);
				transition: color 0.3s;
				&:hover {
					color: rgba(255, 255, 255, 1);
				}
			}
		}
	}

	@include e(prev) {
		top: 50%;
		transform: translateY(-50%);
		width: 32px;
		height: 32px;
		font-size: 14px;
		color: #fff;
		border-color: #fff;
		left: 40px;
		background-color: rgba(255, 255, 255, 0.38);
		transition: background-color 0.3s;
		&:hover {
			background-color: rgba(255, 255, 255, 0.5);
		}
	}

	@include e(next) {
		top: 50%;
		transform: translateY(-50%);
		width: 32px;
		height: 32px;
		font-size: 14px;
		color: #fff;
		border-color: #fff;
		right: 40px;
		text-indent: 2px;
		background-color: rgba(255, 255, 255, 0.38);
		transition: background-color 0.3s;
		&:hover {
			background-color: rgba(255, 255, 255, 0.5);
		}
	}

	@include e(mask) {
		position: absolute;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		opacity: 0.5;
		background: #000;
	}
}

.viewer-fade-enter-active {
	animation: viewer-fade-in 0.3s;
}

.viewer-fade-leave-active {
	animation: viewer-fade-out 0.3s;
}

@keyframes viewer-fade-in {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}

@keyframes viewer-fade-out {
	0% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}
