/* Custom DataTables Styling */

/* Fix DataTables Bootstrap 5 Integration */
.dataTables_wrapper .dataTables_paginate .pagination {
    margin-bottom: 0;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 0.85em;
}

.dataTables_wrapper .dataTables_length {
    padding-top: 0.25em;
}

/* Responsive table adjustments */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    top: 50%;
    transform: translateY(-50%);
}

/* Loading overlay */
.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    margin-left: -100px;
    margin-top: -26px;
    text-align: center;
    padding: 1em 0;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Search input styling */
.dataTables_filter input {
    margin-left: 0.5em;
    display: inline-block;
    width: auto;
}

/* Table header styling */
table.dataTable thead th {
    border-bottom: 2px solid #dee2e6;
}

/* Sorting icons alignment */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    bottom: 0.5em;
}

/* Row hover effect */
table.dataTable tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Action buttons spacing */
table.dataTable tbody td .btn + .btn {
    margin-left: 0.25rem;
}

/* Pagination button styling */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.5rem;
    margin-left: 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white !important;
}

/* Fix Select2 inside DataTables */
.dataTables_wrapper .select2-container {
    width: 100% !important;
}

/* Fix for empty table message */
table.dataTable tbody td.dataTables_empty {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* Mobile responsive adjustments */
@media screen and (max-width: 767px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 1rem;
    }
}