$table-header-font-weight: 400;
$table-header-font-color: #757575;
$table-cell-padding: 1.2rem;
$table-condensed-cell-padding: $table-cell-padding/2;
$table-bg: #fff;
$table-bg-accent: #f4f4f4;
$table-bg-hover: rgba(0, 0, 0, .12);
$table-bg-active: $table-bg-hover;
$table-border-color: #f5f5f5;
novo-table {
    width: 100%;
    display: block;
    button.hint--bottom {
        z-index: 1;
    }
    >header {
        novo-table-header {
            padding: 10px;
            button {
                height: 39px;
                margin-right: 10px;
                &:last-child {
                    margin-right: 0;
                }
            }
        }
        div.header-actions {
            display: flex;
            align-items: center;
            >novo-pagination {
                flex: 1;
                >h5 {
                    margin-left: 0;
                }
                novo-select {
                    .novo-select-list {
                        transform: translateY(5%) !important;
                    }
                }
            }
            >novo-table-actions {
                padding: 10px;
                display: flex;
                align-items: center;
                >* {
                    margin-right: 10px;
                    &:last-child {
                        margin-right: 0;
                    }
                }
                >button {
                    height: 39px;
                }
            }
        }
    }
    >.table-container {
        overflow-x: auto;
        width: 100%;
        display: block;
    }
    novo-table-footer {
        display: flex;
    }
    tfoot.novo-table-total-footer {
        td {
            padding: $table-cell-padding;
        }
    }
    &.editing {
        th .th-title,
        th novo-dropdown,
        novo-pagination h5,
        novo-pagination novo-select,
        novo-pagination ul.pager {
            pointer-events: none;
            opacity: 0.7;
        }
        novo-control {
            margin-top: 0 !important;
        }
    }
    &.novo-table-loading {
        position: relative;
    }
    div.novo-table-loading-overlay {
        background: rgba(0, 0, 0, 0.2);
        z-index: 1;
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    novo-form {
        max-width: inherit;
        td.novo-form-row {
            width: inherit !important;
        }
    }
}

// Baseline styles
.table {
    width: 100%;
    max-width: 100%;
    background-color: $table-bg;
    >tbody,
    >thead {
        >tr {
            >td,
            >th {
                position: relative;
                text-align: left;
                padding: $table-cell-padding;
                vertical-align: middle;
                &.checkbox {
                    text-align: center;
                    padding-bottom: 15px;
                    >novo-checkbox {
                        justify-content: center;
                    }
                }
            }
            &.table-selection-row {
                background-color: $navigation !important;
                color: $white;
            }
        }
    }
    >thead>tr>th {
        &:nth-of-type(1) {
            .th-group {
                novo-dropdown.column-filters {
                    novo-dropdown-container {
                        left: -80px;
                    }
                }
            }
        }
        &.sorted {
            background: rgba($positive, .2);
        }
    }
    >thead>tr {
        th:first-child {
            novo-dropdown {
                novo-dropdown-container {
                    left: -90px !important;
                }
            }
        }
        th:last-child {
            novo-dropdown {
                novo-dropdown-container {
                    right: 0 !important;
                }
            }
        }
    }
    >thead>tr>th {
        font-weight: $table-header-font-weight;
        color: $table-header-font-color;
        vertical-align: bottom;
        border-bottom: 1px solid #F4F4F4;
        border-top: 1px solid #F4F4F4;
        border-right: 1px solid #F4F4F4;
        padding: 0.75rem;
        &.over {
            background: #eee;
            border-right: 2px double #000 !important;
            * {
                pointer-events: none;
            }
        }
        .th-group {
            display: flex;
            flex-direction: row;
            align-items: center;
            novo-dropdown.column-filters {
                button.filtered {
                    i {
                        color: $positive;
                    }
                }
            }
            .th-title {
                display: flex;
                flex-direction: row;
                align-items: center;
                padding: 10px 10px 10px 5px;
                border-radius: 3px;
                font-weight: $table-header-font-weight;
                &.sortable {
                    cursor: pointer;
                    label {
                        cursor: pointer; // chrome user agent style will override this unless explicitly set on the element
                        margin-right: 10px;
                    }
                }
                &:hover {
                    .table-sort-icons {
                        opacity: 1;
                        i {
                            &.bhi-arrow-down {
                                color: lighten(#757575, 15%);
                            }
                            &.bhi-arrow-up {
                                color: darken(#757575, 10%);
                            }
                        }
                    }
                }
                .table-sort-icons {
                    display: flex;
                    flex-direction: row;
                    opacity: 0.3;
                    transition: all 200ms ease-in-out;
                    i {
                        font-size: 0.8em;
                        margin: 0;
                        &.bhi-arrow-down {
                            padding-top: 5px;
                        }
                    }
                    &.asc {
                        opacity: 1;
                        i {
                            &.bhi-arrow-down {
                                color: lighten(#757575, 15%);
                            }
                            &.bhi-arrow-up {
                                color: $positive;
                            }
                        }
                    }
                    &.desc {
                        opacity: 1;
                        i {
                            &.bhi-arrow-down {
                                color: $positive;
                            }
                            &.bhi-arrow-up {
                                color: lighten(#757575, 15%);
                            }
                        }
                    }
                }
            }
        }
    }
    >tbody+tbody {
        border-top: 1px solid rgba(0, 0, 0, .12);
    }
    .table-message {
        tr,
        td {
            background-color: $white !important;
        }
    }
    .table {
        background-color: $table-bg;
    }
    .row-action {
        padding: 0.3rem !important;
    }
    tr.details-row {
        td {
            padding-top: 0 !important;
        }
    }
    .no-border {
        border: 0;
    }
    .table-message,
    .no-matching-records,
    .table-empty-message {
        color: $grey;
        margin: 40px 0;
        vertical-align: middle;
    }
    .table-error-message {
        color: $grey;
        margin: 40px 0;
        vertical-align: middle;
    }
    .table-loading {
        display: flex;
        vertical-align: middle;
        align-items: center;
        justify-content: center;
        background: $white;
    }
    novo-checkbox {
        .check-box-group {
            color: $grey;
            margin-right: 0;
            &.checked {
                color: $positive;
            }
            .bhi-checkbox-indeterminate {
                color: $positive;
            }
        }
    }
}

novo-dropdown-container.table-dropdown {
    right: -15px;
    min-width: 230px;
    max-width: 230px;
    max-height: 500px;
    overflow-x: hidden;
    overflow-y: auto;
    button[theme][theme="dialogue"][icon] i {
        padding: inherit;
        padding-left: 5px;
        height: inherit;
        width: inherit;
        display: inline-block;
        line-height: inherit;
    }
    list {
        item.filter-search {
            padding: 10px 0;
            width: 100%;
            height: auto;
            flex-direction: column;
            align-items: flex-start;
            cursor: initial;
            &:hover {
                background: transparent;
            }
            .header {
                display: flex;
                align-items: center;
                justify-content: space-between;
                width: 90%;
                font-size: 0.9em;
                margin: 0 auto;
                span {
                    text-transform: uppercase;
                    font-weight: $table-header-font-weight;
                }
                button {
                    padding: 0 5px;
                    i {
                        height: auto !important;
                        width: auto !important;
                        font-size: 0.9em;
                    }
                }
            }
            input {
                border: none;
                border-bottom: 2px solid #BEBEBE;
                width: 90%;
                margin: 0 auto;
                background: transparent;
                &:focus {
                    outline: none;
                    border-bottom: 2px solid $ocean;
                }
            }
        }
        item>span {
            display: inline-block;
            max-width: calc(100% - 20px);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }
    .calender-container {
        height: 100%;
        min-height: 200px;
        width: 100%;
        background: #fff;
        >div {
            color: $positive;
            line-height: 3em;
            font-size: 0.9em;
            padding-left: 5px;
            cursor: pointer;
        }
        novo-date-picker {
            .calendar {
                width: 100%;
                height: 100%;
                box-shadow: none;
                padding: 0 5px 10px;
                .calendar-top {
                    display: none;
                }
            }
        }
    }
}

// Condensed table w/ half padding
.table-condensed {
    tbody,
    thead,
    tfoot {
        tr {
            td,
            th {
                padding: $table-condensed-cell-padding;
                button {
                    padding: 5px !important;
                    width: inherit !important;
                    height: inherit !important;
                }
                .th-title {
                    padding: 5px 5px 5px 0;
                }
            }
        }
    }
}

// Bordered version
// Add horizontal borders between columns.
.table-bordered {
    tbody,
    thead,
    tfoot {
        tr {
            td,
            th {
                border-bottom: 1px solid $table-border-color;
            }
        }
    }
    >thead>tr {
        >td,
        >th {
            border-bottom-width: 2px;
        }
    }
}

// Zebra-striping
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped:not(.table-details) {
    >tbody tr:nth-of-type(odd):not(.table-selection-row) {
        background-color: $table-bg-accent;
        td {
            background-color: $table-bg-accent;
        }
    }
}

.table-striped.table-details {
    >tbody tr:nth-of-type(4n+2),
    >tbody tr:nth-of-type(4n+1) {
        background-color: $table-bg-accent;
    }
}

// Hover effect
.table-hover {
    >tbody>tr:hover {
        background-color: $table-bg-hover;
    }
}

.handle {
    display: block;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
}

novo-table {
    &[dark] {
        .table>thead>tr>th {
            border-right: 1px solid rgba(#F4F4F4, .04);
        }
        .table-striped:not(.table-details) {
            >tbody tr:nth-of-type(odd) {
                background-color: rgba($table-bg-accent, .04);
                td {
                    background-color: transparent;
                }
            }
        }
        .table-striped.table-details {
            >tbody tr:nth-of-type(4n+2),
            >tbody tr:nth-of-type(4n+1) {
                background-color: rgba($table-bg-accent, .04);
            }
        }
    }
    @each $analytics,
    $color in $analytics-colors {
        &[theme="#{$analytics}"] {
            >header {
                background: $color;
                color: #fff;
                novo-pagination {
                    background: rgba(0, 0, 0, 0.15);
                    >* {
                        color: $white;
                        opacity: 1;
                    }
                    .page {
                        color: $white;
                    }
                    h5.rows {
                        opacity: 0.75;
                    }
                    novo-select {
                        div[type="button"] {
                            color: $white;
                            border-bottom: 1px solid rgba(255, 255, 255, 0.15);
                            i {
                                color: $white !important;
                            }
                        }
                    }
                }
            }
        }
    }
    @each $entity,
    $color in $entity-colors {
        &[theme="#{$entity}"] {
            >header {
                background: $color;
                color: #fff;
                novo-pagination {
                    background: rgba(0, 0, 0, 0.15);
                    >* {
                        color: $white;
                        opacity: 1;
                    }
                    .page {
                        color: $white;
                    }
                    h5.rows {
                        opacity: 0.75;
                    }
                    novo-select {
                        div[type="button"] {
                            color: $white;
                            border-bottom: 1px solid rgba(255, 255, 255, 0.15);
                            i {
                                color: $white !important;
                            }
                        }
                    }
                }
            }
        }
    }
    @each $basic,
    $color in $colors {
        &[theme="#{$basic}"] {
            >header {
                background: $color;
                color: #fff;
                novo-pagination {
                    background: rgba(0, 0, 0, 0.15);
                    >* {
                        color: $white;
                        opacity: 1;
                    }
                    .page {
                        color: $white;
                    }
                    h5.rows {
                        opacity: 0.75;
                    }
                    novo-select {
                        div[type="button"] {
                            color: $white;
                            border-bottom: 1px solid rgba(255, 255, 255, 0.15);
                            i {
                                color: $white !important;
                            }
                        }
                    }
                }
            }
        }
    }
    &[dark] {
        >header {
            color: #fff;
            novo-pagination {
                background: rgba(0, 0, 0, 0.15);
                >* {
                    color: $white;
                    opacity: 1;
                }
                .page {
                    color: $white;
                    &.active {
                        color: #FFF;
                        background: rgba(0, 0, 0, 0.15);
                    }
                }
                h5.rows {
                    opacity: 0.75;
                }
                novo-select {
                    div[type="button"] {
                        color: $white;
                        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
                        i {
                            color: $white !important;
                        }
                    }
                }
            }
        }
    }
}

th.dragging {
    opacity: 0.4;
}
