@mixin center($width, $height) {
	position: absolute;
	top: 50%;
	left: 50%;
	width: $width;
	height: $height;
	margin-top: -($height / 2);
	margin-left: -($width / 2);
}

@keyframes currency-animation-move {
	0% {
		opacity: 0;
		transform: translate(-120px);
	}

	40% {
		opacity: 1;
	}

	50% {
		opacity: 1;
	}

	90% {
		opacity: 0;
	}

	100% {
		opacity: 0;
		transform: translate(120px);
	}
}

@keyframes currency-animation-scale {
	0% {
		transform: scale(1);
	}

	50% {
		transform: scale(0.5);
	}

	100% {
		transform: scale(1);
	}
}

@keyframes currency-animation-opacity {
	0% {
		opacity: 0;
	}

	30% {
		opacity: 0.4;
		filter: saturate(0%);
	}

	50% {
		opacity: 1;
		filter: saturate(100%);
	}

	100% {
		opacity: 1;
	}
}

@keyframes fade-in-right-arrow {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 0.2;
	}
}

@keyframes fadeIn {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 1;
	}
}

.SwapDetails .Modal__dialog {
	position: relative;

	h1 {
		line-height: 1.3; // Give it slightly taller modal header than the default
	}

	.title {
		display: flex;
		justify-content: space-between;
		align-items: center;

		> :not(.title__main) {
			opacity: 0.7;
			font-size: 14px;
		}
	}

	.section {
		margin: 10px 0;
	}

	.overview {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 0 0 20px; /* TODO: Figure out why this has to be set to so much */

		.currency-animation {
			@include center(60px, 60px);
			animation: currency-animation-move 2s 0.5s infinite normal ease-in-out forwards;
			z-index: -999;
			margin-top: -63px;

			.scale-wrapper {
				@include center(60px, 60px);
				animation: currency-animation-scale 2s 0.5s infinite normal ease-in-out forwards;

				.from,
				.to {
					position: absolute;
					top: -5px;
				}

				.to {
					animation: currency-animation-opacity 2s 0.5s infinite normal ease-in-out forwards;
					z-index: 10;
				}
			}
		}

		.RightArrow {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			opacity: 0.2;
			animation: fade-in-right-arrow 0.5s linear;
			margin-top: -10px;
		}

		.from {
			margin-right: 100px;
		}

		.from,
		.to {
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 160px;

			img {
				display: block;
				width: 60px;
				height: 60px;
				margin-bottom: 8px;
			}

			p {
				margin: 0;
				font-size: 13px;
			}

			.amount {
				color: var(--text-color2);
				font-size: 17px;
			}
		}
	}

	.Progress {
		position: absolute;
		top: 0;
		left: 0;
		overflow: hidden;
		border-top-left-radius: 3px;
		border-top-right-radius: 3px;
	}

	.progress {
		text-align: center;
	}

	.toggle-advanced {
		position: absolute;
		bottom: 13px;
		left: 50%;
		transform: translate(-50%, 0);
		font-size: 12px;
		opacity: 0.6;
		cursor: default;
		transition: 0.2s ease-out;

		&:hover {
			opacity: 1;
		}

		&::after,
		&::before {
			content: none;
		}

		&__arrow {
			position: absolute;
			left: 50%;
			bottom: -8px;
			transform: translate(-50%, 0) rotate(90deg);
		}
	}

	.toggle-advanced.is-shown {
		bottom: 5px;

		.toggle-advanced__arrow {
			position: absolute;
			left: 50%;
			top: -6px;
			transform: translate(-50%, 0) rotate(270deg);
		}
	}

	.details {
		flex: 1;
		overflow-x: hidden;
		overflow-y: auto;
		text-align: center;

		h4 {
			display: block;
			width: 100%;
			border-bottom: 1px solid var(--section-border-color);
			padding-bottom: 6px;
			margin-bottom: 16px;
			text-transform: uppercase;
			font-weight: normal;
			color: var(--text-color);
		}

		.offer,
		.transactions {
			display: flex;
			justify-content: space-between;

			h6 {
				font-size: 12px;
				color: var(--text-color);
				margin: 0;
				margin-bottom: 3px;
			}

			p {
				margin: 0;
				font-size: 14px;
				color: var(--text-color-faded);
			}
		}

		.offer-wrapper {
			margin-bottom: 40px;

			> p {
				margin-top: 10px;
			}
		}

		.offer {
			justify-content: space-evenly;
			margin-left: 20px;
			margin-right: 20px;
			text-align: left;

			h6 {
				text-align: center;
			}

			span {
				display: inline-block;
				width: 36px;
				text-align: right;
				color: var(--text-color);
			}
		}

		.transactions {
			justify-content: space-evenly;
			margin-bottom: 40px;

			.item {
				display: flex;
				flex-direction: column;
				justify-items: center;
				align-items: center;
				width: 90px;
				height: 94px;
				background: rgba(0, 0, 0, 0.08);
				border: 1px solid rgba(0, 0, 0, 0.08);
				border-radius: 4px;
				padding: 8px;
				position: relative;
				opacity: 0.6;
				transition: 0.5s linear;

				[data-theme='light'] & {
					background: rgba(0, 0, 0, 0.02);
				}

				h6 {
					margin-bottom: 6px;
					opacity: 0.4;
					transition: 0.5s linear;
					font-size: 12px;
				}

				p {
					line-height: 1.4;
					font-size: 10px;
				}

				&.completed {
					opacity: 1;
					border: 1px solid var(--primary-color-opacity-0-7);

					h6 {
						opacity: 1;
					}

					p {
						animation: fadeIn 1s linear;
					}
				}
			}

			.arrow {
				align-self: center;
				font-size: 14px;
				color: rgba(255, 255, 255, 0.25);

				&:first-child {
					display: none;
				}
			}
		}
	}
}
