//
// Dependencies
// --------------------------------------------------

@import "global.less";
@import "icon.less";

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

@import "tab.base.less";

@color-scroll-indicator:                     #bbbbbb;

@color-tab-border:                           #d7d7d7;
@color-tab-inactive-text:                    #cccccc;
@color-tab-active-text:                      @color-text-title;
@color-tab-active-border:                    #5fb6f5;
@color-tab-bg:                               #ffffff;
@color-tab-active-marker:                    #ec8017;
@color-tab-content-active-bg:                #ffffff;
@color-tab-content-border:                   #e3e5e7;

@nav-link-padding:                          10px 15px;
@nav-link-hover-bg:                         @gray-lighter;

@nav-disabled-link-color:                   @gray-light;
@nav-disabled-link-hover-color:             @gray-light;

@nav-open-link-hover-color:                 #fff;

@nav-tabs-border-color:                     #ddd;

@nav-tabs-link-hover-border-color:          @gray-lighter;

@nav-tabs-active-link-hover-bg:             @body-bg;
@nav-tabs-active-link-hover-color:          @gray;
@nav-tabs-active-link-hover-border-color:   #ddd;

@nav-tabs-justified-link-border-color:            #ddd;
@nav-tabs-justified-active-link-border-color:     @body-bg;

@nav-pills-border-radius:                   @border-radius-base;
@nav-pills-active-link-hover-bg:            @component-active-bg;
@nav-pills-active-link-hover-color:         @component-active-color;

@tab-image-path: @image-path;

.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: @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 tabs
    //

    &.master, // Deprecated
    &.master-tabs {
        > 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 tabs
    //

    &.primary, // Deprecated
    &.primary-tabs {
        margin-bottom: 5px;

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

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

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

                &:first-child {
                    padding-left: 15px !important;
                }

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

                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('@{tab-image-path}/primary-tab-shape.png') 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: @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 {
        }

        // Tab divider to sit inset the standard padding (20px)
        &.tabs-inset {
            > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
                margin-left: -20px;
                margin-right: -20px;
            }
        }
    }

    //
    // Secondary tabs
    //

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

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

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

    //
    // Content tabs
    //

    &.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 divider to sit inset the standard padding (20px)
        &.tabs-inset {
            > ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
                margin-left: -20px;
                margin-right: -20px;
                li:first-child {
                    margin-left: 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;
                }
            }
        }

        > .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;
            }

            // Pane to sit inset the standard padding (20px)
            &.pane-inset {
                margin-left: -20px;
                margin-right: -20px;
            }
        }

    }
}

&.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;
        }
    }
}
