@import "compass";
@import "mixins";

/* ---------- Mixins ---------- */

@mixin default-border-radius {
	@include border-radius(4px);
}

@mixin keyframes($name) {
	@-o-keyframes #{$name} {
		@content;
	}

	@-moz-keyframes #{$name} {
		@content;
	}

	@-webkit-keyframes #{$name} {
		@content;
	}

	@keyframes #{$name} {
		@content;
	}
}

@include keyframes(shakeNotificationCount) {
	0% {
		@include transform(rotate(5deg));
	}

	25% {
		@include transform(translate(3px, -4px), rotate(0));
	}

	50% {
		@include transform(rotate(-5deg));
	}

	75% {
		@include transform(rotate(0));
	}

	100% {
		@include transform(translate(0, 0), rotate(5deg));
	}
}

/* ---------- Dockbar & notifications portlet ---------- */

.dockbar-user-notifications, .notifications-portlet {
	.user-notifications-count {
		background-color: #0066B3;
		border: 1px solid #0066B3;
		padding: 2px 6px;

		&.alert {
			background-color: #FAA732;
			border: 1px solid #FAA732;
			color: #FFF;
		}
	}

	.dropdown-menu {
		width: 350px;
	}

	.user-notifications-list {
		list-style: none;
		margin: 0;

		.message {
			text-align: center;

			&.top {
				border-bottom: 1px solid #FFF;
			}

			&.bottom {
				border-top: 1px solid #FFF;
			}

			.left-nav {
				float: left;
				padding: 0 10px;
			}

			.right-nav {
				float: right;
				padding: 0 10px;
			}

			a:hover {
				text-decoration: none;
			}

			.disabled a {
				color: #FFF;
				cursor: default;
			}
		}

		.user-notification {
			a {
				clear: both;
				display: block;
				font-weight: normal;
				padding: 5px;
				white-space: normal;
			}

			a:hover {
				color: #FFF;
				text-decoration: none;
			}

			.icon-remove-circle {
				left: 330px;
				position: relative;
				top: 20px;
			}

			.sender {
				float: left;
				position: relative;

				.user-thumbnail img {
					@include border-radius(50%);
					@include box-shadow(0 0 0 2px #5594E0);

					margin: 5px 10px 0 0;
					width: 30px;
				}

				.portlet-icon {
					bottom: 0;
					left: 0;
					position: absolute;
				}
			}

			.read {
				float: right;
				font-size: 11px;
			}

			.timestamp {
				display: inline;
				font-size: 11px;
			}

			.content {
				margin-left: 40px;
			}
		}
	}
}

/* ---------- Dockbar notifications ---------- */

.aui {
	.dockbar .nav li.dropdown.dockbar-user-notifications .dropdown-menu {
		left: auto;
		max-height: none;
		padding: 10px;
		right: 0;

		&.pull-right:after {
			right: 20px;
		}
	}
}

.dockbar-user-notifications {
	.dropdown-toggle .user-notifications-count {
		background-color: #0066B3;
		border: 1px solid #0066B3;

		@include default-border-radius;

		display: block;
		line-height: 1.25em;
		margin: 4px 0;
		padding: 2px 6px;
		position: relative;

		&.alert {
			background-color: #FAA732;
			border: 1px solid #FAA732;
			color: #FFF;

			@include experimental(animation, shakeNotificationCount 0.8s linear infinite);
			@include experimental(animation-iteration-count, 2);
			@include experimental(transform-origin, 50% 50%);
		}
	}

	.dropdown-menu {
		width: 350px;
	}

	.actionable, .non-actionable {
		background-color: #FFF;

		@include default-border-radius;
	}

	.non-actionable {
		margin-bottom: 10px;
	}

	.user-notifications-header {
		border-bottom: 1px solid #2AAAE6;
		min-height: 31px;
		padding: 0 10px;

		& > span {
			line-height: 2.25em;
		}

		.title {
			float: left;
		}
	}
}

/* ---------- Notifications portlet ---------- */

.notifications-portlet {
	.user-notifications-sidebar {
		float: left;
		padding: 0 10px 0 0;
		width: 18%;
	}

	.nav {
		margin-bottom: 10px;

		a {
			color: #333333;
			display: block;
			padding: 5px 10px;

			.title {
				float: left;
			}

			.count {
				float: right;
			}
		}

		a:hover {
			background-color: #0A85E4;
			color: #FFF;
			text-decoration: none;
		}

		a.selected {
			background-color: #0A85E4;
			color: #FFF;
		}
	}

	.user-notifications-list-container {
		border: 1px solid #D5D5D5;
		float: left;
		width: 100%;

		.loading-mask {
			min-height: 30px;
		}
	}

	.user-notifications-list {
		.user-notification {
			a {
				border-bottom: 1px solid #D5D5D5;
				padding: 15px;
			}

			a:hover {
				background-color: #0A85E4;
				color: #FFF;
				text-decoration: none;
			}

			&.unread {
				background-color: #FAFAFA;
			}
		}

		.message {
			&.top {
				border-bottom: 1px solid #D5D5D5;
			}
		}
	}

	.manage-notifications {
		padding: 5px;

		.title {
			margin-bottom: 10px;

			.notification-delivery {
				font-size: 16px;
				font-weight: bold;
				margin-bottom: 10px;
			}
		}

		.notification-deliveries {
			caption {
				font-size: 14px;
				font-weight: bold;
				margin-bottom: 10px 0;
				text-align: left;
			}
		}
	}
}

/* ---------- Layout ---------- */

.span1, .span2, .span3, .span4, .span5, .span6 {
	.notifications-portlet {
		.user-notifications-sidebar, .user-notifications-list-container {
			margin-left: 0;
			width: 100%;
		}
	}
}

.span8 {
	width: 70%;
}

/* ---------- Internet explorer ---------- */

.ie8 .user-thumbnail img {
	max-width: none;
}

/* ---------- Touch ---------- */

.touch {
	.dockbar-user-notifications, .notifications-portlet {
		.user-notification {
			&, &.archived {
				&, &:hover, &.hover {
					.mark-as-read {
						display: none;
					}
				}
			}
		}
	}
}

.dockbar-user-notifications {
	.user-notifications-count {
		@include border-radius(4px);
	}
}

.notifications-portlet {
	.nav {
		a:hover {
			@include border-radius(4px);
		}

		a.selected {
			@include border-radius(4px);
		}
	}

	.user-notifications-list-container {
		@include border-radius(4px);
	}
}

.aui li.user-notification {
	line-height: 20px;
}

.aui .dockbar .nav li.dropdown.dockbar-user-notifications .dropdown-menu {
	left: auto;
	right: 0;
}

/* ---------- Responsive ---------- */

@include respond-to(phone) {
	.notifications-portlet, .dockbar-user-notifications {
		.user-notifications-list {
			.user-notification {
				margin: 0;

				.body-container {
					width: 100%;

					.btn {
						display: inline-block;
						margin-left: 5%;
						margin-right: 0;
						width: 45%;
					}
				}
			}

			.timestamp {
				clear: both;
				float: none;
			}
		}
	}
}