/*  TABLES    */

$file-restricted-bg: #ffdcda; // Background color of restricted files

.table {
    position: relative;
    width: 100%;
    font-size: 0.9rem;
    border-spacing: 0;

    @at-root #{&}__scrollarea {
        overflow-x: auto;
        overflow-y: hidden;
    }
}

.table-panel {
    @extend .panel;

    margin-top: 0;
    margin-bottom: 15px;
    padding: 0;
    border-collapse: separate;

    tr:last-child td:first-child {
        border-bottom-left-radius: $border-radius-base;
    }

    tr:last-child td:last-child {
        border-bottom-right-radius: $border-radius-base;
    }

    // Standard footer for sortable table, including count and optional search link.
    @at-root #{&}__std-footer {
        display: flex;
        align-items: center;
        padding: 3px 5px;

        @at-root #{&}-count {
            flex: 1 1 auto;
        }

        @at-root #{&}-search {
            flex: 0 1 auto;
        }
    }
}

.table-striped {
    > tbody {
        > tr:nth-child(odd) {
            > td {
                background-color: #fff;
                border-top: none;
            }
        }

        > tr:nth-child(even) {
            > td {
                background-color: #f9f9f9;
                border-top: none;
            }
        }
    }
}

form.table-filter {
    position: absolute;
    right: 10px;
    margin: 0;
}

#table-filter {
    display: inline-block;
    width: 265px;
    font-size: 1.2rem;
}

.table-count {
    font-size: 1rem;
    display: inline-block !important;
    padding: 0.5em 2em !important;
    margin-right: 1em;
}

.spinner-warning {
    background: #f89406 url("../img/spinner-orange-bg.gif") no-repeat;
    background-position: 7px 9px;
}

.table-actions {
    margin-left: 1em;

    button {
        float: none;
    }
}

%tcenter {
    display: flex;
    justify-content: center;
}

.tcell-thumbnail {
    @extend %tcenter;

    img {
        height: 100px;
        width: 120px;
    }
}

.tcell-center {
    @extend %tcenter;
}

/* initial state is hidden (see template; class=hide) */
#total-records {
    font-weight: normal;
}

// Allow line breaks in table cells (esp Targets)
.collection-table tbody span {
    display: block;
}

.collection-table {
    > tbody {
        > tr {
            > td {
                vertical-align: top;
            }
        }
    }
}

.tcell-sortable {
    cursor: pointer;
}

.table__sortable {
    border-collapse: collapse;
    overflow-x: auto;

    thead, tfoot {
        background-color: #f5f5f5;

        tr {
            th {
                position: relative;
                height: 4em;
                padding: 5px;
                vertical-align: middle;
                border-left: 1px solid #e0e0e0;
                text-align: left;
                font-weight: 600;

                &:first-child {
                    border-left: none;
                }
            }
        }
    }

    tfoot {
        border-top: 1px solid #ddd;
    }

    tbody {
        tr {
            td {
                padding: 8px 11px 9px 11px;
                border-top: 1px solid #ddd;
            }

            &.file-restricted {
                td {
                    background-color: $file-restricted-bg;

                    &.table-raw-merged {
                        background-color: #fff;
                    }
                }
            }
        }
    }
}

.table-section {
    font-size: 1.3rem;
    font-weight: bold;
    background-color: #d8e0e8;

    th {
        padding: 0 !important;
        height: auto !important;
        font-weight: 600;
    }
}

.tcell-sortable {
    &__column-header {
        display: flex;
        height: 100%;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    &:hover {
        background-color: #e0e0e0;
    }
}

%tcell-template {
    @extend .icon;

    display: block;
    padding: 0 0 0 5px;
    flex: 0 0 10px;
}

.tcell-sort {
    @extend %tcell-template;
    @extend .icon-sort;
}

.tcell-asc {
    @extend %tcell-template;
    @extend .icon-sort-asc;
}

.tcell-desc {
    @extend %tcell-template;
    @extend .icon-sort-desc;
}

.highlight-row {
    td {
        background-color: #606060 !important;
        color: #fff;
        font-weight: 400;

        a {
            color: #fff !important;
        }
    }
}

.file-table-footer {
    padding: 4px 8px;
    border-top: 1px solid #e0e0e0;
}

.table-raw-biorep {
    text-align: center;
    font-weight: bold;
}

.merge-bottom {
    border-bottom: 2px solid #606060;
}

.file-audit-status {
    height: 13px !important;
    line-height: 13px !important;
}

.restricted-accession {
    display: inline-block;
    position: relative;
}

.file-table-accession {
    white-space: nowrap;
}

.file-table-btn {
    padding: 0 0 0 5px;
    background-color: transparent;
    border: none;
    box-shadow: none;

    i {
        font-size: 1.1rem;
    }
}

.file-qc-btn {
    border: 1px solid #a0a0a0;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.8rem;
    background-color: #80ffc0;
}

.coalesced-table {
    margin: -10px;
}

/**
 * Styles for specific tables.
 */

// Experiment series tables; might need to expand name if needed for similar object tables.
.table-experiment-series {
    > tfoot > tr > td {
        padding: 3px 5px;
        text-align: right;
    }
}

// Raw file tables.
.table-raw {
    background-color: #fff;

    > tbody {
        > tr {
            > td {
                padding: 10px 11px;
                vertical-align: middle;

                &.merge-right {
                    border-right: 1px solid #ddd;
                }

                &.align-pair1 {
                    vertical-align: bottom;
                }

                &.align-pair2 {
                    vertical-align: top;
                }

                &.group-bottom,
                &.pair-bottom {
                    border-bottom: 2px solid #606060;
                }

                &.index-reads {
                    padding-top: 2px;
                    padding-bottom: 2px;
                    background-color: #f0f0f0;
                }
            }
        }
    }
}

.table-raw-separator td {
    border-top: 2px solid #606060;
}

// Header for a SortTable including a pager.
.header-paged-sorttable {
    display: flex;
    justify-content: space-between;

    @at-root #{&}__controls {
        display: flex;
        margin-top: -3px;
        margin-right: -3px;
        margin-bottom: -3px;

        .pager {
            margin-left: 5px;
        }
    }
}

.table-item-count {
    padding-top: 2px;
    padding-bottom: 2px;
    text-align: center;
    font-size: 0.9rem;
    color: #606060;
    border: 1px solid #a0a0a0;
}
