/* ===== Modern Styles for DataTables ===== */

/* Wrapper */
.dataTables_wrapper {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #374151;
}

/* Base table */
table.dataTable {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    border: 1px solid #E5E7EB;
}

/* Table header */
table.dataTable thead th {
    background: #F9FAFB !important;
    color: #374151 !important;
    font-weight: 600;
    font-size: 14px;
    padding: 16px 12px;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
    position: relative;
}

table.dataTable thead th:first-child {
    border-top-left-radius: 12px;
}

table.dataTable thead th:last-child {
    border-top-right-radius: 12px;
}

/* Table body cells */
table.dataTable tbody td {
    padding: 16px 12px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 14px;
    color: #374151;
    vertical-align: middle;
}

table.dataTable tbody tr:last-child td {
    border-bottom: none;
}

table.dataTable tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

table.dataTable tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

/* Row hover */
table.dataTable tbody tr:not(.selected):hover td {
    box-shadow: inset 0 0 0 9999px #F9FAFB !important;
    transition: background-color 0.2s ease;
}

/* Selected row */
/*table.table.dataTable>tbody>tr.selected>* {*/
/*    box-shadow: inset 0 0 0 9999px #F9FAFB !important;*/
/*    color: #374151;*/
/*}*/

/* ===== Buttons ===== */
/*.dt-buttons {*/
/*    margin-bottom: 16px;*/
/*}*/

.dt-buttons .btn {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    color: #374151;
    border-radius: 6px !important;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-right: 6px;
    margin-bottom: 6px;
    line-height: 1.4;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

div.dt-buttons div.dropdown-menu,
div.dt-buttons ul.dropdown-menu {
    width: 230px;
}

.dt-buttons .btn:hover {
    background: #F9FAFB;
    border-color: #6366F1;
    /*color: #6366F1;*/
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

.dt-buttons .btn:active {
    transform: translateY(0);
}

/* Button variants */
.dt-buttons .btn-primary {
    background: #6366F1;
    border-color: #6366F1;
    color: #ffffff;
}

.dt-buttons .btn-primary:hover {
    background: #4F46E5;
    border-color: #4F46E5;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.dt-buttons .btn-secondary:hover {
    color: #6366F1;
}

.dt-buttons .btn-secondary:active {
    border-color: #6366F1;
    color: #6366F1;
    background: transparent;
}

.dt-buttons .btn-success {
    background: #10B981;
    border-color: #10B981;
    color: #ffffff;
}

.dt-buttons .btn-success:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.dt-buttons .btn-danger {
    background: #EF4444;
    border-color: #EF4444;
    color: #ffffff;
}

.dt-buttons .btn-danger:hover {
    background: #DC2626;
    border-color: #DC2626;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.dt-buttons .btn-warning {
    background: #F59E0B;
    border-color: #F59E0B;
    color: #ffffff;
}

.dt-buttons .btn-warning:hover {
    background: #D97706;
    border-color: #D97706;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.dt-buttons .btn-info {
    background: #06B6D4;
    border-color: #06B6D4;
    color: #ffffff !important;
}

.dt-buttons .btn-info:hover {
    background: #0891B2;
    border-color: #0891B2;
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}

/* Collection dropdown */
.dt-button-collection {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    padding: 6px 0;
    min-width: 120px;
}

.dt-button-collection .dt-button {
    background: transparent;
    border: none;
    color: #374151;
    /*padding: 6px 12px;*/
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    margin: 0;
    border-radius: 0;
}

.dt-button-collection .dt-button:hover {
    background: #F9FAFB;
    color: #6366F1;
}

.dt-button-collection-title {
    border-bottom: 1px solid #E5E7EB;
}

/* ===== Length control ===== */
.dataTables_wrapper .dataTables_length {
    margin-bottom: 16px;
}

.dataTables_wrapper .dataTables_length label {
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #E5E7EB;
    border-radius: 5px;
    padding: 4px 8px;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    margin: 0 6px;
    min-height: 28px;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* ===== Search filter ===== */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 16px;
}

.dataTables_wrapper .dataTables_filter label {
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 6px 10px;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    margin-left: 6px;
    transition: all 0.2s ease;
    min-height: 28px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* ===== Table info ===== */
.dataTables_wrapper .dataTables_info {
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
    margin-top: 16px;
}

/* ===== Pagination ===== */
/* ——— REAJUSTE PAGINACIÓN DATATABLES ——— */
.dataTables_wrapper .dataTables_paginate {
    display: flex; /* para que gap funcione */
    justify-content: center;
    align-items: center;
    margin-top: 16px; /* igual que antes */
    gap: 4px; /* espacio uniforme entre botones */
}

.dataTables_wrapper .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    min-height: 28px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.2s ease;
    margin: 0; /* el gap ya lo hace el contenedor */
}

.dataTables_wrapper .paginate_button:hover {
    background: #F9FAFB;
    border-color: #6366F1;
    color: #6366F1;
}

.dataTables_wrapper .paginate_button.current,
.dataTables_wrapper .paginate_button.active {
    background: #6366F1;
    border-color: #6366F1;
    color: #ffffff;
}

.dataTables_wrapper .paginate_button.disabled {
    background: #F9FAFB;
    border-color: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
}

/* ——— SI USAS BOOTSTRAP PAGINATION (page-link/page-item) ——— */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px; /* espacio entre .page-link */
    margin-top: 16px;
}

.page-link {
    padding: 6px 10px;
    font-weight: 500;
    font-size: 13px;
    color: #374151;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.page-link:hover,
.page-link:focus {
    background: #F9FAFB;
    border-color: #6366F1;
    color: #6366F1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.page-item.active .page-link {
    background: #6366F1;
    border-color: #6366F1;
    color: #ffffff;
}

.page-item.disabled .page-link {
    background: #F9FAFB;
    border-color: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
}


/* ===== Processing overlay ===== */
.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #374151 !important;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #E5E7EB;
    font-weight: 500;
    font-size: 13px;
}

/* ===== “No data” message ===== */
.dataTables_wrapper .dataTables_empty {
    color: #6B7280;
    font-style: italic;
    padding: 32px 16px;
    text-align: center;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 768px) {
    table.dataTable {
        font-size: 12px;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 8px 6px;
    }

    .dt-buttons .btn {
        padding: 6px 12px;
        font-size: 12px;
        margin-right: 4px;
        margin-bottom: 4px;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: center;
        margin-bottom: 12px;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        margin-top: 12px;
    }
}

/* ===== “Card” layout ===== */
table.dataTable.cards {
    border: none;
    box-shadow: none;
    background: transparent;
}

table.dataTable.cards thead {
    display: none;
}

table.dataTable.cards tbody {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
}

table.dataTable.cards tbody tr {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    min-width: 280px;
    flex: 0 0 280px;
    overflow: hidden;
}

table.dataTable.cards tbody tr:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

table.dataTable.cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #F3F4F6;
}

table.dataTable.cards tbody td:last-child {
    border-bottom: none;
}

table.dataTable.cards tbody td:before {
    content: attr(data-label);
    color: #6B7280;
    font-weight: 600;
    margin-right: 12px;
    min-width: 80px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Sorting icons ===== */
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #9CA3AF;
}

table.dataTable thead th.sorting:after {
    content: "↕";
}

table.dataTable thead th.sorting_asc:after {
    content: "↑";
    color: #6366F1;
}

table.dataTable thead th.sorting_desc:after {
    content: "↓";
    color: #6366F1;
}

/* ===== Form-check inputs ===== */
table.dataTable tbody td .form-check-input {
    margin: 0;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    width: 16px;
    height: 16px;
}

table.dataTable tbody td .form-check-input:checked {
    background-color: #6366F1;
    border-color: #6366F1;
}

/* ===== Action buttons ===== */
table.dataTable tbody td .btn-action {
    background: transparent;
    border: none;
    color: #6B7280;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
}

table.dataTable tbody td .btn-action:hover {
    background: #F9FAFB;
    color: #6366F1;
}

table.dataTable tbody td .btn-action.btn-edit:hover {
    color: #10B981;
}

table.dataTable tbody td .btn-action.btn-delete:hover {
    color: #EF4444;
}

table.dataTable tbody td .btn-action.btn-view:hover {
    color: #06B6D4;
}

/* ===== Badges ===== */
table.dataTable tbody td .badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
}

table.dataTable tbody td .badge.badge-success {
    background: #ECFDF5;
    color: #065F46;
}

table.dataTable tbody td .badge.badge-warning {
    background: #FFFBEB;
    color: #92400E;
}

table.dataTable tbody td .badge.badge-danger {
    background: #FEF2F2;
    color: #991B1B;
}

table.dataTable tbody td .badge.badge-info {
    background: #ECFEFF;
    color: #0E7490;
}

table.dataTable tbody td .badge.badge-secondary {
    background: #F9FAFB;
    color: #374151;
}

/* ===== Avatars ===== */
table.dataTable tbody td .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E5E7EB;
}

/* ===== Tooltips ===== */
table.dataTable tbody td [data-bs-toggle="tooltip"] {
    cursor: help;
}

/* ===== Dropdowns en table ===== */
table.dataTable tbody td .dropdown-menu {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    padding: 8px 0;
}

table.dataTable tbody td .dropdown-item {
    color: #374151;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

table.dataTable tbody td .dropdown-item:hover {
    background: #F9FAFB;
    color: #6366F1;
}

table.dataTable tbody td .dropdown-item.danger:hover {
    background: #FEF2F2;
    color: #EF4444;
}

/* ===== DataTable ColumnControl ===== */
div.dtcc-dropdown div.dtcc-list div.dtcc-list-buttons {
    background: inherit;
}

/* No se puede cambiar el hover en este caso porque lo pone por defecto el navegador */
/*div.dtcc-dropdown div.dtcc-search>div select option:hover:not(:checked) {*/
/*    background-color: #F9FAFB;*/
/*    color: #222222;*/
/*}*/

div.dtcc-dropdown div.dtcc-search > div select option:checked, div.dtcc-dropdown div.dtcc-search > div input option {
    background-color: #6366F1;
}

/* ===== DataTable StateRestore ===== */
.dtsr-confirmation-title-row {
    border-bottom: 1px solid #E5E7EB;
}

.dtsr-confirmation-buttons {
    border-top: 1px solid #E5E7EB;
}

.dtsr-confirmation-button {
    margin-top: 1rem !important;
}

div.dtsr-confirmation div.dtsr-confirmation-buttons {
    margin-top: 0;
}

div.dtsr-confirmation-text {
    margin-bottom: 1.5rem !important;
}

/* ===== DataTable DateTime ===== */
div.dt-datetime table td.selectable.selected button {
    background: #6366F1;
    color: #ffffff;
}

div.dt-datetime table td.selectable:not(.selected) button:hover {
    background: inherit;
    transform: translateY(-1px);
    color: #444;
}

div.dt-datetime div.dt-datetime-label:hover {
    background-color: #f5f5f5;
    /*color: #ffffff;*/
    border-color: #f5f5f5;
    border-radius: 5px !important;
    transform: translateY(-1px);
    /*box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);*/
}


div.dt-datetime table td.selectable {
    margin: 1rem;
}

.dt-datetime-table {
    border-collapse: separate;
    border-spacing: 5px !important;
}

div.dt-datetime div.dt-datetime-iconLeft:hover, div.dt-datetime div.dt-datetime-iconRight:hover {
    background-color: #f5f5f5;
    border-color: #f5f5f5;
    border-radius: 5px !important;
    transform: translateY(-1px);
}

/* =======================
   Chips DataTables (base)
   ======================= */
.dt-filter-chips{
    display:flex;
    gap:.5rem;
    flex-wrap:wrap;
    align-items:center;
}

.dt-chip{
    display:inline-flex;
    align-items:center;
    gap:.4rem;
    padding:.25rem .6rem;
    border:1px solid var(--bs-border-color, #E5E7EB);
    border-radius:999px;
    background: #fff; /* light */
    color: var(--bs-body-color, #212529);
    font: 13px/1.2 system-ui, sans-serif;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.dt-chip:hover{
    border-color: var(--dm-brand, #6366f1);
    background-color: #f8f9fa; /* sutil en light */
}

.dt-chip:focus-within{
    outline:0;
    box-shadow:0 0 0 .2rem rgba(99,102,241,.20);
}

/* Etiqueta “Rol:” más tenue */
.dt-chip .dt-chip-label{
    opacity:.75;
}

/* Botón de cierre (×) con target cómodo */
.dt-chip .dt-chip-close{
    display:inline-grid;
    place-items:center;
    width:1.25rem;
    height:1.25rem;
    border-radius:50%;
    line-height:1;
    font-weight:700;
    cursor:pointer;
    color:#6b7280;
    transition:background-color .15s ease, color .15s ease;
}

.dt-chip .dt-chip-close:hover{
    background:#f1f3f5;
    color:#111;
}
