@use "common";
@use "var";
@use "color";
@use "fa";

$panel-width: 30vw;
$panel-width-max: "400px + 3 * #{var.$block-spacing}";
$panel-actual-width: min($panel-width, #{$panel-width-max});

#projects {
	&.with-feed, &.with-settings {
		#title {
			max-width: calc(100vw - var.$block-spacing - $panel-actual-width - (var.$button-width + var.$block-spacing * 2) * 2);
		}
	}

	&.with-feed {
		#submap {
			transform: translateX(calc($panel-actual-width / -2));
		}

		.map-container-right {
			transform: translateX(calc(100vw - $panel-actual-width));
		}
	}

	&.with-settings {
		#submap {
			transform: translateX(calc($panel-actual-width / 2));
		}

		.map-container-left {
			transform: translateX(0);

			.map-panel {
				box-shadow: 2px 2px var.$block-shadow 0px rgba(0, 0, 0, .5);
			}
		}
	}

	&.with-feed.with-settings {
		#submap {
			transform: translateX(0);
		}

		#title {
			max-width: calc(100vw - var.$block-spacing - $panel-actual-width * 2 - (var.$button-width + var.$block-spacing * 2) * 2);
		}
	}

	.map-container { //#feed, #settings
		position: absolute;
		top: 0;
		bottom: 0;
		z-index: 1;
		user-select: none;
		width: #{$panel-width};
		max-width: calc(#{$panel-width-max});
		transition: transform 0.5s;
		
		&.moving {
			cursor: grabbing;
			transition: none;
		}

		.map-panel { //#feed-panel, #settings-panel
			position: absolute;
			top: 0;
			bottom: 0;
			left: 0;
		}

		input, textarea {
			background-color: color.$post-input-bg;
			color: color.$post;
			outline: none;
		}
	
		button, a.button {
			background-color: color.$post;
			color: color.$post-bg;
	
			&:hover, &:hover a, &:hover a:visited {
				background-color: color.$post-input-bg;
				color: color.$post;
			}
	
			a, a:visited {
				background-color: color.$post;
				color: color.$post-bg;
				text-decoration: none;
			}
	
			&+ button, &+ a.button {
				margin-left: var.$elem-spacing;
			}
		}
	}

	.map-container-left { //#settings
		transform: translateX(-100%);

		.map-panel { //#settings-panel
			width: calc(100% - var.$block-spacing);
			margin: var.$block-spacing;
			border-radius: var.$block-radius;
			color: color.$post;
			background: rgba(255, 255, 255, 0.8);
			display: flex;
			flex-direction: column;
			flex-wrap: nowrap;
		}
	}

	.map-container-right { //#feed
		transform: translateX(100vw);
		
		.map-panel { //#feed-panel
			width: 100%;
			padding-top: var.$block-spacing;
		}
	}

	.map-control {
		position: absolute;
		background-color: color.$post-bg;
		padding: var.$elem-spacing;
		border-radius: 3px;
		box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.5);
		font-size: 12px;
		line-height: 1.5;
		
		&.map-control-top {
			top: var.$block-spacing;
		}

		&.map-control-bottom {
			bottom: var.$block-spacing;
		}

		&.map-control-icon {
			cursor: pointer;

			.fa {
				@extend .fa-fw;
				color: color.$post;
			}

			&:hover .fa {
				color: #000000;
			}
		}
	}

	.feed-control {
		right: calc(100% + var.$block-spacing);
	}

	.settings-control {
		left: calc(100% + var.$block-spacing);
	}

	#legend {
		.track {
			white-space: nowrap;
			.line {
				width: 2em;
				display: inline-block;
				border-radius: 2px;
				vertical-align: middle;
			}

			.desc {
				font-size: 1em;
				margin-left: 0.5em;
				color: color.$legend;
			}
		}
	}

	#title {
		left: calc(100% + var.$button-width + 2 * var.$block-spacing);
		max-width: calc(100vw - var.$block-spacing - (var.$button-width + 2 * var.$block-spacing) * 2);
		transition: max-width 0.5s;
		@include common.no-text-overflow();

		span {
			font-size: 1.3em;
			line-height: calc(var.$block-spacing / 1.3);
		}
	}

	#background {
		background: #666;
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		right: 0;
	}

	#submap {
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		right: 0;
		transition: transform 0.5s;

		.loader {
			position: absolute;
			font-size: 3em;
			top: calc(50% - 0.5em);
			left: calc(50% - 1.25em/2);
			color: #CCC;
		}
	}
}