/* ─── Table Styling ─── */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
    background: var(--bs-body-bg);
}

.table thead th {
    background: transparent;
    color: var(--bs-body-color);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 1.2rem 1rem;
    position: relative;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.table thead th::after {
    display: none;
}

.table thead th i {
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.table tbody tr {
    border: none;
    background: var(--bs-body-bg);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

/* Ensure ID and name columns always have blue text */

.table tbody td:first-child,
.table tbody td:nth-child(2),
.table tbody td.fw-semibold.text-primary {
    font-weight: 600 !important;
    color: var(--bs-primary) !important;
}

/* Dark mode - force ID and name text to remain blue */
[data-bs-theme="dark"] .table tbody td:first-child,
[data-bs-theme="dark"] .table tbody td:nth-child(2),
[data-bs-theme="dark"] .table tbody td.fw-semibold.text-primary {
    color: #00ccff !important;
}

/* Zebra striping (light mode) */
.table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.08);
}

.table tbody tr:nth-child(odd) {
    background-color: var(--bs-body-bg);
}

.table-striped>tbody>tr:nth-of-type(odd) {
    background-color: rgba(var(--bs-primary-rgb), 0.08);
}

.table-striped>tbody>tr:nth-of-type(even) {
    background-color: var(--bs-body-bg);
}

/* Simple hover effects - slight scale for rows */
.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
    cursor: pointer;
    transform: scale(1.01);
}

.table tbody tr:hover .actions-col .btn {
    opacity: 1; /* retain for backward compatibility; default is already 1 */
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table tbody td:first-child {
    font-weight: 600;
    color: var(--bs-primary);
}

/* Action column styling */
.actions-col {
    text-align: center;
    width: 120px;
}

.actions-col .btn {
    opacity: 1; /* ensure action buttons are not dim by default */
    transition: all 0.2s ease;
}

/* Table responsive enhancements */
.table-responsive {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}



/* ─── DataTables Dark Mode ─── */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter label {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 0.75rem;
}

/* Ensure DataTables info and pagination are aligned in one row */
.dataTables_wrapper .row {
    display: flex;
    align-items: center;
    margin: 0;
}

.dataTables_wrapper .dataTables_info {
    display: flex;
    align-items: center;
}

.dataTables_wrapper .dataTables_paginate {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* ─── Enhanced Table Styling ─── */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
    background: var(--bs-body-bg);
}

.table thead th {
    background: transparent;
    color: var(--bs-body-color);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 1.2rem 1rem;
    position: relative;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Dark mode - force ALL table headers to be white */
[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] table thead th,
[data-bs-theme="dark"] thead th,
[data-bs-theme="dark"] th {
    color: #ffffff !important;
    background: transparent !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

.table thead th::after {
    display: none;
}

.table thead th i {
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.table tbody tr {
    border: none;
    background: var(--bs-body-bg);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

/* Zebra striping */
.table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table tbody tr:nth-child(odd) {
    background-color: var(--bs-body-bg);
}

/* Simple hover effects - slight scale for rows */
.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
    cursor: pointer;
    transform: scale(1.01);
}

.table tbody tr:hover .actions-col .btn {
    opacity: 1; /* retain for backward compatibility; default is already 1 */
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table tbody td:first-child {
    font-weight: 600;
    color: var(--bs-primary);
}

/* Action column styling */
.actions-col {
    text-align: center;
    width: 120px;
}

.actions-col .btn {
    opacity: 1; /* ensure action buttons are not dim by default */
    transition: all 0.2s ease;
}

/* Table responsive enhancements */
.table-responsive {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}



/* Dark mode table enhancements */
[data-bs-theme="dark"] .table {
    background-color: #08151d !important;
}

[data-bs-theme="dark"] .table thead th {
    background: transparent !important;
    color: #ffffff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* NUCLEAR DATATABLES OVERRIDE - Use box-shadow like DataTables does */
[data-bs-theme="dark"] table.dataTable.table-striped>tbody>tr.odd>*,
[data-bs-theme="dark"] table.dataTable.table-striped>tbody>tr:nth-child(odd)>*,
[data-bs-theme="dark"] .table-striped>tbody>tr:nth-child(odd)>*,
[data-bs-theme="dark"] .table tbody tr:nth-child(odd)>* {
    box-shadow: inset 0 0 0 9999px #101c26 !important;
}

[data-bs-theme="dark"] table.dataTable.table-striped>tbody>tr.even>*,
[data-bs-theme="dark"] table.dataTable.table-striped>tbody>tr:nth-child(even)>*,
[data-bs-theme="dark"] .table-striped>tbody>tr:nth-child(even)>*,
[data-bs-theme="dark"] .table tbody tr:nth-child(even)>* {
    box-shadow: inset 0 0 0 9999px #172635 !important;
}

/* Remove column border on hover in dark mode */
[data-bs-theme="dark"] .table tbody tr:hover td,
[data-bs-theme="dark"] .table-striped>tbody>tr:hover>td,
[data-bs-theme="dark"] table.dataTable.table-striped>tbody>tr:hover>td {
    border-color: transparent !important;
}

[data-bs-theme="dark"] .table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-bs-theme="dark"] .table tbody tr:nth-child(odd) {
    background-color: var(--bs-dark);
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.15) !important;
    transform: scale(1.01);
}

[data-bs-theme="dark"] .table tbody td {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Table loading animation */
.table-loading {
    position: relative;
    overflow: hidden;
}

.table-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
    animation: table-shimmer 1.5s infinite;
}

@keyframes table-shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.table td {
    padding: 0.9rem 0.75rem;
    vertical-align: middle;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Enhanced striped rows */
.table-striped>tbody>tr:nth-of-type(odd) {
    background-color: rgba(var(--bs-primary-rgb), 0.02);
}

.table-striped>tbody>tr:nth-of-type(even) {
    background-color: var(--bs-body-bg);
}

/* Dark mode table enhancements */
[data-bs-theme="dark"] .table thead th {
    background: transparent !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.15) !important;
    transform: scale(1.01);
}

[data-bs-theme="dark"] .table td {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03);
}

[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(even) {
    background-color: var(--bs-body-bg);
}

/* Dark mode - force ALL table body text to be white */
[data-bs-theme="dark"] .table tbody td,
[data-bs-theme="dark"] table tbody td,
[data-bs-theme="dark"] tbody td,
[data-bs-theme="dark"] td {
    color: #ffffff !important;
}

/* Clickable row styling */
.clickable-row:hover {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.clickable-row {
    transition: background-color 0.2s ease;
}

body[data-bs-theme="dark"] .clickable-row:hover {
    background-color: rgba(13, 110, 253, 0.2) !important;
}