/**
 * NoNumber Page stylesheet
 *
 * @package         Tabs
 * @version         3.6.4
 *
 * @author          Peter van Westen <peter@nonumber.nl>
 * @link            http://www.nonumber.nl
 * @copyright       Copyright © 2014 NoNumber All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
/*
 * You can override this stylesheet by creating your own in:
 * /templates/[YOUR TEMPLATE]/css/tabs/style.min.css
 */
@import "../../nnframework/less/init.less";
@import "bootstrap.less";

@border-color: #ddd;

.nn_tabs {
	.clearfix();
	> ul.nav-tabs-sm {
		display: none;
	}
	> ul.nav-tabs {
		> li {
			/* Reset styles to prevent templates li styles from messing stuff up */
			margin: 0 !important;
			margin-bottom: -1px !important;
			padding: 0 !important;
			list-style: none !important;
			list-style-image: none !important;
			background: none !important;
			overflow-y: visible !important;
			&:before {
				content: "";
				margin: 0;
				padding: 0;
			}
			> a {
				.transition-duration(.2s);
				color: @linkColor;
				text-decoration: none;
				line-height: inherit;
				&:hover {
					color: @linkColorHover;
					text-decoration: none;
				}
			}
			> a:focus,
			&.active > a:focus {
				outline: none;
				border-color: rgb(234, 176, 63) rgb(234, 176, 63) transparent rgb(234, 176, 63);
				.box-shadow(0 -2px 2px rgba(234, 176, 63, 0.5));
			}
		}
	}
	> .tab-content {
		padding: 0;
		margin-bottom: 10px;
		> .tab-pane {
			padding: 12px 0;
			overflow-x: auto;
			overflow-y: hidden;
			& > :first-child {
				margin-top: 0;
			}
			& > :last-child {
				margin-bottom: 0;
			}
			.nn_tabs-title {
				display: none;
			}
		}
	}

	.nn_tabs-scroll,
	.nn_tabs-sm-scroll {
		position: relative;
		visibility: hidden;
	}

	&.nn_tabs-responsive {
		@media (max-width: 768px) {
			> ul.nav-tabs-sm {
				display: block;
			}
			> ul.nav-tabs {
				display: none;
			}
			> .tab-content {
				> .tab-pane {
					display: block;
					.nn_tabs-title {
						display: block;
					}
				}
			}
			.fade {
				opacity: 1;
			}
			// Outline Content
			&.outline_content {
				> .tab-content {
					border: none;
					> .tab-pane {
						padding: 12px 0;
					}
				}
			}
		}
	}

	// Outline Content
	&.outline_content {
		> .tab-content {
			margin-bottom: 18px;
			border: 1px solid @border-color;
			border-top: none;
			.border-radius(0 0 4px 4px);
			> .tab-pane {
				padding: 12px;
			}
		}

		> ul.nav-tabs {
			margin-bottom: 0;
		}
	}

	// Outline Tabs
	&.outline_handles {
		ul.nav-tabs > li {
			a,
			a:hover, {
				border: 1px solid @border-color;
			}
		}
		&.top > ul.nav-tabs > li {
			a,
			a:hover, {
				border-bottom-color: transparent;
			}
		}
		&.bottom > ul.nav-tabs > li {
			a,
			a:hover, {
				border-top-color: transparent;
			}
		}
		&.left > ul.nav-tabs > li {
			a,
			a:hover, {
				border-right-color: transparent;
			}
		}
		&.right > ul.nav-tabs > li {
			a,
			a:hover, {
				border-left-color: transparent;
			}
		}
	}

	@media (min-width: 769px) {
		// Right Alignment
		&.align_right {
			> ul.nav-tabs {
				> li {
					float: right;
					> a {
						margin-left: 2px;
						margin-right: 0;
					}
				}
			}
		}

		// Centered Alignment
		&.align_center {
			> ul.nav-tabs {
				text-align: center;
				> li {
					float: none;
					display: inline-block;
					.ie7-inline-block();
					margin-left: -1px;
					margin-right: -3px;
				}
			}
		}

		// Justified Alignment
		&.align_justify {
			> ul.nav-tabs {
				text-align: center;
				display: table;
				width: 100%;
				margin-bottom: -1px;
				> .nn_tabs-scroll {
					display: table-cell;
				}
				> li {
					float: none;
					display: table-cell;
					&:last-child > a {
						margin-right: 0;
					}
					a,
					a:hover {
						margin-bottom: -1px;
						border-bottom: 1px solid transparent;
					}
				}
				&:before {
					display: none;
				}
				&:after {
					display: none;
				}
			}
			&.bottom {
				> ul.nav-tabs {
					margin-bottom: 0;
					margin-top: -1px;
					> li {
						a,
						a:hover {
							margin-bottom: 0;
							margin-top: -1px;
							border-bottom: 1px solid @border-color;
							border-top: 1px solid transparent;
						}
					}
				}

			}
		}
	}

	.tabColors() {
		// Style: blue
		.tabColor(~'blue', @btnPrimaryBackground);
		.tabColor(~'primary', @btnPrimaryBackground);

		// Style: info
		.tabColor(~'info', @btnInfoBackgroundHighlight);

		// Style: green / success
		.tabColor(~'green', @btnSuccessBackgroundHighlight);
		.tabColor(~'success', @btnSuccessBackgroundHighlight);

		// Style: orange / warning
		.tabColor(~'orange', @btnWarningBackgroundHighlight);
		.tabColor(~'warning', @btnWarningBackgroundHighlight);

		// Style: red / danger
		.tabColor(~'red', @btnDangerBackgroundHighlight);
		.tabColor(~'danger', @btnDangerBackgroundHighlight);
		.tabColor(~'error', @btnDangerBackgroundHighlight);

		// Style: grey / gray
		.tabColor(~'grey', #808080);
		.tabColor(~'gray', #808080);
	}

	// Classes: Normal state + Hover state
	&.top {
		.tabColor(@name, @color) {
			> li.@{name} {
				> a,
				> a:hover {
					border-top: 5px solid lighten(@color, 20%);
					padding-top: 4px;
					.border-radius(5px 5px 0 0);
				}
				> a:hover, // Hover state
				&.active > a {
					// Active state
					border-top-color: @color;
				}
			}
			@media (max-width: 768px) {
				> li.@{name} {
					> a,
					> a:hover {
						border: 1px solid lighten(@color, 20%);
						border-bottom-color: transparent;
					}
				}
			}
		}

		> ul.nav-tabs {
			// Small screen styling
			@media (max-width: 768px) {
				> li {
					float: none;
					&:last-child,
					&.active:last-child {
						> a,
						> a:hover {
							.border-radius(4px 4px 0 0);
							border-bottom: 1px solid @border-color;
						}
					}
					> a {
						margin-right: 0;
					}
				}
			}

			.tabColors();
		}
	}

	&.bottom {
		.tabColor(@name, @color) {
			> li.@{name} {
				> a,
				> a:hover {
					border-bottom: 5px solid lighten(@color, 20%);
					padding-bottom: 4px;
					.border-radius(0 0 5px 5px);
				}
				> a:hover, // Hover state
				&.active > a {
					// Active state
					border-bottom-color: @color;
				}
			}
			@media (max-width: 768px) {
				> li.@{name} {
					> a,
					> a:hover {
						border: 1px solid lighten(@color, 20%);
						border-top-color: transparent;
					}
				}
			}
		}

		> .nav-tabs {
			border-bottom: 0;
			margin-bottom: 18px !important;
			border-top: 1px solid @border-color;
			> li {
				margin-top: -1px !important;
				margin-bottom: 0 !important;
				// Actual tabs (as links)
				> a {
					.border-radius(0 0 4px 4px);
					&:hover {
						border-color: transparent @border-color @border-color @border-color;
					}
				}
				// Active state, and it's :hover to override normal :hover
				&.active > a,
				&.active > a:hover {
					border-color: transparent @border-color @border-color @border-color;
				}
			}

			.tabColors();
		}

		&.outline_content {
			> .tab-content {
				margin: 0;
				border: 1px solid @border-color;
				border-bottom: none;
				.border-radius(4px 4px 0 0);
			}
		}
	}

	&.left,
	&.right {
		> .nav-tabs {
			border-bottom: 0;
			margin-bottom: 18px !important;
			> li {
				float: none;
				> a {
					min-width: 74px;
					margin-right: 0;
					margin-bottom: 3px;
				}
			}
		}

		&.outline_content {
			> .tab-content {
				border: 1px solid @border-color;
			}
		}
	}

	&.left {
		.tabColor(@name, @color) {
			> li.@{name} {
				> a,
				> a:hover {
					border-left: 5px solid lighten(@color, 20%);
					padding-left: 7px;
					.border-radius(5px 0 0 5px);
				}
				> a:hover, // Hover state
				&.active > a {
					// Active state
					border-left-color: @color;
				}
			}
			@media (max-width: 768px) {
				> li.@{name} {
					> a,
					> a:hover {
						border: 1px solid lighten(@color, 20%);
						border-right-color: transparent;
					}
				}
			}
		}

		> .nav-tabs {
			float: left;
			margin-right: 19px;
			border-right: 1px solid @border-color;
			> li {
				margin-right: -1px !important;
				margin-bottom: 0 !important;
				> a {
					.border-radius(4px 0 0 4px);
					&:hover {
						border-color: @border-color transparent @border-color @border-color;
					}
				}
				// Active state, and it's :hover to override normal :hover
				&.active > a,
				&.active > a:hover {
					border-color: @border-color transparent @border-color @border-color;
				}
			}

			.tabColors();
		}

		&.outline_content {
			> .tab-content {
				.border-radius(0 4px 4px 4px);
			}
		}
	}

	&.right {
		.tabColor(@name, @color) {
			> li.@{name} {
				> a,
				> a:hover {
					border-right: 5px solid lighten(@color, 20%);
					padding-right: 7px;
					.border-radius(0 5px 5px 0);
				}
				> a:hover, // Hover state
				&.active > a {
					// Active state
					border-right-color: @color;
				}
			}
			@media (max-width: 768px) {
				> li.@{name} {
					> a,
					> a:hover {
						border: 1px solid lighten(@color, 20%);
						border-left-color: transparent;
					}
				}
			}
		}

		> .nav-tabs {
			float: right;
			margin-left: 19px;
			border-left: 1px solid @border-color;
			> li {
				margin-left: -1px !important;
				margin-bottom: 0 !important;
				> a {
					.border-radius(0 4px 4px 0);
					&:hover {
						border-color: @border-color @border-color @border-color transparent;
					}
				}
				&.active > a,
				&.active > a:hover {
					border-color: @border-color @border-color @border-color transparent;
				}
			}

			.tabColors();
		}

		&.outline_content {
			> .tab-content {
				.border-radius(4px 0 4px 4px);
			}
		}
	}
}
