.table-overview {
    border-spacing: 0;
    margin-bottom: 18px;
    border-radius: @border-radius;
    background: #fff;
    width: auto;
    .grey-box-shadow;
    td, th {
        padding: 8px 20px 8px 15px;
        font-weight: normal;
        font-size: 12px;
    }
    th:first-child {
        min-width: 145px;
    }
    th {
        text-align: right;
        border-right: 1px solid #EDEDED;
        border-bottom: 1px solid #EDEDED;
        vertical-align: top;
    }
    td {
        background-color: #F6F7F8;
        border-bottom: 1px solid #f1f1f1;
    }
    tr:last-child {
        td, th {
            border-bottom: 0;
        }
    }
    tr:first-child td {
        border-top-right-radius: @border-radius;
    }
    tr:last-child td {
        border-bottom-right-radius: @border-radius;
    }
    tr:first-child th, tr:first-child td {
        padding-top: 10px;
    }
    tr:last-child th, tr:last-child td {
        padding-bottom: 10px;
    }
    caption {
        text-align: left;
        margin-bottom: 3px;
        a {
            .italic-title;
            text-decoration: none;
        }
    }
    tr.header-row {
        &:first-child th {
            border-top-left-radius: @border-radius;
            border-top-right-radius: @border-radius;
            border-top: 0;
        }
        th {
            text-align: center;
            font-weight: bold;
            .grey-gradient;
            box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .3);
            border-bottom: 1px solid #ddd;
            border-top: 1px solid #ddd;
            .white-shadow;
            padding: 5px 10px;
            color: @text-color;
        }
    }
}

.table {
    th, td {
        background-color: white;
        .white-inset;
        .white-shadow;
        input {
            margin: 0;
        }
        a {
            text-decoration: none;
            &:hover {
                text-decoration: underline;
            }
        }
        p {
            margin-bottom: 0;
        }
    }
    tr:not(:first-child) {
        th, td {
            border-top: 1px solid #eee;
        }
    }
    thead {
        line-height: 18px;
        th, td {
            padding: 0;
            padding: 7px 10px 8px;
            font-weight: bold;
            .vertical-gradient(#f3f3f3, #e5e5e5);
            box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .3);
            div {
                margin: 0;
            }
            .text {
                &>a, &>span {
                    padding: 8px 10px;
                    margin: -6px -10px;
                    display: block;
                }
            }
        }
        th {
            vertical-align: middle;
            line-height: normal;
            .relative-wrapper {
                position: relative;
                display: inline;
                float: right;
                width: 55px;
            }
            .sortoptions {
                margin-top: 2px;
                right: -55px;
                position: absolute;
                a, span {
                    display: inline-block;
                    float: left;
                    padding: 0 3px;
                }
                .sortpriority {
                    color: #777;
                    padding-right: 4px;
                }
                .sortremove, .toggle {
                    display: block;
                    width: 12px;
                    height: 12px;
                    opacity: .4;
                    background-image: url("../bootstrap/img/glyphicons-halflings.png");
                    background-position: -309px 0;
                    &:hover {
                        opacity: 0.8;
                    }
                }
                .sortremove {
                    margin-right: 4px;
                }
                .toggle {
                    &.ascending {
                        background-position: -310px -119px;
                    }
                    &.descending {
                        background-position: -285px -120px;
                    }
                }
            }
            &.sorted {
                padding-right: 55px;
                .vertical-gradient(#e7e7e7, #ddd);
            }
        }
        th.action-checkbox-column {
            width: 33px;
        }
    }
}

.inline-group .tabular {
    table.table {
        tr.add-row td { //            background-color: #eee;
            .vertical-gradient(#efefef, #e2e2e2);
            .white-shadow;
            padding-left: 10px;
        }
        td.delete {
            text-align: center;
            width: 40px;
        }
        td .help-block {
            margin: 0;
        }
    }
}

.table .add-row a, .add-row a {
    font-size: 11px;
    text-decoration: underline;
    &:hover {
        text-decoration: none;
    }
}

/* Fix BS row styles for TH cells */
@bs-tr-error-color: #f2dede;
@bs-tr-warning-color: #fcf8e3;
@bs-tr-info-color: #d9edf7;
@bs-tr-success-color: #dff0d8;
.table tbody {
    >tr.error, >tr.warning, >tr.info, >tr.success {
        box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5);
    }
    >tr.error {
        >td, >th {
            background-color: @bs-tr-error-color;
            border-top: 1px solid darken(@bs-tr-error-color, 3%);
        }
    }
    >tr.warning {
        >td, >th {
            background-color: @bs-tr-warning-color;
            border-top: 1px solid darken(@bs-tr-warning-color, 8%);
        }
    }
    >tr.info {
        >td, >th {
            background-color: @bs-tr-info-color;
            border-top: 1px solid darken(@bs-tr-info-color, 5%);
        }
    }
    >tr.success {
        >td, >th {
            background-color: @bs-tr-success-color;
            border-top: 1px solid darken(@bs-tr-success-color, 5%);
        }
    }
}
.table-hover tbody {
    >tr.error:hover>th {
        background-color: darken(@bs-tr-error-color, 5%);
    }
    >tr.warning:hover>th {
        background-color: darken(@bs-tr-warning-color, 5%);
    }
    >tr.info:hover>th {
        background-color: darken(@bs-tr-info-color, 5%);
    }
    >tr.success:hover>th {
        background-color: darken(@bs-tr-success-color, 5%);
    }
}

@tr-selected-color: #FCF8E3;
@tr-selected-color: #83B3C3;
.table-striped.table-hover tbody {
    // Striped and selected and hover
    &>tr.selected:hover {
        &>td, &>th {
            background-color: darken(@tr-selected-color, 6%);
        }
    }
    &>tr.selected:hover:nth-child(odd) {
        &>td, &>th {
            background-color: darken(@tr-selected-color, 6%);
        }
    }
}

/* Fix text-alignment classes for tables */
.table th, .table td {
    &.text-left {
        text-align: left;
    }
    &.text-center {
        text-align: center;
    }
    &.text-right {
        text-align: right;
    }
}

.table-bordered {
    th:not(:first-child), td:not(:first-child) {
        border-left: 0;
    }
    th:not(:first-child), td:not(:first-child) {
        border-left: 0;
    }
}
.table.table-condensed tbody {
    th, td {
        font-weight: normal;
        padding: 5px 10px 4px 10px;
    }
}

.table {
    tbody > tr.selected {
        &>th, &>td {
            background-color: @tr-selected-color;
            border-top: 1px solid darken(@tr-selected-color, 5%);
            box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .2);
            color: white;
            text-shadow: none;
            a {
                color: white;
                text-decoration: underline;
                &:hover {
                    text-decoration: none;
                }
            }
        }
    }
    tbody > tr.selected:nth-child(odd) {
        &>td, &>th {
            background-color: lighten(@tr-selected-color, 3%);
        }
    }
}

/* TabularInlines Sortables */
.inline-sortable {
    white-space: nowrap;
    a {
        display: inline-block;
        padding: 2px 6px 2px 2px;
        &:last-child {
            padding: 0;
        }
        &:hover {
            .icon-alpha5 {
                opacity: .5;
            }
        }
    }
}
.selected td {
    .inline-sortable a i, .inline-sortable a:hover i {
        opacity: 1;
    }
}
tr:first-child td .inline-sortable .sortable-up {
    opacity: .15;
    cursor: default;
}
tr.form-row:nth-last-child(3), #result_list tr:last-child {
    td .inline-sortable .sortable-down {
        opacity: .15;
        cursor: default;
    }
}
