//
// Tabs control
// - The control supports 3 basic CSS classes: master, primary and secondary.
// --------------------------------------------------

.control-tabs {
    position: relative;

    margin-bottom: 20px;

    &:last-child {
        margin-bottom: 0;
    }

    .horizontal-scroll-indicators(@color-scroll-indicator);

    &.scroll-active-before:before {color: @color-tab-active-border;}
    &.scroll-active-after:after {color: @color-tab-active-border;}

    &:before, &:after {
        top: 5px;
        margin-top: 0;
    }

    > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
        white-space: nowrap;
        font-size: 0;
        overflow: hidden;
        border-bottom: none;
        > li {
            font-size: 15px;
            float: none;
            display: inline-block;
            margin-right: 20px;
            position: relative;

            &:last-child {
                margin-right: 0;
            }

            a {
                border-left: none!important;
                border-top: none!important;
                border-right: none!important;
                padding: 0 0 10px 0;
                color: @color-tab-inactive-text;
                background: @color-body-bg;
                font-weight: 400;

                overflow: hidden;

                &:hover {
                    background-color: transparent;
                    border-bottom-color: transparent;
                }

                &:before {
                    font-size: 14px;
                }

                > span.title > span {
                    max-width: 150px;
                    height: 16px;
                    margin-bottom: -4px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: inline-block;
                }
            }

            span.tab-close {
                display: none;
            }

            &.active {
                a {
                    color: @color-tab-active-text;
                }

                &:after {
                    width: 100%;
                    height: 3px;
                    bottom: 0;
                    background: @color-tab-active-border;
                }

            }
        }
    }

    > div.tab-content {
        > div.tab-pane {
            padding: 20px 0 0 0;
            .clearfix();
            display: none;

            &.active {
                display: block;

                &.layout-cell {
                   display: table-cell;
                }
            }

            &.pane-compact {
                padding: 0;
            }
            &.pane-padded {
                padding: 20px 20px 0 20px;
            }
        }
    }

    &[data-closable] {
        > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
            > li {
                margin-right: 5px;

                a {
                    padding-left: 20px !important;
                    padding-right: 0 !important;
                }

                span.tab-close {
                    display: block;
                    position: absolute;
                    width: 20px;
                    height: 20px;
                    top: 5px;
                    left: -5px;
                    text-align: right;
                    font-size: 12px;
                    color: @color-tab-inactive-text !important;
                    cursor: pointer;
                    i {
                        display: inline-block;
                        z-index: 101;
                        top: -7px;
                        right: 5px;
                        position: relative;
                    }
                    &:hover i {
                        color: @brand-danger;
                    }
                }

                &.active span.close {
                    color: @color-tab-inactive-text;
                }

                &[data-modified] {
                    span.tab-close i {
                        top: -4px;

                        &:before {
                            content: @circle;
                            font-size: 9px;
                        }
                    }
                }
            }
        }
    }

    &.master {
        > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
            > li {
                a {
                    font-size: 15px;
                    border-bottom: transparent 4px solid;
                    position: relative;
                    z-index: 101;
                    line-height: 100%;
                }

                &.active {
                    a { border-bottom: @color-tab-active-border 4px solid; }
                }
            }
        }
    }

    &.primary {
        margin-bottom: 5px;

        > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
            position: relative;
            margin-left: -20px;
            margin-right: -20px;

            &:before {
                position: absolute;
                top: 26px;
                height: 1px;
                width: 100%;
                content: ' ';
                border-bottom: 1px solid @color-ui-border;
            }

            > li {
                padding-right: 10px;
                padding-left: 11px;
                margin-right: 0;
                margin-left: -30px;
                background: transparent;

                &:first-child {
                    margin-left: 0;
                    padding-left: 15px!important;
                }
                
                a {
                    font-size: 12px;
                    padding-bottom: 3px;
                    padding: 0 16px;
                    margin: 0;
                    position: relative;
                    z-index: 101;
                    background: transparent;
                    overflow: visible;

                    > span.title {
                        position: relative;
                        display: inline-block;
                        padding: 5px 5px 9px 5px;
                        .box-sizing(border-box);
                        border-top: 1px solid #f0f0f0;
                        z-index: 100;

                        &:before, &:after {
                            content: ' ';
                            position: absolute;
                            background: transparent url(../images/primary-tab-shape.png?v2) no-repeat left -31px;
                            width: 16px;
                            height: 26px;
                            display: block;
                            top: -1px;
                            z-index: 100;
                        }

                        &:before {
                            left: -16px;
                        }

                        &:after {
                            right: -16px;
                            background-position: -61px -31px;
                        }
                    }
                }

                &:last-child {
                    background-image: none;
                    margin-right: 0;
                    padding-right: 5px;
                }

                &:first-child {
                    padding-left: 0;
                }

                &.active a:before {
                    position: absolute;
                    top: 26px;
                    height: 1px;
                    right: 2px;
                    left: 0;
                    content: ' ';
                    background-color: @color-body-bg;
                }

                &.active a {
                    z-index: 107;

                    > span.title {
                        z-index: 105;
                        border-top-color: #d6d6d6;

                        &:before {
                            background-position: left 0;
                            z-index: 107;
                        }

                        &:after {
                            background-position: -61px 0;
                            z-index: 107;
                        }
                    }
                }
            }
        }

        > div.tab-content {
        }

        // Tabs to sit in by the standard offset (0px)
        &.tabs-offset {
            > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
                margin-left: 0;
                margin-right: 0;
            }
        }
    }

    &.secondary {
        > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
            > li {
                padding-right: 10px;
                margin-right: 10px;
                border-right: 1px solid @color-ui-border;

                a {
                    font-size: 12px;
                    font-weight: 600;
                    padding-bottom: 0;
                }

                &:last-child {
                    border-right: none;
                    margin-right: 0;
                    padding-right: 0;
                }
            }
        }
    }

    &.content-tabs {

        > ul.nav-tabs {
            position: relative;

            &:before {
                content: ' ';
                position: absolute;
                bottom: 0;
                left: 0;
                width: 100%;
                height: 1px;
                background: @color-tab-content-border;
            }

            li {
                margin-right: 0;
                border-top: 1px solid @color-tab-content-border;
                border-right: 1px solid @color-tab-content-border;

                a {
                    font-size: 12px;
                    padding: 17px 20px;
                    margin: 0;
                    border: none;
                    text-transform: uppercase;
                    background: transparent;
                }

                &:first-child {
                    border-left: 1px solid @color-tab-content-border;
                }

                &:last-child {
                    border-right: 1px solid @color-tab-content-border;
                }

                &.active {
                    background: @color-tab-content-active-bg;
                    a {
                        font-weight: 600;
                    }
                }
            }
        }

        > .tab-content > .tab-pane {
            padding-top: 0;

            div.list-header,
            div.padded-container,
            div.toolbar-widget {
                background: @color-tab-content-active-bg;
                padding-top: 20px;
            }
        }

        // Tabs to sit in by the standard offset (20px)
        &.tabs-offset {
            > ul.nav-tabs {
                li:first-child {
                    margin-left: 20px;
                }
            }
        }

        // Tabs to sit flush to the element above
        &.tabs-flush {
            > ul.nav-tabs {
                li {
                    border-top: none;
                }
                li:last-child {
                    border-right: 1px solid transparent;
                }
                li:first-child {
                    border-left: 1px solid transparent;
                }
                li.active:last-child {
                    border-right: 1px solid @color-tab-content-border;
                }
            }
        }
    }
}

&.hide-tabs {
    .control-tabs {
        ul.nav-tabs {
            display: none;
        }

        > div.tab-content > div.tab-pane {
            padding-top: 0;
        }
    }
}

.form-sidebar {
    .control-tabs.secondary {
        > div > ul.nav-tabs > li a {
            background: transparent;
        }
    }
}
