/* ==========================================================
   DataTable container and shared rows
   ========================================================== */

div.dataTables_wrapper {
    border: 1px solid #B2DFDB;
    border-radius: 0;
}

.dt-no-records {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    margin: 0;
    text-align: center;
}

/* Keep short tables as tall as the empty state without stretching their rows. */
.dataTables_wrapper .dt-table-viewport {
    min-height: var(--app-dt-min-height, 205px);
}

.row-dt {
    margin: 0;
    padding: .5em;
    color: var(--app-dt-text-color, white);
    background: var(--app-dt-background-color, #4DB6AC) !important;
}

.dataTables_wrapper .row-dt {
    margin: 0;
    padding: 5px 0;
}

.dataTables_wrapper .row-dt-top {
    align-items: center;
}

.dataTables_wrapper .row-dt-top > [class*="col-"] {
    display: flex;
    align-items: center;
    min-height: 32px;
}

.dataTables_wrapper .row-dt-top > [class*="col-"] > * {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
}

.dataTables_wrapper .row-dt label {
    margin: 0 !important;
}

.dataTables_wrapper .row-dt .dt-label {
    position: absolute;
    margin-left: 10px;
    line-height: 32px;
}

.dataTables_wrapper .row-dt .row-dt-bottom-left {
    line-height: 32px;
}

.dataTables_wrapper .row-dt .row-dt-bottom-right {
    height: 32px;
}

.row-dt-bottom {
    padding: 0 !important;
}

.dataTables_wrapper .row-dt-bottom > [class*="col-"] {
    display: flex;
    align-items: center;
}

.dataTables_wrapper .row-dt-bottom > [class*="col-"] > * {
    width: 100%;
}

/* ==========================================================
   Top-row controls and DataTables information
   ========================================================== */

.data-table-row-top .input-group-sm > .form-control:not(textarea) {
    height: calc(1.8125rem + 2px);
}

.dataTables_filter input {
    padding-left: 34px;
    border-radius: 0;
}

.dataTables_length select {
    padding-left: 42px;
    border-radius: 0;
}

.dataTables_filter label,
.dataTables_length label,
.dataTables_info,
.dataTables_paginate {
    margin: 0;
    padding: 0;
}

.dataTables_filter label {
    float: left;
    font-weight: normal;
    text-align: left;
}

div.dataTables_filter label {
    float: right;
    font-weight: normal;
}

.dt-info {
    margin: 0;
}

/* ==========================================================
   Table structure
   ========================================================== */

table.dt-table {
    width: 100% !important;
    margin: 0 auto !important;
    clear: both !important;
    border-collapse: collapse !important;
}

table.dataTable {
    max-width: none !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    clear: both;
}

table.dataTable td,
table.dataTable th {
    box-sizing: content-box;
}

table.dataTable .table th,
.table td {
    padding: .25rem !important;
    vertical-align: middle;
}

table.dataTable tbody {
    background: white;
}

table.dataTable > tbody > tr:last-child > * {
    border-bottom: 1px solid #dee2e6 !important;
}

table.dataTable th:active {
    outline: none;
}

/* ==========================================================
   Header, footer and sorting
   ========================================================== */

.table thead th {
    vertical-align: middle !important;
    border-top: 0 solid #E3EBF3 !important;
    border-bottom: 0 solid #E3EBF3 !important;
}

table.dataTable thead {
    color: #3C8DBC;
    background: #E0F2F1;
}

table.dataTable thead > tr > th {
    padding: .3em;
    color: var(--app-dt-text-color, white);
    font-weight: normal;
    background-color: var(--app-dt-background-color, #4DB6AC) !important;
}

.record-add,
.record-add * {
    cursor: pointer;
}

table.table thead .sorting,
table.table thead .sorting_asc,
table.table thead .sorting_desc,
table.table thead .sorting_asc_disabled,
table.table thead .sorting_desc_disabled {
    padding-right: 20px;
    cursor: pointer;
}

.table thead .sorting,
.table thead .sorting_asc,
.table thead .sorting_desc,
.table thead .sorting_asc_disabled,
.table thead .sorting_desc_disabled {
    background-repeat: no-repeat;
    background-position: center right;
    background-size: 19px 19px;
}

.table thead .sorting {
    background-image: url('/images/jquery.datatables/sort_both.png');
}

.table thead .sorting_asc {
    background-image: url('/images/jquery.datatables/sort_asc.png');
}

.table thead .sorting_desc {
    background-image: url('/images/jquery.datatables/sort_desc.png');
}

.table thead .sorting_asc_disabled {
    background-image: url('/images/jquery.datatables/sort_asc_disabled.png');
}

.table thead .sorting_desc_disabled {
    background-image: url('/images/jquery.datatables/sort_desc_disabled.png');
}

table.dataTable tfoot th,
table.dataTable tfoot td {
    color: var(--app-dt-text-color, white);
    background: var(--app-dt-background-color, #4DB6AC) !important;
}

/* DataTables 3 wraps header and footer content. Keep the 2021 sizing and
   image-based sort indicators instead of the new CSS arrows. */
table.dataTable thead > tr > th > div.dt-column-header,
table.dataTable thead > tr > td > div.dt-column-header,
table.dataTable tfoot > tr > th > div.dt-column-footer,
table.dataTable tfoot > tr > td > div.dt-column-footer {
    position: static;
    display: block !important;
}

table.dataTable thead > tr > th > div.dt-column-header > .dt-column-title,
table.dataTable thead > tr > td > div.dt-column-header > .dt-column-title,
table.dataTable tfoot > tr > th > div.dt-column-footer > .dt-column-title,
table.dataTable tfoot > tr > td > div.dt-column-footer > .dt-column-title {
    display: block;
    width: 100%;
    text-align: inherit;
}

table.dataTable thead > tr > th .dt-column-order,
table.dataTable thead > tr > td .dt-column-order {
    display: none !important;
}

/* Allow action buttons to fill td-buttons headers. */
table.dataTable thead > tr > th.td-buttons .dt-column-header,
table.dataTable thead > tr > th.td-buttons .dt-column-title,
table.dataTable thead > tr > th.td-buttons .btn-group {
    display: flex !important;
    width: 100%;
}

table.dataTable thead > tr > th.td-buttons .btn-group > .btn {
    flex: 1 1 0;
    width: 100%;
}

/* ==========================================================
   Scrolling tables
   ========================================================== */

div.dataTables_scrollHead table {
    margin-bottom: 0 !important;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

div.dataTables_scrollHead table thead tr:last-child th:first-child,
div.dataTables_scrollHead table thead tr:last-child td:first-child {
    border-bottom-right-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

div.dataTables_scrollHead table.table-bordered {
    border-bottom-width: 0;
}

div.dataTables_scrollBody table {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-top: none;
}

div.dataTables_scrollBody tbody tr:first-child th,
div.dataTables_scrollBody tbody tr:first-child td {
    border-top: none;
}

div.dataTables_scrollFoot table {
    margin-top: 0 !important;
    border-top: none;
}

/* ==========================================================
   Pagination
   ========================================================== */

.dataTables_paginate {
    display: inline-block;
    margin: 0 auto !important;
}

div.dataTables_wrapper div.dataTables_paginate ul.pagination {
    margin: 0;
}

div.dataTables_paginate ul.pagination {
    margin: 2px 0;
    white-space: nowrap;
}

.pagination > li > a,
.pagination > li > button,
.pagination > li > span {
    margin-right: 5px;
    margin-left: 5px;
    color: #343A40;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
}

.pager > li > a,
.pager > li > span {
    border-color: #EAEDF1;
}

.pager > li > a:hover,
.pagination > li > a:hover,
.pagination > li > button:hover {
    color: #3C8DBC;
    background-color: #7CA687;
    border-color: #7CA687;
}

.pagination > li.disabled > button,
.pagination > li.disabled > button:hover,
.pagination > li.disabled > button:focus {
    color: #6C757D;
    background: none !important;
    opacity: .65;
}

.pager > li.disabled > a:hover {
    border-color: #EAEDF1;
}

div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover,
div.dt-container .dt-paging .dt-paging-button.disabled:active {
    color: rgb(255 255 255 / 50%) !important;
}

/* ==========================================================
   Buttons, cells and responsive details
   ========================================================== */

.dt-buttons > button {
    width: 3em !important;
}

.dt-td-w-min {
    width: 240px;
    white-space: nowrap !important;
}

.dt-chk {
    margin: 0 1em;
}

ul.dtr-details {
    padding: 0;
    padding-inline-start: unset;
    list-style-type: none;
}

span.dtr-title {
    display: none;
}

/* ==========================================================
   Processing and loading states
   ========================================================== */

.dataTables_processing {
    display: none;
    padding: .2em;
    color: var(--app-dt-text-color, white);
    background: var(--app-dt-background-color, #4DB6AC);
    border: 1px solid #9E9E9E;
    border-radius: 4px;
}

div.dt-container .dt-processing {
    color: var(--app-dt-text-color, white);
    background-color: var(--app-dt-background-color, #4DB6AC);
}

.dataTables_processing > .dt-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    transform: translateY(-50%);
}

table.dt-table thead tr.dt-loading {
    color: var(--app-dt-text-color, white);
    background: var(--app-dt-background-color, #4DB6AC);
}


/* ---- listados en tarjetas en el móvil (opcional: clase dt-tarjetas-movil en la tabla). Cada fila es una tarjeta
   con los datos en dos columnas y el título de su columna encima (data-label, lo pone active-datatable.js); la
   primera celda hace de título y la columna de botones (dt-tarjeta-acciones) va abajo, a todo lo ancho. En pantallas
   anchas sigue siendo una tabla. */
@media (max-width: 767.98px) {
    table.dt-tarjetas-movil {
        border: 0 !important;
        background: transparent !important;
    }

    /* el marco que DataTables pone alrededor de la tabla sobra cuando cada fila ya es una tarjeta */
    .dataTables_wrapper:has(table.dt-tarjetas-movil),
    .dt-container:has(table.dt-tarjetas-movil) {
        border: 0 !important;
        box-shadow: none !important;
    }

    /* lo mismo con la tarjeta que envuelve una tabla sin DataTables (la cabecera, si la tiene, se queda) */
    .card:has(> .card-body > table.dt-tarjetas-movil) {
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* un botón solo en la fila de acciones ocupa todo el ancho de la tarjeta */
    table.dt-tarjetas-movil > tbody > tr > td.dt-tarjeta-acciones > .btn:only-child {
        width: 100%;
    }

    table.dt-tarjetas-movil > thead {
        display: none;
    }

    table.dt-tarjetas-movil,
    table.dt-tarjetas-movil > tbody {
        display: block;
        width: 100% !important;
    }

    table.dt-tarjetas-movil > tbody > tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .55rem .9rem;
        margin: 0 0 .75rem;
        padding: .85rem 1rem;
        border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, .08));
        border-radius: 0rem;
        background: var(--bs-body-bg, #fff);
        box-shadow: 0 .15rem .8rem rgba(16, 24, 40, .07);
    }

    table.dt-tarjetas-movil > tbody > tr > td {
        display: block;
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        text-align: left !important;
        white-space: normal !important;
    }

    table.dt-tarjetas-movil > tbody > tr > td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .1rem;
        font-size: .68rem;
        font-weight: 600;
        letter-spacing: .03em;
        text-transform: uppercase;
        color: var(--bs-secondary-color, #6b7785);
    }

    table.dt-tarjetas-movil > tbody > tr > td:first-child {
        grid-column: 1 / -1;
        font-size: 1rem;
        font-weight: 600;
    }

    table.dt-tarjetas-movil > tbody > tr > td:first-child::before,
    table.dt-tarjetas-movil > tbody > tr > td.dt-tarjeta-acciones::before {
        display: none !important;
    }

    table.dt-tarjetas-movil > tbody > tr > td.dt-tarjeta-ancha,
    table.dt-tarjetas-movil > tbody > tr > td.dt-tarjeta-acciones {
        grid-column: 1 / -1;
    }

    table.dt-tarjetas-movil > tbody > tr > td.dt-tarjeta-acciones .btn {
        padding-top: .55rem;
        padding-bottom: .55rem;
        font-size: 1rem;
    }

    table.dt-tarjetas-movil > tbody > tr > td.dataTables_empty,
    table.dt-tarjetas-movil > tbody > tr > td.dt-empty {
        grid-column: 1 / -1;
        text-align: center !important;
    }

    table.dt-tarjetas-movil > tbody > tr:has(> td.dataTables_empty),
    table.dt-tarjetas-movil > tbody > tr:has(> td.dt-empty) {
        display: block;
    }
}
