.table-wrapper {
    z-index: 1;

    .table-options {
        margin-bottom: 1rem;
        text-align: right;

        a {
            padding: 0.25rem 1rem;
            color: $white;
            background-color: $brand-primary;
            margin-right: 0.5rem;
            border-radius: $border-radius;
            cursor: pointer;

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

    table {
        width: 100%;
        border-spacing: 0;
        position: relative;
        font-family: $font-family-body;


        thead {
            color: $dark;

            tr {
                th {
                    text-align: left;

                    height: 40px;
                    border: none;
                    padding: 0 .5rem;
                    font-size: 1rem;
                    text-transform: capitalize;
                    font-weight: $font-weight-bold;
                    border-bottom: $table-border-width solid $line-color;

                    >div {
                        display: inline-flex;
                        align-items: center;
                        justify-content: flex-start;
                        letter-spacing: 1px;
                    }

                    .sort {
                        display: flex;
                        flex-direction: column;
                        align-content: flex-start;

                        i {
                            line-height: 8px;

                            opacity: 0.5;
                            cursor: pointer;

                            &:hover {
                                opacity: 0.8;
                            }

                            &.active {
                                opacity: 1;
                            }
                        }
                    }
                }

                &:first-child {
                    th {
                        &:first-child {
                            border-top-left-radius: $table-border-radius;
                        }

                        &:last-child {
                            border-top-right-radius: $table-border-radius;
                        }
                    }
                }

                &.linear-activity {
                    overflow: hidden;
                    width: 100%;
                    height: 1px;
                    background-color: $white;
                    margin: 1px auto;

                    .indeterminate {
                        position: relative;
                        width: 100%;
                        height: 100%;
                        padding: 1px;

                        &:before {
                            content: '';
                            position: absolute;
                            top: 0;
                            height: 100%;
                            background-color: $brand-secondary;
                            animation: indeterminate_first 1.5s infinite ease-out;
                        }
                    }
                }
            }

            &.thead-primary {
                background-color: $brand-primary;
                color: $white;

                tr {
                    th {
                        .sort {
                            i {
                                color: $white;
                            }
                        }
                    }
                }

            }

            &.thead-light {
                background-color: $light;
                color: $dark-grey;

                tr {
                    th {
                        .sort {
                            i {
                                color: $dark-grey;
                            }
                        }
                    }
                }

            }

            &.thead-dark {
                background-color: $dark;
                color: $light;

                tr {
                    th {
                        .sort {
                            i {
                                color: $light;
                            }
                        }
                    }
                }
            }
        }

        >div {
            position: relative;
        }

        tbody {
            .overlay {
                position: absolute;
                top: 42px;
                left: 0;
                bottom: 0;
                right: 0;
                width: 100%;
                height: calc(100% - 42px);
                background-color: black;
                opacity: 0.2;
                margin-top: 0;
            }

            tr {
                td {
                    background-color: $white;
                    padding: 0.25rem 0.5rem;
                    border: none;
                    border-bottom: $table-border-width solid $line-color;
                    vertical-align: middle;

                    @each $status,
                    $value in $table-status-colors {
                        &.#{$status} {
                            background-color: $value;
                        }
                    }

                    .row-expand-btn {
                        position: relative;
                        top:2px;
                        display: inline-flex;
                        align-items: center;
                        justify-content: center;
                        border: 1px solid $line-color;
                        border-radius: .25rem;
                        background-color: $light-grey;
                        height: 1.75rem;
                        width: 1.75rem;
                        cursor: pointer;

                        span {
                            transition: all 0.3s;

                            &.expanded {
                                transform: rotate(180deg);
                            }
                        }
                    }
                }

                &:last-child {
                    td {
                        &:first-child {
                            border-bottom-left-radius: $table-border-radius;
                        }

                        &:last-child {
                            border-bottom-right-radius: $table-border-radius;
                        }
                    }
                }
            }
        }

        .empty {
            padding: 0.5rem;

            p {
                margin-bottom: 0;
            }
        }

        &.table-medium {
            tbody {
                tr {
                    td {
                        padding: 0.5rem;
                    }
                }
            }
        }

        &.table-large {
            thead {
                tr {
                    th {
                        padding: 0 1rem;
                    }
                }
            }

            tbody {
                tr {
                    td {
                        padding: 1rem;
                    }
                }
            }
        }

        &.table-striped {
            tbody {
                tr:nth-child(2n+1) {
                    td {
                        background-color: $light;
                    }
                }
            }
        }

        &.table-hover {
            tbody {
                tr:hover {
                    td {
                        background-color: $light;
                    }
                }
            }
        }

        &.table-bordered {
            thead {
                tr {
                    th {
                        border-top: $table-border-width solid $line-color;

                        &:last-child {
                            border-right: $table-border-width solid $line-color;
                        }

                        &:first-child {
                            border-left: $table-border-width solid $line-color;
                        }
                    }

                }
            }

            tbody {
                tr {
                    td {
                        &:last-child {
                            border-right: $table-border-width solid $line-color;
                        }

                        &:first-child {
                            border-left: $table-border-width solid $line-color;
                        }
                    }
                }
            }
        }
    }

    .pagination {
        width: 100%;
        margin: 1rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;

        p {
            margin-bottom: 0;

        }

        ul {
            list-style: none;
            padding-left: 0;
            display: flex;

            li {
                cursor: pointer;
                text-align: center;
                margin-right: 0.25rem;
                width: 32px;
                height: 32px;
                background-color: $white;
                font-weight: $font-weight-bold;
                color: $brand-secondary;
                border: $table-border-width solid $line-color;
                border-radius: $border-radius;

                span {
                    line-height: 30px;
                }

                &.active {
                    color: $white;
                    background-color: $brand-primary;
                }

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

    .arrange {
        justify-content: center;
        align-items: center;
        display: flex;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;

        &__overlay {
            position: absolute;
            opacity: 0.4;
            background-color: $black;
            z-index: 1;
            margin: 0;
            padding: 0;
            width: inherit;
            height: inherit;
        }

        &__box {
            z-index: 2;
            width: 300px;
            background-color: $white;
            border-radius: $border-radius;

            &__title {
                background-color: $brand-primary;
                color: $white;
                padding: $default-content-padding;
                margin: 0;
                border-top-right-radius: $border-radius;
                border-top-left-radius: $border-radius;
            }

            &__body {
                padding: $default-content-padding;

                &__option {
                    display: flex;
                    width: 100%;
                    margin-bottom: 1rem;

                    &__name {
                        display: inline-block;
                        color: $body-text;
                        width: calc(100% - 25px);
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }

                    &__value {
                        width: 25px;
                        display: inline-block;
                        text-align: right;
                    }

                    .checkbox {
                        display: block;
                        position: relative;
                        cursor: pointer;
                        font-size: 22px;
                        user-select: none;
                    }

                    .checkbox input {
                        position: absolute;
                        opacity: 0;
                        cursor: pointer;
                        height: 0;
                        width: 0;
                    }

                    .checkmark {
                        position: absolute;
                        top: 0;
                        right: 0;
                        height: 25px;
                        width: 25px;
                        background-color: $light;
                    }

                    .checkbox input:checked~.checkmark {
                        background-color: $light;
                    }

                    .checkmark:after {
                        content: "";
                        position: absolute;
                        display: none;
                    }

                    .checkbox input:checked~.checkmark:after {
                        display: block;
                    }

                    .checkbox .checkmark:after {
                        right: 9px;
                        top: 6px;
                        width: 5px;
                        height: 10px;
                        border: solid $brand-primary;
                        border-width: 0 3px 3px 0;
                        transform: rotate(45deg);
                    }
                }

            }
        }
    }

    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    @media(max-width:767px) {
        .pagination {
            flex-direction: column;
            align-items: flex-end;
        }
    }
}

@keyframes indeterminate_first {
    0% {
        left: 0%;
        width: 10%;
    }

    100% {
        left: 90%;
        width: 10%;
    }
}