/* stylelint-disable max-nesting-depth */

@import "mixins/mixins";
@import "common/var";

.el-tabs__header {
    padding: 0;
    position: relative;
    margin: 0 0 15px;
}

.el-tabs__active-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: $--color-primary;
    z-index: 1;
    transition: transform .3s cubic-bezier(.645, .045, .355, 1);
    list-style: none;
}

.el-tabs__new-tab {
    float: right;
    border: 1px solid #d3dce6;
    height: 18px;
    width: 18px;
    line-height: 18px;
    margin: 12px 0 9px 10px;
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
    color: #d3dce6;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    outline: none;

    &:hover {
        color: $--color-primary;
    }
}

.el-tabs__nav-wrap {
    overflow: hidden;
    margin-bottom: -1px;
    position: relative;

    &::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 2px;
        background-color: $--border-color-light;
        z-index: $--index-normal;
    }

    &.is-scrollable {
        padding: 0 20px;
        box-sizing: border-box;
    }
}

.el-tabs__nav-scroll {
    overflow: hidden;
}

.el-tabs__nav-next, .el-tabs__nav-prev {
    position: absolute;
    cursor: pointer;
    line-height: 44px;
    font-size: 12px;
    color: $--color-text-secondary;
}
.el-tabs__nav-next {
    right: 0;
}
.el-tabs__nav-prev {
    left: 0;
}

.el-tabs__nav {
    white-space: nowrap;
    position: relative;
    transition: transform .3s;
    float: left;
    z-index: #{$--index-normal + 1};

    &.is-stretch {
        min-width: 100%;
        display: flex;
        & > * {
            flex: 1;
            text-align: center;
        }
    }
}

.el-tabs__item {
    padding: 0 20px;
    height: 40px;
    box-sizing: border-box;
    line-height: 40px;
    display: inline-block;
    list-style: none;
    font-size: 1.125rem;
    font-weight: 500;
    color: $--color-text-primary;
    position: relative;
    text-decoration: none;

    &:focus, &:focus:active {
        outline: none;
    }
    &:not(.is-active):focus {
        color: inherit;
    }

    &:focus.is-active.is-focus:not(:active) {
        box-shadow: 0 0 2px 2px #409eff inset;
        border-radius: 3px;
    }

    & .fa-times {
        border-radius: 50%;
        text-align: center;
        transition: all .3s cubic-bezier(.645, .045, .355, 1);
        margin-left: 5px;
        &:before {
            transform: scale(.9);
            display: inline-block;
        }

        &:hover {
            background-color: $--color-text-placeholder;
            color: $--color-white;
        }
    }

    &.is-active {
        color: $--color-primary;
    }

    &:hover {
        color: $--color-primary;
        cursor: pointer;
        text-decoration: none;
    }

    &.is-disabled {
        color: $--disabled-color-base;
        cursor: default;
    }
}

.el-tabs__content {
    overflow: visible;
    position: relative;
}

.el-tabs--card {
    > .el-tabs__header {
        border-bottom: 1px solid $--border-color-light;
    }
    > .el-tabs__header .el-tabs__nav-wrap::after {
        content: none;
    }
    > .el-tabs__header .el-tabs__nav {
        border: 1px solid $--border-color-light;
        border-bottom: none;
        border-radius: 4px 4px 0 0;
        box-sizing: border-box;
    }
    > .el-tabs__header .el-tabs__active-bar {
        display: none;
    }
    > .el-tabs__header .el-tabs__item .fa-times {
        position: relative;
        font-size: 12px;
        width: 0;
        height: 14px;
        vertical-align: middle;
        line-height: 15px;
        overflow: hidden;
        top: -1px;
        right: -2px;
        transform-origin: 100% 50%;
    }
    > .el-tabs__header .el-tabs__item {
        border-bottom: 1px solid transparent;
        border-left: 1px solid $--border-color-light;
        transition: color .3s cubic-bezier(.645, .045, .355, 1), padding .3s cubic-bezier(.645, .045, .355, 1);
        &:first-child {
            border-left: none;
        }
        &.is-closable {
            &:hover {
                padding-left: 13px;
                padding-right: 13px;

                & .fa-times {
                    width: 14px;
                }
            }
        }
        &.is-active {
            border-bottom-color: $--color-white;

            &.is-closable {
                padding-left: 20px;
                padding-right: 20px;

                .fa-times {
                    width: 14px;
                }
            }
        }
    }
}

.el-tabs--top, .el-tabs--bottom {
    .el-tabs__item.is-top:nth-child(2),
    .el-tabs__item.is-bottom:nth-child(2) {
        padding-left: 0;
    }
    .el-tabs__item.is-top:last-child,
    .el-tabs__item.is-bottom:last-child {
        padding-right: 0;
    }

    &.el-tabs--card, .el-tabs--left, .el-tabs--right {
        .el-tabs__item:nth-child(2) {
            padding-left: 20px;
        }
        .el-tabs__item:last-child {
            padding-right: 20px;
        }
    }
}

.el-tabs--bottom {
    .el-tabs__header.is-bottom {
        margin-bottom: 0;
        margin-top: 10px;
    }
}

.el-tabs--left, .el-tabs--right {
    overflow: hidden;

    .el-tabs__header.is-left,
    .el-tabs__header.is-right,
    .el-tabs__nav-wrap.is-left,
    .el-tabs__nav-wrap.is-right,
    .el-tabs__nav-scroll {
        height: 100%;
    }

    .el-tabs__active-bar.is-left,
    .el-tabs__active-bar.is-right {
        top: 0;
        bottom: auto;
        width: 2px;
        height: auto;
    }

    .el-tabs__nav-wrap.is-left,
    .el-tabs__nav-wrap.is-right {
        margin-bottom: 0;

        > .el-tabs__nav-prev,
        > .el-tabs__nav-next {
            height: 30px;
            line-height: 30px;
            width: 100%;
            text-align: center;
            cursor: pointer;

            i {
                transform: rotateZ(90deg);
            }
        }
        > .el-tabs__nav-prev {
            left: auto;
            top: 0;
        }
        > .el-tabs__nav-next {
            right: auto;
            bottom: 0;
        }

        &.is-scrollable {
            padding: 30px 0;
        }

        &::after {
            height: 100%;
            width: 2px;
            bottom: auto;
            top: 0;
        }
    }

    .el-tabs__nav.is-left,
    .el-tabs__nav.is-right {
        float: none;
    }
    .el-tabs__item.is-left,
    .el-tabs__item.is-right {
        display: block;
    }
}

.el-tabs--left {
    .el-tabs__header.is-left {
        float: left;
        margin-bottom: 0;
        margin-right: 10px;
    }
    .el-tabs__nav-wrap.is-left {
        margin-right: -1px;
        &::after {
            left: auto;
            right: 0;
        }
    }
    .el-tabs__active-bar.is-left {
        right: 0;
        left: auto;
    }
    .el-tabs__item.is-left {
        text-align: right;
    }

    &.el-tabs--card {
        .el-tabs__active-bar.is-left {
            display: none;
        }
        .el-tabs__item.is-left {
            border-left: none;
            border-right: 1px solid $--border-color-light;
            border-bottom: none;
            border-top: 1px solid $--border-color-light;
        }
        .el-tabs__item.is-left:first-child {
            border-right: 1px solid $--border-color-light;
            border-top: none;
        }
        .el-tabs__item.is-left.is-active {
            border: 1px solid $--border-color-light;
            border-right-color: #fff;
            border-left: none;
            border-bottom: none;

            &:first-child {
                border-top: none;
            }
            &:last-child {
                border-bottom: none;
            }
        }

        .el-tabs__nav {
            border-radius: 4px 0 0 4px;
            border-bottom: 1px solid $--border-color-light;
            border-right: none;
        }

        .el-tabs__new-tab {
            float: none;
        }
    }
}

.el-tabs--right {
    .el-tabs__header.is-right {
        float: right;
        margin-bottom: 0;
        margin-left: 10px;
    }

    .el-tabs__nav-wrap.is-right {
        margin-left: -1px;
        &::after {
            left: 0;
            right: auto;
        }
    }

    .el-tabs__active-bar.is-right {
        left: 0;
    }

    &.el-tabs--card {
        .el-tabs__active-bar.is-right {
            display: none;
        }
        .el-tabs__item.is-right {
            border-bottom: none;
            border-top: 1px solid $--border-color-light;
        }
        .el-tabs__item.is-right:first-child {
            border-left: 1px solid $--border-color-light;
            border-top: none;
        }
        .el-tabs__item.is-right.is-active {
            border: 1px solid $--border-color-light;
            border-left-color: #fff;
            border-right: none;
            border-bottom: none;

            &:first-child {
                border-top: none;
            }
            &:last-child {
                border-bottom: none;
            }
        }

        .el-tabs__nav {
            border-radius: 0 4px 4px 0;
            border-bottom: 1px solid $--border-color-light;
            border-left: none;
        }
    }
}

/* vue transition classes and keyframe animations */

.slideInRight-transition,
.slideInLeft-transition {
    display: inline-block;
}
.slideInRight-enter {
    animation: slideInRight-enter .3s;
}
.slideInRight-leave {
    position: absolute;
    left: 0;
    right: 0;
    animation: slideInRight-leave .3s;
}
.slideInLeft-enter {
    animation: slideInLeft-enter .3s;
}
.slideInLeft-leave {
    position: absolute;
    left: 0;
    right: 0;
    animation: slideInLeft-leave .3s;
}

@keyframes slideInRight-enter {
    0% {
        opacity: 0;
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(100%);
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}
@keyframes slideInRight-leave {
    0% {
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(0);
        transform: translateX(0);
        opacity: 1;
    }

    100% {
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(100%);
        transform: translateX(100%);
        opacity: 0;
    }
}
@keyframes slideInLeft-enter {
    0% {
        opacity: 0;
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
    }

    to {
        opacity: 1;
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}
@keyframes slideInLeft-leave {
    0% {
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(0);
        transform: translateX(0);
        opacity: 1;
    }

    100% {
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
        opacity: 0;
    }
}
