
/* ===============================
   DataTables — Polished Theme
   =============================== */

/* ── Table base ─────────────────────────────────── */
.d-table {
    border-collapse: separate !important;
    border-spacing: 0;
    width: 100% !important;
    font-size: 13.5px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* ── Header ─────────────────────────────────────── */
.d-table thead th {
    background: linear-gradient(135deg, #3c5272 0%, #4a6289 100%);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: none;
    padding: 14px 16px !important;
    text-align: center !important;
    vertical-align: middle;
    border-bottom: 2px solid #2d3f57 !important;
    white-space: nowrap;
    position: relative;
}

.d-table thead th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #c9a227;
    transition: width 0.3s ease;
}

.d-table thead th:hover::after {
    width: 80%;
}

table.dataTable.table-bordered thead th {
    border-top: none !important;
    border-left: 1px solid rgba(255,255,255,0.1) !important;
    border-right: 1px solid rgba(255,255,255,0.1) !important;
}

table.dataTable.table-bordered thead th:first-child {
    border-left: none !important;
}

table.dataTable.table-bordered thead th:last-child {
    border-right: none !important;
}

/* ── Body cells ─────────────────────────────────── */
.d-table th,
.d-table td {
    text-align: center !important;
    vertical-align: middle;
}

.d-table tbody td {
    padding: 12px 16px !important;
    font-size: 13.5px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9 !important;
    border-right: 1px solid #f8fafc !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.d-table tbody td:last-child {
    border-right: none !important;
}

.d-table td:first-child {
    white-space: nowrap;
    font-weight: 500;
}

/* ── Alternating rows ───────────────────────────── */
.d-table.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #ffffff;
}

.d-table.table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: #f8fafc;
}

/* ── Row hover ──────────────────────────────────── */
.d-table tbody tr {
    transition: all 0.2s ease;
}

.d-table tbody tr:hover > td {
    background-color: #eef2ff !important;
    color: #1e293b;
}

/* Subtle left accent on hover */
.d-table tbody tr:hover > td:first-child {
    box-shadow: inset 3px 0 0 #3c5272;
}

/* ── Timestamp / N-A cells ──────────────────────── */
.ts-cell {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
}

.ts-na {
    display: inline-block;
    font-size: 13px;
    color: #cbd5e1;
    font-weight: 500;
}

/* ===============================
   DataTables Controls (Top Bar)
   =============================== */

.dataTables_wrapper {
    width: 100%;
    padding: 4px 0;
}

/* Layout */
.dataTables_length,
.dataTables_filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: 500;
    font-size: 13px;
    color: #64748b;
}

/* Align left / right */
.dataTables_length {
    float: left;
}

.dataTables_filter {
    float: right;
}

/* Labels */
.dataTables_length label,
.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    white-space: nowrap;
}

/* Select dropdown */
.dataTables_length select {
    min-width: 70px;
    padding: 6px 28px 6px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    font-size: 13px;
    color: #334155;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Search input */
.dataTables_filter input {
    width: 240px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fafbfd;
    font-size: 13px;
    color: #334155;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.dataTables_filter input::placeholder {
    color: #94a3b8;
}

/* Focus states */
.dataTables_length select:focus,
.dataTables_filter input:focus {
    outline: none;
    background: #ffffff;
    border-color: #3c5272;
    box-shadow: 0 0 0 3px rgba(60, 82, 114, 0.12);
}

/* ── Pagination ─────────────────────────────────── */
.dataTables_paginate {
    margin-top: 14px !important;
    padding-top: 12px !important;
    border-top: 1px solid #f1f5f9;
}

.dataTables_paginate .paginate_button {
    padding: 6px 12px !important;
    margin: 0 2px !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #475569 !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

.dataTables_paginate .paginate_button:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06) !important;
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #3c5272, #4a6289) !important;
    border-color: #3c5272 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(60, 82, 114, 0.3) !important;
}

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

/* ── Info text ──────────────────────────────────── */
.dataTables_info {
    font-size: 12.5px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 10px;
}

/* ── Empty table ────────────────────────────────── */
.dataTables_empty {
    padding: 40px 20px !important;
    text-align: center !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

/* ── Processing indicator ───────────────────────── */
.dataTables_processing {
    background: rgba(255,255,255,0.92) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
    padding: 16px 24px !important;
    font-size: 13px !important;
    color: #3c5272 !important;
    font-weight: 600 !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .dataTables_length,
    .dataTables_filter {
        float: none;
        justify-content: space-between;
        margin-bottom: 10px;
    }

    .dataTables_filter input {
        width: 100%;
    }

    .d-table thead th {
        padding: 10px 10px !important;
        font-size: 10.5px;
    }

    .d-table tbody td {
        padding: 10px 10px !important;
        font-size: 12.5px;
    }
}

/* ── Table header section ───────────────────────── */
.table-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.table-header i {
    font-size: 1.5rem;
    color: #3c5272;
}

.table-header h3 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
    font-size: 1.15rem;
}

/* ── Export buttons ─────────────────────────────── */
.dt-button {
    border: 1px solid #e2e8f0 !important;
    background-color: #ffffff !important;
    color: #475569 !important;
    padding: 6px 18px !important;
    margin-left: 6px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease-in-out;
}

.dt-button:hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06) !important;
}

.buttons-copy {
    border-color: #bfdbfe !important;
    color: #2563eb !important;
    background-color: #eff6ff !important;
}
.buttons-copy:hover {
    background-color: #2563eb !important;
    color: white !important;
    border-color: #2563eb !important;
}

.buttons-csv {
    border-color: #bbf7d0 !important;
    color: #16a34a !important;
    background-color: #f0fdf4 !important;
}
.buttons-csv:hover {
    background-color: #16a34a !important;
    color: white !important;
    border-color: #16a34a !important;
}

.buttons-excel {
    border-color: #a7f3d0 !important;
    color: #059669 !important;
    background-color: #ecfdf5 !important;
}
.buttons-excel:hover {
    background-color: #059669 !important;
    color: white !important;
    border-color: #059669 !important;
}

.buttons-pdf {
    border-color: #fecaca !important;
    color: #dc2626 !important;
    background-color: #fef2f2 !important;
}
.buttons-pdf:hover {
    background-color: #dc2626 !important;
    color: white !important;
    border-color: #dc2626 !important;
}

.buttons-print {
    border-color: #ddd6fe !important;
    color: #7c3aed !important;
    background-color: #f5f3ff !important;
}
.buttons-print:hover {
    background-color: #7c3aed !important;
    color: white !important;
    border-color: #7c3aed !important;
}
