$widthSidebarNav: 210px
$widthSidebarSubmenu: 200px
$menu-item-size: 34px
$min-height: 850px

#nav-sidebar
	position: fixed
	width: $widthSidebarNav
	height: 100%
	z-index: 500
	background-color: darken($main-color,15%)
	ul.menu
		margin: 0
		padding: 0
		list-style: none !important
		li.searchtab
			padding: 14px 7px
			height: 55px
			position: relative
			background-color: darken($main-color,5%)
			border-bottom: darken($main-color,10%) solid 1px
			@include box-shadow(rgba(black,0.1s) 0 -3px 0 0 inset)
			#bo_query
				color: $main-color
				background-color: lighten($main-color,60%)
			.form-group.focus-search
				position: absolute
				width: 400px
				height: 55px
				z-index: 900
				padding: 14px 13px 0 7px
				top: 0
				left: 0
				background-color: darken($main-color,5%)
				border-bottom: darken($main-color,10%) solid 1px
				#bo_query
					width: 100%
			.clear_search
				position: absolute
				top: 6px
				right: 8px
				z-index: 10
			i
				font-size: $icon-size-base
		li.maintab
			position: relative
			ul.submenu
				display: none
				padding: 4px
				background-color: darken($main-color,8%)
				li
					list-style: none !important
					a
						color: mix($main-color, contrast-color($main-color, black, white, 50%), 30%)
						display: block
						padding: 3px 8px
						background-color: $main-color
						border-bottom: darken($main-color,10%) solid 1px
						&:hover
							color: contrast-color($main-color, black, white, 50%)
							text-decoration: none
							background-color: darken($main-color,10%)
							@include box-shadow($brand-primary -4px 0 0 0 inset)
			a
				white-space: nowrap
				text-overflow: ellipsis
				overflow: hidden
			> a.title
				display: block
				position: relative
				padding: 0 .35em
				height: $menu-item-size
				border-bottom: darken($main-color,10%) solid 1px
				background-color: $main-color
				color: mix($main-color, contrast-color($main-color, black, white, 50%), 30%)
				line-height: $menu-item-size
				text-transform: uppercase
				text-decoration: none
				@include transition-property(background-color)
				@include transition-duration(0.2s)
				@include transition-timing-function(ease-out)
				i
					width: 42px
					font-size: $icon-size-base*2
					vertical-align: middle
					color: mix($main-color, contrast-color($main-color, black, white, 50%), 60%)
					@include transition-property(color)
					@include transition-duration(0.4s)
					@include transition-timing-function(ease-out)
			&.hover, &:hover:not(.hover)
				> a.title
					background-color: darken($main-color,8%)
					color: contrast-color($main-color, black, white, 50%)
					i
						color: white
			&.hover
				ul.submenu
					position: absolute
					display: block
					width: $widthSidebarSubmenu
					left: $widthSidebarNav
					top: 0
					z-index: 600
			&:last-child > a.title
				border-bottom: none
			&.active
				a, li.active a
					background-color: lighten($main-color,10%)
					color: contrast-color($main-color, black, white, 50%)
					i
						color: white
				@media (min-height: $min-height)
					ul.submenu
						body:not(.page-sidebar-closed) &
							display: block
							background-color: white
							border-right: 1px solid darken($bg-content-color,10%)
							a
								background-color: white
								color: $brand-primary
								border-bottom: solid 1px mix(white, $brand-primary, 85%)
								&:hover
									color: $brand-primary
									border-bottom: solid 1px mix(white, $brand-primary, 85%)
									background-color: mix(white, $brand-primary, 85%)
									text-decoration: none
									@include box-shadow(white 0 -1px)
							li:last-child a
								border-bottom: solid 1px white
							li.active a
								color: contrast-color($brand-primary, white, #333, 10%)
								background-color: $brand-primary
								position: relative
								top: -1px
								border-top: solid 1px white
								border-bottom: solid 1px $brand-primary
			
	@media (max-width: $screen-phone)
		display: none

@media (max-height: $min-height)
	body:not(.page-sidebar-closed)
		#nav-sidebar ul.menu li.maintab > a.title
			font-size: 12px
			height: 28px
			line-height: 28px
			i
				vertical-align: baseline
				text-align: right
				width: 18px
				font-size: 14px
		#nav-sidebar ul.menu li.maintab ul.submenu
			padding: 1px 1px 0 1px
			li a
				padding: 0 6px
				height: 26px
				line-height: 26px
		#nav-sidebar ul.menu li.maintab.active ul.submenu
			display: none
		#nav-sidebar ul.menu li.maintab.active.hover ul.submenu
			position: absolute
			display: block
			width: 200px
			z-index: 600
			left: $widthSidebarNav
			top: 0

.page-sidebar
	#content
		margin-left: $widthSidebarNav

.page-sidebar-closed
	#nav-sidebar
		overflow: visible
		width: 50px
		ul.submenu
			display: none!important
			position: relative
			top: $menu-item-size
			padding: 1px 4px 3px 4px!important
		li.searchtab
			color: rgba(white,.5)
			&:hover
				cursor: pointer
				color: white
			&.search-expanded
				padding: 14px 13px 0 7px
				width: 400px
				background-color: darken($main-color,5%)
				&:before
					display: none
				form .form-group
					display: block
		li.maintab.active ul.submenu
			border: none !important
		a.title
			text-align: center
			> span
				display: none
		> ul > li.maintab:hover
			width: 250px!important
			position: relative
			a.title
				text-align: left
				> span
					display: inline-block
			ul.submenu
				position: absolute!important
				display: block!important
				left: 50px!important
				top: $menu-item-size!important
				width: 200px!important
	#content
		margin-left: 55px
		@media (max-width: $screen-phone)
			margin-left: 0
		h2.page-title
			white-space: nowrap
			padding: 26px 0 0 120px!important
		ul.page-breadcrumb
			left: 120px!important
	.submenu_expand
		display: none

#nav-topbar
	position: fixed
	height: 28px
	top: 37px
	width: 100%
	padding: 0 40px 0 0
	z-index: 600
	background-color: white
	ul.menu
		margin: 0
		padding: 0
		display: block
		list-style: none
		li.maintab, li.subtab
			height: 28px
			padding: 0
			margin: 0
			list-style: none
			position: relative
			float: left
			> a
				display: block
				line-height: 27px
				color: lighten($main-color,20%)
				padding: 0 6px
				margin: 0
				font-size: 12px
				i
					margin: 0
					width: 15px
					color: lighten($main-color,10%)
					background-color: transparent
					font-size: 14px
			&.active, &:hover
				background-color: $brand-primary
				> a
					text-decoration: none
					color: contrast-color($main-color, white, #333, 10%)
					i
						color: white

		li.expanded > ul.submenu
			display: block
		ul.submenu
			background-color: white
			display: none
			position: absolute
			margin: 0
			padding: 0
			left: 0
			top: 28px
			width: 200px!important
			@include box-shadow(rgba(black,0.3) 0 2px 4px)
			> li
				width: 200px
				padding: 0
				list-style: none
				&:last-child > a
					border: none
				> a
					display: block
					padding: 4px 5px 4px 10px
					border-bottom: solid 1px lighten($brand-primary,45%)

					&:hover
						color: white
						background-color: $brand-primary
						text-decoration: none
				&.active a
					color: contrast-color($brand-primary, white, #333, 10%)
					background-color: $brand-primary
					border-bottom: solid 1px darken($brand-primary,10%)
	#ellipsistab
		display: block
		width: 40px
		height: 28px
		padding: 0
		margin: 0
		position: absolute
		right: 0
		> a
			text-align: center
			font-size: 14px
			line-height: 30px
			color: $main-color
			cursor: pointer
		ul#ellipsis_submenu
			right: 0
			left: inherit
			a.title
				padding: 0 8px
				text-align: left
			li.subtab.expanded > ul
				left: -200px
				top: 0
	.menu-collapse
		display: none

#nav-mobile
	position: fixed
	top: 0
	left: 0
	width: 35px
	height: 35px
	z-index: 1100
	&.expanded
		width: 100%
		height: 100%
		top: 35px
		.menu-collapse
			top: -35px
			left: 0
			position: absolute
			z-index: 1200
	ul.menu
		position: absolute
		display: none
		width: 100%
		height: 100%
		background-color: rgba(black,0.8)
		margin: 0 0 100px 0
		padding: 0
		border-top: 1px black solid
		list-style: none
		@include transition(all 0.35s ease-out)
		@include animate(fadeInLeft, 0.3s)
		> li.searchtab
			padding: 15px
			position: relative
			@include box-shadow(rgba(black,0.1s) 0 -3px 0 0 inset)
			#bo_query
				color: $main-color
				background-color: lighten($main-color,60%)
			.form-group
				margin: 0
			.clear_search
				position: absolute
				top: 5px
				right: 5px
		> li
			background: $main-color
			position: relative
			> a
				display: block
				height: $menu-item-size
				line-height: $menu-item-size
				position: relative
				padding: 0 0 0 10px
				border-bottom: 1px solid darken($main-color,10%)
				font-size: 12px
				color: mix($main-color, contrast-color($main-color, white, #333, 10%), 30%)
				background-color: $main-color
				text-transform: uppercase
				text-decoration: none
				@include transition-property(background-color)
				@include transition-duration(0.4s)
				@include transition-timing-function(ease-out)
				i
					color: rgba(white,.6)
					vertical-align: middle
					@include transition-property(color)
					@include transition-duration(0.4s)
					@include transition-timing-function(ease-out)
				&:hover
					background-color: lighten($main-color,10%)
					color: white
					i
						color: white
			> a > i
				display: inline-block
				height: $menu-item-size
				width: $menu-item-size
				font-size: 20px
				line-height: $menu-item-size
				color: white
				text-align: center
	ul.submenu
		display: none
	#nav-mobile-submenu
		a:not(#nav-mobile-submenu-back)
			font-size: 1.2em
			padding-left: 50px
			text-transform: none
	a#nav-mobile-submenu-back
		background-color: darken($main-color,5%)
		font-size: 1.5em
	ul.menu.menu-close
		@include animate(fadeOutLeft, 0.2s)
	.menu-collapse
		color: white
		background-color: black
		width: 35px
		height: 35px
		text-align: center
		line-height: 1.3em


.menu-collapse
	cursor: pointer
	height: 54px
	width: 100%
	font-size: 2em
	text-align: center
	line-height: 55px
	display: block
	color: $main-color

.mobile-nav
	#content
		h2.page-title
			padding-left: 10px!important
		ul.page-breadcrumb
			left: 10px!important

.page-topbar:not(.mobile-nav)
	#main
		padding-top: 64px
	#content
		margin-left: 0
		.page-head
			top: 66px
		.page-title
			padding-left: 75px
		.page-breadcrumb
			left: 75px

.page-sidebar-closed:not(.nav-topbar):not(.mobile-nav)
	.searchtab
		&:before
			z-index: 1000
			position: absolute
			top: 16px
			left: 14px
			display: block
			width: 28px
			height: 28px
			@extend .icon
			@extend .icon-2x
			@extend .icon-search
		.form-group
			display: none

.page-topbar
	.searchtab
		display: none

