//
// Asset Queue Manager
//
// Styles for the management panel attached to the admin bar
//

@bg:				#333;
@bg-panel:			#ddd;
@bg-lift:			#fff;
@primary:			#2ea2cc;
@offset:			#d64e07;
@text:				#222;
@text-shade:		#777;
@wob:				#fff;

#wp-admin-bar-asset-queue-manager {

	.ab-item {
		cursor: pointer;
		cursor: hand;
	}

	&.open {
		background: @bg;
	}

	&:hover,
	&:focus {

		.inactive {
			display: block;
		}
	}

	.inactive {
		display: none;
		position: fixed;
		top: 28px;
		left: 0;
		width: 100%;
		background: @bg;

		p {
			margin: 0;
			padding: 1em;
			line-height: 18px;
		}

		a {
			display: inline;
			color: @primary;
			height: auto;
			padding: 0;
			line-height: 18px;
		}
	}
}

#aqm-panel {
	display: none;
	position: absolute;
	top: 32px;
	width: 100%;
	background: @bg;
	color: @wob;
	z-index: 99998; /* just under the admin bar */
	font: 400 13px/24px "Open Sans",sans-serif; /* Mimic the WP admin bar */

	&.open {
		padding: 1em 0;
	}

	h3 {
		font-size: 100%;
		padding-left: 1em;
		line-height: 20px;

		.dashicons {
			margin-right: 0.25em;
			color: @primary;
		}
	}

	.dequeued h3 .dashicons {
		color: @offset;
	}

	.asset {
		width: 20em;
		display: inline-block;
		position: relative;
		background: @bg-panel;
		vertical-align: top;
		margin-left: 1em;
		margin-top: 2em;
		padding: 0.5em;
		border-bottom: 4px solid @primary;
		overflow: hidden;
		color: @text;

		&.open {
			overflow: initial;

			.body,
			.src_input {
				display: block;
			}

			.src {
				display: none;
			}

			&:hover,
			&:active {
				background: @bg-panel;
			}
		}

		&:hover,
		&:active {
			background: #bbb;
			cursor: pointer;
			cursor: hand;

			.dashicons {
				display: block;
			}
		}

		.dashicons {
			display: none;
			position: absolute;
			top: 0.5em;
			right: 0.5em;
		}
	}

	.handle {
		font-family: monospace;
		font-size: 1.2em;
	}

	.src {
		color: @text-shade;
		white-space: nowrap;
	}

	.src_input {
		display: none;
		margin: 1em 0;

		input {
			padding: 0.5em;
			width: 100%;
			border: 1px solid #bbb;
			background: #ccc;
			color: @text;
			border-radius: 5px;
			box-sizing: border-box;
		}
	}

	.section.dequeued .asset {
		border-color: @offset;
	}

	.section .asset.requeued {
		opacity: 0.5;
		border-color: @primary;
	}

	.body {
		display: none;
	}

	.notice {
		line-height: 18px;
		margin-top: 1em;
		padding: 0.5em 1em;
		background: @bg-lift;
		border-left: 4px solid @primary;

		&.request,
		&.requeued {
			margin-bottom: 0;
		}
	}

	.links {

		a {
			background: @primary;
			color: @wob;
			display: inline-block;
			position: relative;
			border: 1px solid @primary;
			margin-right: 1em;
			padding: 0.5em 1em;
			border-bottom: 2px solid darken( @primary, 15% );
			border-radius: 5px;
			text-decoration: none;

			&:hover,
			&:focus {
				background: @offset;
				border-color: darken( @offset, 15% );
			}

			&:active {
				top: 1px;
				border-bottom: 1px solid darken( @offset, 15% );
			}
		}
	}
}

//
// Spinner Animation
//
// Thanks Mikhail Proniushkin
// http://codepen.io/mikepro4/
//
#aqm-panel {

	.notice {

		&.request {
			height: 18px;

			.spinner {
				display: inline-block;
				line-height: 18px;
				vertical-align: middle;
				margin-right: 0.5em;

				&:after {
					display: inline-block;
					position: relative;
					width: 16px;
					height: 16px;
					-webkit-animation: aqmrotate .6s linear infinite;
					-moz-animation: aqmrotate .6s linear infinite;
					-ms-animation: aqmrotate .6s linear infinite;
					-o-animation: aqmrotate .6s linear infinite;
					animation: aqmrotate .6s linear infinite;
					border-radius: 100%;
					border-top: 1px solid #545a6a;
					border-bottom: 1px solid #d4d4db;
					border-left: 1px solid #545a6a;
					border-right: 1px solid #d4d4db;
					content: '';
					opacity: .5;
				}
			}
		}
	}
}
.transform (@transform) {
	transform: @transform;
	-webkit-transform: @transform;
	-moz-transform: @transform;
	-o-transform: @transform;
}

@keyframes aqmrotate {
  0% {
    .transform(rotateZ(-360deg));
  }
  100% {
    .transform(rotateZ(0deg));
  }
}

@-webkit-keyframes aqmrotate {
  0% {
    .transform(rotateZ(-360deg));
  }
  100% {
    .transform(rotateZ(0deg));
  }
}

@-moz-keyframes aqmrotate {
  0% {
    .transform(rotateZ(-360deg));
  }
  100% {
    .transform(rotateZ(0deg));
  }
}

@-o-keyframes aqmrotate {
  0% {
    .transform(rotateZ(-360deg));
  }
  100% {
    .transform(rotateZ(0deg));
  }
}
