/* ============================================
   DATATABLES STYLES - AGL THEME
   ============================================ */

/* ===== BASE TABLE STRUCTURE ===== */
table.dataTable {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0;
    white-space: nowrap;
    overflow-x: auto;
    display: block;
}

/* ===== HEADER STYLES ===== */
table.dataTable thead {
    background: #f8fafc;
}

table.dataTable thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    padding: 14px 16px;
    border-bottom: none !important;
    background: #f8fafc;
    white-space: normal;
    max-width: 150px !important;
    word-wrap: break-word;
}

table.dataTable thead th:first-child {
    border-radius: 8px 0 0 8px;
}

table.dataTable thead th:last-child {
    border-radius: 0 8px 8px 0;
}

/* Header sorting indicators */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    background-image: none !important;
    position: relative;
    padding-right: 24px;
}

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #94a3b8;
}

table.dataTable thead .sorting::after {
    content: "⇅";
    opacity: 0.4;
}

table.dataTable thead .sorting_asc::after {
    content: "↑";
    opacity: 1;
    color: #3b82f6;
}

table.dataTable thead .sorting_desc::after {
    content: "↓";
    opacity: 1;
    color: #3b82f6;
}

/* ===== BODY / ROW STYLES ===== */
table.dataTable tbody tr {
    background: #fff;
    transition: background 0.15s ease;
}

table.dataTable tbody tr:hover {
    background: #f8fafc;
}

table.dataTable.table-striped tbody tr.odd,
table.dataTable.table-striped tbody tr.even,
table.dataTable tbody tr.odd,
table.dataTable tbody tr.even {
    background: #fff;
}

table.dataTable.table-striped tbody tr.odd:hover,
table.dataTable.table-striped tbody tr.even:hover,
table.dataTable tbody tr.odd:hover,
table.dataTable tbody tr.even:hover {
    background: #f8fafc;
}

/* ===== CELL STYLES ===== */
table.dataTable tbody td {
    padding: 16px;
    font-size: 14px;
    border-top: none !important;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
    text-align: left;
}

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

table.dataTable tbody td:first-child {
    font-weight: 500;
    color: #0f172a;
}

table.dataTable tbody td:nth-child(2) {
    font-weight: 600;
    color: #334155;
}

/* ===== INLINE VALUE + PERCENTAGE COMPONENT ===== */
.dt-val {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.dt-val-num {
    font-weight: 600;
    font-size: 15px;
    color: #1e293b;
}

.dt-val-pct {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
}

.dt-val-zero .dt-val-num,
.dt-val-zero .dt-val-pct {
    color: #9ca3af;
}

.dt-val-warn .dt-val-num {
    color: #f59e0b;
    font-weight: 600;
}

.dt-val-warn .dt-val-pct {
    color: #f59e0b;
    font-weight: 500;
}

.dt-val-alert .dt-val-num {
    color: #dc2626;
    font-weight: 700;
}

.dt-val-alert .dt-val-pct {
    color: #dc2626;
    font-weight: 600;
}

.dt-val-success .dt-val-num {
    color: #16a34a;
    font-weight: 600;
}

.dt-val-success .dt-val-pct {
    color: #16a34a;
    font-weight: 500;
}

/* ===== TOP ROW LAYOUT ===== */
.dataTables_wrapper .row:first-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 13px;
    color: #64748b;
    padding: 0;
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_filter {
    margin-left: auto;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== BUTTONS (Icon Style) ===== */
.dataTables_wrapper .dt-buttons {
    margin-left: 0.5rem;
    display: inline-flex;
    gap: 0.25rem;
}

.dataTables_wrapper .dt-buttons .btn {
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dt-buttons .btn:hover {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}

.dataTables_wrapper .dt-buttons .btn:active {
    background: #f1f5f9;
}

/* ===== BOTTOM ROW / PAGINATION ===== */
.dataTables_wrapper .row:last-child {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 16px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #64748b !important;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff !important;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #fff;
    border-color: #e2e8f0;
}

/* ===== LENGTH SELECTOR (if used) ===== */
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

/* ===== UTILITY CLASSES ===== */
table.dataTable th.dt-right,
table.dataTable td.dt-right {
    text-align: right;
}

table.dataTable th.dt-center,
table.dataTable td.dt-center {
    text-align: center;
}

table.dataTable td.dt-nowrap {
    white-space: nowrap;
}

/* ===== RESPONSIVE / MOBILE ===== */
@media (max-width: 767.98px) {
    .dataTables_wrapper .row:first-child {
        gap: 0.5rem;
    }
    
    .dataTables_wrapper .dataTables_info {
        font-size: 12px;
        flex: 0 0 100%;
        order: -1;
    }
    
    .dataTables_wrapper .dataTables_filter {
        margin-left: 0;
        flex: 1;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        padding: 6px 10px;
        font-size: 13px;
        width: 100%;
    }
    
    .dataTables_wrapper .dt-buttons .btn {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 12px 10px;
    }
    
    .dt-val {
        flex-direction: column;
        gap: 2px;
    }
    
    .dt-val-num {
        font-size: 14px;
    }
    
    .dt-val-pct {
        font-size: 11px;
    }
}

@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_info {
        font-size: 11px;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .dataTables_wrapper .dt-buttons .btn {
        padding: 5px 7px;
        font-size: 13px;
    }
    
    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .dt-val-num {
        font-size: 13px;
    }
    
    .dt-val-pct {
        font-size: 10px;
    }
}
 /* Force single row layout */
.dt-top-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dt-top-row .dataTables_info {
    padding: 0;
    font-size: 13px;
    color: #64748b;
}

.dt-top-row .dataTables_filter {
    margin-left: auto;
}

.dt-top-row .dt-buttons {
    display: inline-flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
}