/**
 * Tablas DataTables — estilo unificado (Usuarios + pie tipo Transacciones).
 * Activar envolviendo el wrapper: .dataTables_wrapper.admin-dt
 */

/* Ocultar búsqueda global de DataTables (la búsqueda va en la barra de filtros) */
.admin-dt .dataTables_filter {
    display: none !important;
}

/* —— Toolbar superior (info + length) —— */
.admin-dt .admin-dt-toprow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 0.5px solid #f0f4f8;
}

.admin-dt .admin-dt-top-left,
.admin-dt .admin-dt-info-left {
    flex: 1 1 auto;
    min-width: 0;
}

.admin-dt .admin-dt-top-right,
.admin-dt .admin-dt-length-right {
    flex-shrink: 0;
}

.admin-dt .dataTables_info {
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: #8fa6be;
    float: none;
}

.admin-dt .dataTables_info .dt-range-strong {
    font-weight: 500;
    color: #3a5270;
}

.admin-dt .dataTables_length {
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: #8fa6be;
    float: none;
}

.admin-dt .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 500;
    color: #3a5270;
    cursor: pointer;
}

.admin-dt .dataTables_length select {
    border-radius: 8px;
    border: 1px solid #d8e2ec;
    background: #f5f7fa;
    padding: 4px 28px 4px 10px;
    font-size: 12px;
    color: #1a2e4a;
    cursor: pointer;
}

/* Alias compat Transacciones */
.admin-dt .txn-dt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 0.5px solid #f0f4f8;
}

.admin-dt .txn-dt-toolbar .dataTables_info,
.admin-dt .txn-dt-toolbar .dataTables_length {
    float: none;
}

/* —— Pie: paginación —— */
.admin-dt .admin-dt-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 9px 14px;
    border-top: 0.5px solid #f0f4f8;
}

.admin-dt .dataTables_paginate {
    float: none;
    margin: 0;
    padding: 0;
}

.admin-dt .dataTables_paginate .paginate_button {
    padding: 4px 9px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    border: 0.5px solid #d0dce8 !important;
    background: #fff !important;
    color: #3a5270 !important;
    margin: 0 3px !important;
    cursor: pointer;
}

.admin-dt .dataTables_paginate .paginate_button.current {
    background: #1e6dbf !important;
    color: #fff !important;
    border-color: #1e6dbf !important;
}

.admin-dt .dataTables_paginate .paginate_button.disabled,
.admin-dt .dataTables_paginate .paginate_button.disabled:hover {
    color: #bec8d4 !important;
    cursor: default !important;
    border-color: #e8ecf2 !important;
    background: #fff !important;
}

.admin-dt .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: #f5f8fc !important;
    border-color: #c5d3e0 !important;
    color: #1a2e4a !important;
}

/* Clear floats legacy */
.admin-dt.dataTables_wrapper::after {
    content: "";
    display: table;
    clear: both;
}

/* —— Tabla: header —— */
.admin-dt table.dataTable thead th,
.admin-dt table.dataTable thead td {
    background: #f7f9fc;
    font-size: 11px;
    font-weight: 500;
    color: #7a8fa6;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 9px 12px;
    border-bottom: 0.5px solid #e8ecf2;
    white-space: nowrap;
    vertical-align: middle;
}

.admin-dt table.dataTable thead th.dt-orderable-asc,
.admin-dt table.dataTable thead th.dt-orderable-desc,
.admin-dt table.dataTable thead th.sorting,
.admin-dt table.dataTable thead th.sorting_asc,
.admin-dt table.dataTable thead th.sorting_desc {
    cursor: pointer;
}

/* Ordenamiento: flechas personalizadas (DataTables 1.13) */
.admin-dt table.dataTable thead th.dt-orderable-asc,
.admin-dt table.dataTable thead th.dt-orderable-desc,
.admin-dt table.dataTable thead th.sorting,
.admin-dt table.dataTable thead th.sorting_asc,
.admin-dt table.dataTable thead th.sorting_desc {
    padding-right: 22px;
    position: relative;
    background-image: none !important;
}

.admin-dt table.dataTable thead th.sorting:before,
.admin-dt table.dataTable thead th.sorting:after,
.admin-dt table.dataTable thead th.sorting_asc:before,
.admin-dt table.dataTable thead th.sorting_asc:after,
.admin-dt table.dataTable thead th.sorting_desc:before,
.admin-dt table.dataTable thead th.sorting_desc:after,
.admin-dt table.dataTable thead th.dt-orderable-asc:before,
.admin-dt table.dataTable thead th.dt-orderable-asc:after,
.admin-dt table.dataTable thead th.dt-orderable-desc:before,
.admin-dt table.dataTable thead th.dt-orderable-desc:after {
    font-family: system-ui, sans-serif;
    font-size: 11px;
    line-height: 1;
    position: absolute;
    right: 8px;
    bottom: 50%;
    transform: translateY(50%);
    opacity: 1;
    border: none;
    background: none;
    display: block;
    width: auto;
    height: auto;
    content: none;
}

.admin-dt table.dataTable thead th.sorting:before,
.admin-dt table.dataTable thead th.dt-orderable-asc:before,
.admin-dt table.dataTable thead th.dt-orderable-desc:before {
    content: "↕";
    color: #c5d3e0;
    font-weight: 500;
}

.admin-dt table.dataTable thead th.sorting_asc:before,
.admin-dt table.dataTable thead th.dt-orderable-asc.dt-ordering-asc:before {
    content: "↑";
    color: #1e6dbf;
    font-weight: 600;
}

.admin-dt table.dataTable thead th.sorting_desc:before,
.admin-dt table.dataTable thead th.dt-orderable-desc.dt-ordering-desc:before {
    content: "↓";
    color: #1e6dbf;
    font-weight: 600;
}

.admin-dt table.dataTable thead th.sorting:after,
.admin-dt table.dataTable thead th.sorting_asc:after,
.admin-dt table.dataTable thead th.sorting_desc:after {
    display: none !important;
    content: none !important;
}

/* —— Filas —— */
.admin-dt table.dataTable tbody td {
    font-size: 13px;
    color: #2c4260;
    padding: 9px 12px;
    border-bottom: 0.5px solid #f0f4f8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.admin-dt table.dataTable.table-dt-compact tbody td {
    font-size: 12px;
}

.admin-dt table.dataTable tbody tr {
    cursor: pointer;
    transition: background 0.1s ease;
}

.admin-dt table.dataTable tbody tr:hover {
    background: #f5f8fc !important;
}

.admin-dt table.dataTable tbody tr.selected,
.admin-dt table.dataTable tbody tr.active,
.admin-dt table.dataTable tbody tr.selected-row,
.admin-dt table.dataTable tbody tr.factura-row.selected-row,
.admin-dt table.dataTable tbody tr.pago-row.selected-row {
    background: #eef4fd !important;
    color: #1a3a6a;
}

.admin-dt table.dataTable tbody tr.selected td,
.admin-dt table.dataTable tbody tr.active td,
.admin-dt table.dataTable tbody tr.selected-row td,
.admin-dt table.dataTable tbody tr.factura-row.selected-row td,
.admin-dt table.dataTable tbody tr.pago-row.selected-row td {
    color: #1a3a6a;
}

.admin-dt table.dataTable tbody tr:last-child td {
    border-bottom: none;
}

/* —— Avatares iniciales (26px + buckets A–Z) —— */
.admin-avatar-initials,
.admin-dt .admin-avatar-initials {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.admin-avatar-initials.admin-avatar-b--ad,
.admin-dt .admin-avatar-initials.admin-avatar-b--ad {
    background: #dbeafe;
    color: #1e6dbf;
}

.admin-avatar-initials.admin-avatar-b--eh,
.admin-dt .admin-avatar-initials.admin-avatar-b--eh {
    background: #d1fae5;
    color: #065f46;
}

.admin-avatar-initials.admin-avatar-b--il,
.admin-dt .admin-avatar-initials.admin-avatar-b--il {
    background: #ede9fe;
    color: #5b21b6;
}

.admin-avatar-initials.admin-avatar-b--mp,
.admin-dt .admin-avatar-initials.admin-avatar-b--mp {
    background: #ffedd5;
    color: #9a3412;
}

.admin-avatar-initials.admin-avatar-b--qt,
.admin-dt .admin-avatar-initials.admin-avatar-b--qt {
    background: #fce7f3;
    color: #9d174d;
}

.admin-avatar-initials.admin-avatar-b--uz,
.admin-dt .admin-avatar-initials.admin-avatar-b--uz {
    background: #fef3c7;
    color: #92400e;
}

/* —— Badges estado deuda —— */
.admin-badge-estado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.admin-badge-estado__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.admin-badge-estado--aldia {
    background: #f0faf4;
    color: var(--admin-success);
    border: 0.5px solid #b4e6c8;
}

.admin-badge-estado--aldia .admin-badge-estado__dot {
    background: #2ea864;
}

.admin-badge-estado--endeuda {
    background: #fff0f0;
    color: #c03030;
    border: 0.5px solid #f5c0c0;
}

.admin-badge-estado--endeuda .admin-badge-estado__dot {
    background: #e05050;
}

.admin-badge-estado--atrasos {
    background: #fff5f0;
    color: #c05020;
    border: 0.5px solid #f5c8a0;
}

.admin-badge-estado--atrasos .admin-badge-estado__dot {
    background: #e07030;
}

/* —— Montos —— */
.admin-monto-pos {
    color: var(--admin-success);
    font-weight: 500;
}

.admin-monto-neg {
    color: #d43f3f;
    font-weight: 500;
}

.admin-monto-zero {
    color: var(--admin-success);
    font-weight: 500;
}

/* —— Referencia / Nº factura pill —— */
.admin-ref-pill {
    display: inline-block;
    background: #f0f4fa;
    color: #4a6080;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 500;
}

.admin-cell-empty {
    color: #bec8d4;
    font-weight: 500;
}

/* —— Pills categorización (Nivel, Tipo, Categoría, etc.) —— */
.admin-pill-cat {
    display: inline-block;
    background: #f0f4fa;
    color: #4a6080;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Transacciones: unificar pills de categorización al mismo gris */
.txn-page .txn-pill-cat,
.txn-page .txn-pill-sub,
.txn-page .txn-pill-sub2,
.txn-page .txn-pill-caja {
    background: #f0f4fa;
    color: #4a6080;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
}
