@import '../../styles/variables';

/**************************************
 * Tabs
 **************************************/

.tab-view {
    margin-top: 6px;
}

.dynamic-tabs {
    .dynamic-tabs-bar {
        display: flex;
        flex: none;

        .left-arrow {
            flex: 0 0 8px;
            margin: 0 5px 0 -13px;
        }

        .right-arrow {
            flex: 0 0 8px;
            margin: 0 -13px 0 5px;
        }
    }

    .dynamic-tabs-wrapper {
        flex: 0 0 100%;
        overflow: hidden;
    }

    .tabs {
        position: relative;
        transition: left .2s;

        .tab,
        .tab:hover {
            flex: none;
            max-width: 90%;

            .tab-title {
                padding: 0 7px;
            }
        }
    }
}

.tabs {
    display: flex;

    .tab,
    .tab:hover {
        position: relative;
        display: inline-block;
        flex: 1;
        color: $bdl-gray-50;
        font-size: 13px;
        line-height: 40px;
        letter-spacing: .035em;
        border-bottom: 1px solid $bdl-gray-10;

        &.single-tab-showing {
            width: 100%;
            margin-bottom: 10px;
        }

        &.is-selected {
            color: $bdl-gray;

            .tab-underline {
                opacity: 1;
            }

            .tab-close {
                display: block;
            }
        }

        .tab-underline {
            position: absolute; /* relative to .tab */
            bottom: -1px; /* offset because border is outset  */
            width: 100%;
            height: 2px;
            background-color: $primary-color;
            opacity: 0;
            transition: opacity .3s cubic-bezier(.215, .61, .355, 1);
        }

        .tab-content {
            display: flex;
        }

        .tab-title {
            padding-right: 5px;
            overflow: hidden;
            white-space: nowrap;
            text-align: left;
            text-overflow: ellipsis;
        }

        .tab-close {
            display: none;
            flex: none;
            padding-right: 7px;
            font-weight: bold;
        }
    }

    .tab:focus {
        outline: 1px dotted $primary-color;
    }

    .tab:hover,
    .tab:focus {
        .tab-title {
            color: $bdl-gray;
        }
    }

    .tab-spacer {
        flex: 1 1 auto;
        border-bottom: 1px solid $bdl-gray-10;
    }

    .tab.btn-plain:not(.is-disabled) {
        &:active {
            background: transparent;
            border-bottom: 1px solid $bdl-gray-10;
        }

        &:focus {
            border-color: $bdl-gray-10;
            box-shadow: none;
        }

        &:hover {
            background: transparent;
        }
    }
}

.tab-panels {
    height: 100%;
    padding-top: 10px;

    .tab-panel {
        display: none;

        &.is-selected {
            display: block;
            height: 100%;
        }

        &:focus {
            outline: none;
        }
    }
}

.tab-view.show-outline .tab-panel:focus {
    outline: 1px dotted $primary-color;
}
