/* -------------------------------------------
	Tab
	1. Tab Base Style
	2. Tab Type
		- Tab Default
		- Tab Underline
		- Tab Solid
		- Tab Border
	3. Compatibility with Elementor
---------------------------------------------- */

$dir: left;
@import '../../assets/sass/mixins/direction';

// 1. Tab Base Style
.nav-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	list-style: none;
	margin: 0;

	.nav-link {
		font-weight: var(--alpha-heading-font-weight);
		svg {
			transition: fill .3s;
		}
	}
	.nav-link.active,
	.nav-link:hover {
		color: var(--alpha-tab-active-color, var(--alpha-primary-color));
		background: var(--alpha-tab-active-background);
		svg {
			fill: var(--alpha-tab-active-color, var(--alpha-primary-color));
		}
	}
}
.nav-filters {
	display: flex;
    align-items: center;
	margin: 0;
	margin-bottom: 2rem;
	padding: 0;
    flex-wrap: wrap;
    font-weight: 600;
	list-style: none;
	text-transform: capitalize;
	
	li:not(:last-child) {
		margin-#{$right}: 1.5rem;
	}
	
	span {
		margin-#{$left}: 10px;
		color: #aaa;
	}
	.nav-filter.active,
	.nav-filter:hover {
		color: var(--alpha-tab-active-color, var(--alpha-primary-color));
		background: var(--alpha-tab-active-background);
	}
}	
.filter-underline {
    .nav-filter {
		display: inline-block;
		position: relative;
		padding: 0.5rem 0;
		line-height: 1;
        transition: color 0.3s,background 0.3s,border 0.3s;
        &.active, &:hover {
			color: var(--alpha-change-color-dark-1);
            &::after {
                background-color: var(--alpha-primary-color);
                transform: scaleX(1);
            }
        }
        &::after {
            content: '';
            display: block;
            height: 2px;
            border-bottom: 3px solid;
            margin-top: 2px;
            transform: scaleX(0);
            transition: transform .4s;
        }
    }
}
.tab {
	--alpha-tab-item-spacing: 3rem;
	--alpha-tab-title-padding: 0.85em 2px;
	--alpha-tab-content-padding: 2rem;
	--alpha-tab-background: transparent;
	--alpha-tab-border-width: 1px;
	--alpha-tab-nav-border-width: 2px;
	--alpha-tab-title-radius: 0;
	--alpha-tab-border-color: var(--alpha-change-border-color);

	.nav-link {
		--alpha-tab-icon-space: 10px;

		position: relative;
		display: block;
		padding: var(--alpha-tab-title-padding);
		border-radius: var(--alpha-tab-title-radius);
		text-align: center;
		height: 100%;
		transition: color .3s, border .3s, background .3s;
	}
	.nav-item {
		background: var(--alpha-tab-background);
		margin-#{$right}: var(--alpha-tab-item-spacing);
		border-radius: var(--alpha-tab-title-radius);
		height: 100%;
		white-space: nowrap;
		&:last-child {
			margin-#{$right}: 0;
		}
	}
	.nav-icon-up i,
	.nav-icon-up svg,
	.nav-icon-down i,
	.nav-icon-down svg {
		display: block;
	}
	.nav-icon-left > .nav-link,
	.nav-icon-right > .nav-link,
	.nav-icon-down.nav-item,
	.nav-icon-up.nav-item {
		display: flex;
		align-items: center;
	}
	.nav-icon-down > .nav-link,
	.nav-icon-up > .nav-link {
		width: 100%;
	}
	.nav-icon-up i, .nav-icon-up svg {
		margin-bottom: var(--alpha-tab-icon-space);
	}
	.nav-icon-right i, .nav-icon-right svg {
		margin-#{$left}: var(--alpha-tab-icon-space);
	}
	.nav-icon-down i, .nav-icon-down svg {
		margin-top: var(--alpha-tab-icon-space);
	}
	.nav-icon-left i, .nav-icon-left svg {
		margin-#{$right}: var(--alpha-tab-icon-space);
	}

	@media (max-width: 575px) {
		--alpha-tab-item-spacing: 0;

		.nav-item {
			flex: 1;
		}
	}
}
.tab.tab-nav-fill {
	--alpha-tab-item-spacing: 1px;

	.nav-item {
		flex: 1;
	}
}
.tab-content {
	position: relative;
	overflow: hidden;

	> .tab-pane {
		position: absolute;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		height: 0;
		opacity: 0;
		visibility: hidden;
		z-index: -1;
		padding: var(--alpha-tab-content-padding);
	}
	> .active {
		position: relative;
		visibility: visible;
		height: auto;
		opacity: 1;
		z-index: auto;
		transition: visibility .3s, opacity .3s;
	}
}

/* Tab Vertical */
.tab-vertical {
	--alpha-tab-item-spacing: 1px;
	--alpha-tab-content-padding: 1rem 2rem;
	--alpha-tab-nav-width: 20%;

	display: flex;

	.nav-tabs {
		align-items: normal;
		flex-flow: column nowrap;
		width: var(--alpha-tab-nav-width);
	}
	.nav-item:not(:last-child) {
		margin-#{$right}: 0;
		margin-bottom: var(--alpha-tab-item-spacing);
	}
	.nav-link {
		text-align: $left;
	}
	.tab-content {
		flex: 1;
		width: calc(100% - var(--alpha-tab-nav-width));
	}
	.tab-pane {
		min-height: 100%;
	}

	@media (max-width: 575px) {
		.nav-tabs {
			width: 100%;
		}
	}
}

// 2. Tab Type

//Tab Default
.tab-default.tab-vertical {
	--alpha-tab-content-padding: 1rem 2rem;
}

// Tab Underline
.tab-underline {
	.nav-tabs {
		border-bottom: var(--alpha-tab-border-width) solid var(--alpha-tab-border-color);
	}
	.nav-link {
		margin-bottom: calc(-1 * var(--alpha-tab-border-width));

		&:after {
			content: '';
			position: absolute;
			left: 50%;
			bottom: 0;
			width: 100%;
			height: var(--alpha-tab-nav-border-width);
			background: var(--alpha-tab-active-color, var(--alpha-primary-color));
			transform: scaleX(0) translateX(-50%);
			transform-origin: #{$left};
			transition: transform .3s;
		}

		&:hover:after,
		&.active:after {
			transform: scaleX(1) translateX(-50%);
		}
	}
	&.tab-vertical {
		.nav-tabs {
			border-#{$right}: var(--alpha-tab-border-width) solid var(--alpha-tab-border-color);
			border-bottom: none;
		}
		.nav-link {
			margin-bottom: 0;
			margin-#{$right}: calc(-1 * var(--alpha-tab-border-width));

			&:after {
				left: auto;
				bottom: auto;
				top: 50%;
				right: 0;
				height: 100%;
				width: var(--alpha-tab-nav-border-width);
				transform: scaleY(0) translateY(-50%);
				transform-origin: top;
			}
			&:hover:after,
			&.active:after {
				transform: scaleY(1) translateY(-50%);
			}
		}
	}
}


// Tab Solid
.tab-solid {
	--alpha-tab-title-padding: 0.5em 1.2em;
	--alpha-tab-item-spacing: 1rem;

	.nav-link {
		border: var(--alpha-tab-nav-border-width) solid var(--alpha-tab-border-color);
	}
	.nav-item.active > a,
	.nav-link.active,
	.nav-link:hover {
		background: var(--alpha-tab-active-background, var(--alpha-primary-color));
		border-color: var(--alpha-tab-active-background, var(--alpha-primary-color));
		color: var(--alpha-tab-active-color, var(--alpha-change-color-light-1));
		svg {
			fill: var(--alpha-tab-active-color, var(--alpha-change-color-light-1));
		}
	}
	&.tab-vertical {
		--alpha-tab-item-spacing: 1px;
	}
}

// Tab Border
.tab-border {
	--alpha-tab-title-padding: 0.5em 1.2em;
	--alpha-tab-item-spacing: -1px;

	.nav-link {
		border-style: solid;
		border-color: transparent;
		border-width: var(--alpha-tab-nav-border-width) var(--alpha-tab-border-width) var(--alpha-tab-border-width);
		margin-bottom: calc(-1 * var(--alpha-tab-border-width));
		z-index: 1;

		&:hover,
		&.active {
			border-color: var(--alpha-tab-active-color, var(--alpha-primary-color)) var(--alpha-tab-border-color) var(--alpha-tab-active-background, var(--alpha-white-color)) var(--alpha-tab-border-color);
		}
	}
	.tab-content {
		border: var(--alpha-tab-border-width) solid var(--alpha-tab-border-color);
	}
	&.tab-vertical {
		--alpha-tab-content-padding: 1rem 2rem;

		.nav-link {
			border-width: var(--alpha-tab-border-width) var(--alpha-tab-border-width) var(--alpha-tab-border-width) var(--alpha-tab-nav-border-width);
			margin-#{$right}: calc(-1 * var(--alpha-tab-border-width));
			margin-bottom: 0;
			z-index: 1;
		}
		.nav-link:hover,
		.nav-link.active {
			border-color: var(--alpha-tab-border-color) var(--alpha-tab-background) var(--alpha-tab-border-color) var(--alpha-tab-active-color, var(--alpha-primary-color));
		}
	}
}

// 3. Compatibility with Elementor
.elementor-section > .elementor-container.tab {
	margin-left: 0;
	margin-right: 0;
	width: 100%;
}
.elementor-section-boxed.elementor-section > .elementor-container.tab {
	max-width: calc( var(--alpha-container-width) - 40px );
}
.elementor-container.tab {
	flex-direction: column;

	&.tab-vertical {
		flex-direction: row;
	}
	.tab-pane {
		width: 100%;
	}
}
.tab-pane.elementor-column {
	width: 100%;
}
.elementor-invisible .tab-content > .active {
	visibility: hidden;
}