﻿@import '_a11y.scss';

$mat-tab-bar-height: 48px !default;
$mat-tab-animation-duration: 500ms !default;

$ease-in-out-curve-function: cubic-bezier(0.35, 0, 0.25, 1) !default;

@mixin _noop-animation() {
  
    @at-root ._mat-animation-noopable#{&} {
        transition: none;
        animation: none;
        @content;
    }
}

@mixin user-select($value) {
    -webkit-user-select: $value;
    -moz-user-select: $value;
    -ms-user-select: $value;
    user-select: $value;
}

// Mixin styles for labels that are contained within the tab header.
@mixin tab-label {
    height: $mat-tab-bar-height;
    padding: 0 24px;
    cursor: pointer;
    box-sizing: border-box;
    opacity: 0.6;
    min-width: 160px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;

    &:focus {
        outline: none;

        &:not(.mat-tab-disabled) {
            opacity: 1;
        }

        @include cdk-high-contrast(active, off) {
            $outline-width: 2px;
            outline: dotted $outline-width;
            outline-offset: -$outline-width; // Not supported on IE, but looks better everywhere else.
        }
    }

    &.mat-tab-disabled {
        cursor: default;
        color: #00000061;
    }

    .mat-tab-label-content {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        white-space: nowrap;
    }

    @include cdk-high-contrast(active, off) {
        opacity: 1;
    }
}

// The ink bar that displays under the active tab label
@mixin ink-bar {
    $height: 2px;

    @include _noop-animation();
    position: absolute;
    bottom: 0;
    height: $height;
    transition: $mat-tab-animation-duration $ease-in-out-curve-function;

    .mat-tab-group-inverted-header & {
        bottom: auto;
        top: 0;
    }

    @include cdk-high-contrast(active, off) {
        outline: solid $height;
        height: 0;
    }
}

// Structural styles for a tab header. Used by both `mat-tab-header` and `mat-tab-nav-bar`.
@mixin paginated-tab-header {
    .mat-tab-header {
        display: flex;
        overflow: hidden;
        position: relative;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(0,0,0,.12)
    }

    .mat-tab-header-pagination {
        @include user-select(none);
        position: relative;
        display: none;
        justify-content: center;
        align-items: center;
        min-width: 32px;
        cursor: pointer;
        z-index: 2;
        -webkit-tap-highlight-color: transparent;
        touch-action: none;
        border: none;
        background: none;
        padding: 0;
        padding-bottom: 2px;

        .mat-tab-header-pagination-controls-enabled & {
            display: flex;
        }
    }
    // The pagination control that is displayed on the left side of the tab header.
    .mat-tab-header-pagination-before, .mat-tab-header-rtl .mat-tab-header-pagination-after {
        padding-left: 4px;

        .mat-tab-header-pagination-chevron {
            transform: rotate(-135deg);
        }
    }
    // The pagination control that is displayed on the right side of the tab header.
    .mat-tab-header-rtl .mat-tab-header-pagination-before, .mat-tab-header-pagination-after {
        padding-right: 4px;

        .mat-tab-header-pagination-chevron {
            transform: rotate(45deg);
        }
    }

    .mat-tab-header-pagination-chevron {
        border-style: solid;
        border-width: 1px 1px 0 0;
        content: '';
        height: 8px;
        width: 8px;
    }

    .mat-tab-header-pagination-disabled {
        box-shadow: none;
        cursor: default;
    }

    .mat-tab-list {
        flex-grow: 1;
        position: relative;
        transition: transform 500ms cubic-bezier(0.35, 0, 0.25, 1);
    }
}

// Structural styles for the element that wraps the paginated header items.
@mixin paginated-tab-header-item-wrapper {
    display: flex;

    [mat-align-tabs='center'] & {
        justify-content: center;
    }

    [mat-align-tabs='end'] & {
        justify-content: flex-end;
    }
}

@mixin paginated-tab-header-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    z-index: 1;
}
