/* DataTables Custom Styling for TraxFlow Dark Theme */

/* DataTables Wrapper */
.dataTables_wrapper {
    color: var(--text-primary);
}

/* Table Styling */
table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
}

table.dataTable thead th,
table.dataTable thead td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light) !important;
    background: var(--bg-card-darker);
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

table.dataTable tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

table.dataTable tbody tr {
    background: transparent;
    transition: background var(--transition-fast);
}

table.dataTable tbody tr:hover {
    background: var(--bg-hover) !important;
}

table.dataTable tbody tr.odd {
    background: transparent;
}

table.dataTable tbody tr.even {
    background: transparent;
}

/* Sorting Icons */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 30px;
}

table.dataTable thead .sorting::before,
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::before,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::before,
table.dataTable thead .sorting_desc::after {
    position: absolute;
    right: 10px;
    font-size: 10px;
    opacity: 0.3;
}

table.dataTable thead .sorting::before,
table.dataTable thead .sorting_asc::before,
table.dataTable thead .sorting_desc::before {
    content: '\25B2';
    top: 50%;
    transform: translateY(-80%);
}

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    content: '\25BC';
    top: 50%;
    transform: translateY(0%);
}

table.dataTable thead .sorting_asc::before {
    opacity: 1;
    color: var(--accent-cyan);
}

table.dataTable thead .sorting_desc::after {
    opacity: 1;
    color: var(--accent-cyan);
}

/* Search Box */
.dataTables_filter {
    margin-bottom: 16px;
}

.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dataTables_filter input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 250px;
    transition: all var(--transition-smooth);
}

.dataTables_filter input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.dataTables_filter input::placeholder {
    color: var(--text-muted);
}

/* Length Selector */
.dataTables_length {
    margin-bottom: 16px;
}

.dataTables_length label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dataTables_length select {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 80px;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.dataTables_length select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Info Text */
.dataTables_info {
    font-size: 13px;
    color: var(--text-muted);
    padding: 16px 0;
}

/* Pagination */
.dataTables_paginate {
    padding: 16px 0;
}

.dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    margin: 0 2px;
    background: var(--bg-input);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.dataTables_paginate .paginate_button:hover {
    background: var(--bg-card) !important;
    border-color: var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.15);
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, var(--accent-orange), #e09000) !important;
    border-color: var(--accent-orange) !important;
    color: #000 !important;
    font-weight: 600;
}

.dataTables_paginate .paginate_button.current:hover {
    background: linear-gradient(135deg, var(--accent-orange), #e09000) !important;
    box-shadow: 0 4px 20px rgba(245, 166, 35, 0.4);
}

.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
    background: var(--bg-card-darker) !important;
    border-color: var(--border-light) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

/* Header Layout */
.dt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.dt-header .dataTables_length,
.dt-header .dataTables_filter {
    margin-bottom: 0;
}

/* Footer Layout */
.dt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-top: 1px solid var(--border-light);
    margin-top: 16px;
}

.dt-footer .dataTables_info,
.dt-footer .dataTables_paginate {
    padding: 16px 0;
}

/* Processing Indicator */
.dataTables_processing {
    position: absolute !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-cyan);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    color: var(--accent-cyan);
    font-size: 14px;
    font-weight: 500;
    z-index: 100;
}

/* Empty Table */
.dataTables_empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Loading Spinner */
.dt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.dt-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Server-side DataTables specific */
table.dataTable.dt-server tbody {
    position: relative;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dt-header,
    .dt-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .dataTables_filter input {
        min-width: 100%;
    }

    .dataTables_paginate .paginate_button {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }
}

/* DataTables with custom filter form */
.dt-custom-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
    padding: 18px 24px;
    background: var(--bg-card-darker);
    border-bottom: 1px solid var(--border-light);
}

.dt-custom-filters .filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dt-custom-filters .filter-item label {
    font-size: 11px;
    margin-bottom: 0;
}

.dt-custom-filters .filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* Hide default search when using custom filters */
.dt-custom-search .dataTables_filter {
    display: none;
}

/* Action buttons in table */
.dt-actions {
    display: flex;
    gap: 8px;
}

.dt-actions .btn {
    white-space: nowrap;
}
