/* ====================================================
   CSS Variables – Light Theme (Professional)
   ==================================================== */
:root {
    --bg-body: #f0f4f8;
    --bg-main: #ffffff;
    --bg-sidebar: #1a2332;
    --bg-topbar: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e9edf2;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --table-header-bg: #f8fafc;
    --table-header-text: #1e293b;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --input-text: #1e293b;
    --accent: #4f8cf7;
    --accent-hover: #3a7bd5;
    --sidebar-text: #b0c4de;
    --sidebar-active: #ffffff;
    --sidebar-hover: #2a3a4a;
}

/* ====================================================
   Dark Theme – High Contrast
   ==================================================== */
[data-theme="dark"] {
    --bg-body: #0d1117;
    --bg-main: #161b22;
    --bg-sidebar: #0d1117;
    --bg-topbar: #161b22;
    --text-primary: #e6edf5;
    --text-secondary: #b0c4de;
    --text-muted: #8b9eb0;
    --border-color: #30363d;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --table-header-bg: #1c2333;
    --table-header-text: #e6edf5;
    --card-bg: #161b22;
    --input-bg: #0d1117;
    --input-text: #e6edf5;
    --accent: #4f8cf7;
    --accent-hover: #6b5bff;
    --sidebar-text: #8b9eb0;
    --sidebar-active: #ffffff;
    --sidebar-hover: #1c2333;
}

/* ====================================================
   Base
   ==================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ====================================================
   Sidebar – Dark Navy (like PayFlow)
   ==================================================== */
.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    transition: left 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}
.sidebar.mobile-open { left: 0; }

@media (min-width: 769px) {
    .sidebar {
        left: 0;
        width: 260px;
    }
    .sidebar.collapsed { width: 70px; }
    .sidebar.collapsed .sidebar-brand span,
    .sidebar.collapsed .sidebar-nav ul li a span,
    .sidebar.collapsed .sidebar-footer span { display: none; }
    .sidebar.collapsed .sidebar-nav ul li a i { margin-right: 0; }
}

.sidebar-brand {
    padding: 1.5rem 1.5rem 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.9rem;
}
.sidebar-nav ul li a i {
    width: 24px;
    text-align: center;
    margin-right: 12px;
    font-size: 1.1rem;
}
.sidebar-nav ul li a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-active);
}
.sidebar-nav ul li.active a {
    background: var(--sidebar-hover);
    color: var(--sidebar-active);
    border-left-color: var(--accent);
}
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-footer a {
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}
.sidebar-footer a:hover {
    color: var(--sidebar-active);
}

/* ====================================================
   Main Content
   ==================================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    background: var(--bg-body);
}
@media (min-width: 769px) {
    .main-content { margin-left: 260px; }
    .sidebar.collapsed ~ .main-content { margin-left: 70px; }
}
@media (max-width: 768px) {
    .main-content { margin-left: 0 !important; width: 100%; }
}

/* ====================================================
   Topbar – White with Shadow (like PayFlow)
   ==================================================== */
.topbar {
    background: var(--bg-topbar);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 999;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.topbar-center .page-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: 0.2s;
    font-size: 1.1rem;
    position: relative;
}
.btn-icon:hover {
    background: rgba(79, 140, 247, 0.08);
    color: var(--text-primary);
}
.btn-icon .badge {
    font-size: 0.55rem;
    padding: 0.15rem 0.35rem;
}

/* ====================================================
   Content Area
   ==================================================== */
.content {
    padding: 1.5rem;
    flex: 1;
}

/* ====================================================
   Cards – White with Subtle Shadow
   ==================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
.card-body {
    padding: 1.25rem;
}
.card-title {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.3rem 0;
}
.card-trend {
    font-size: 0.8rem;
}
.card-trend.up { color: #10b981; }
.card-trend.down { color: #ef4444; }

/* ====================================================
   Tables – Clean, Readable
   ==================================================== */
.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
}
.table {
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}
.table thead th {
    background: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
    padding: 0.7rem 0.8rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.table tbody td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.table-hover tbody tr:hover {
    background: rgba(79, 140, 247, 0.04);
}
.table .text-muted {
    color: var(--text-muted) !important;
}

/* ====================================================
   Dark Mode Table Overrides (fix readability)
   ==================================================== */
[data-theme="dark"] .table {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .table thead th {
    background: var(--table-header-bg) !important;
    color: var(--table-header-text) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .table tbody td {
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) {
    background-color: transparent !important;
}

[data-theme="dark"] .table-hover > tbody > tr:hover {
    background-color: rgba(79, 140, 247, 0.08) !important;
}

[data-theme="dark"] .table .text-muted {
    color: var(--text-muted) !important;
}

/* Ensure links and badges inside tables are visible */
[data-theme="dark"] .table a:not(.btn) {
    color: var(--accent) !important;
}
[data-theme="dark"] .table a:not(.btn):hover {
    color: var(--accent-hover) !important;
}

/* ====================================================
   Forms
   ==================================================== */
.form-control, .form-select {
    background: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--input-text) !important;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: 0.2s;
}
.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(79, 140, 247, 0.15) !important;
}
.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

/* ====================================================
   Buttons
   ==================================================== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    transition: 0.2s;
    border: none;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(79, 140, 247, 0.3);
}
.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-sm {
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
}
.btn-outline-secondary {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

/* ====================================================
   Dropdowns
   ==================================================== */
.dropdown-menu {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.dropdown-item {
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.4rem 1.2rem;
}
.dropdown-item:hover {
    background: rgba(79, 140, 247, 0.06);
}
.dropdown-header {
    color: var(--text-secondary);
}
.dropdown-divider {
    border-color: var(--border-color);
}
.dropdown-item-text {
    color: var(--text-primary);
}

/* ====================================================
   Auth Pages
   ==================================================== */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-body);
}
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.auth-card .brand {
    text-align: center;
    margin-bottom: 1.8rem;
}
.auth-card .brand i {
    font-size: 2.8rem;
    color: var(--accent);
}
.auth-card .brand h3 {
    font-weight: 700;
    margin-top: 0.4rem;
    color: var(--text-primary);
}
.auth-card .brand p {
    color: var(--text-secondary);
}
.auth-card .text-muted {
    color: var(--text-muted) !important;
}
.auth-card a {
    color: var(--accent);
    text-decoration: none;
}
.auth-card a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ====================================================
   Mobile Overlay
   ==================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
}
.sidebar-overlay.active {
    display: block;
}

/* ====================================================
   Responsive Adjustments
   ==================================================== */
@media (max-width: 768px) {
    .topbar { padding: 0.4rem 0.8rem; }
    .topbar-center .page-title { font-size: 0.95rem; }
    .content { padding: 0.8rem; }
    .card-value { font-size: 1.4rem; }
    .table { font-size: 0.8rem; }
    .table thead th, .table tbody td { padding: 0.4rem 0.5rem; }
    .btn { font-size: 0.8rem; padding: 0.25rem 0.7rem; }
    .form-control, .form-select { font-size: 0.85rem; padding: 0.35rem 0.6rem; }
    .auth-card { padding: 1.5rem; }
}

@media (max-width: 576px) {
    .topbar-center .page-title { font-size: 0.8rem; }
    .btn-icon { font-size: 0.9rem; padding: 0.15rem 0.25rem; }
    .card-body { padding: 0.8rem; }
}

/* ====================================================
   Misc Utilities
   ==================================================== */
.text-muted { color: var(--text-muted) !important; }
.badge {
    color: #fff;
}
.alert {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.alert-success { border-color: #10b981; }
.alert-danger { border-color: #ef4444; }
.alert-warning { border-color: #fbbf24; }
.alert-info { border-color: var(--accent); }

/* ====================================================
   DataTables (if used)
   ==================================================== */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary) !important;
}
.dataTables_wrapper .dataTables_filter input {
    background: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--input-text) !important;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #4f8cf7 !important;
    border-color: #4f8cf7 !important;
}
/* ====================================================
   Custom Table – No Bootstrap Classes
   ==================================================== */
.table-custom {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    border-radius: 12px;
    overflow: hidden;
}

.table-custom thead th {
    background: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
    padding: 0.7rem 0.8rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: left;
}

.table-custom tbody td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Striped rows */
.table-custom tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Hover rows */
.table-custom tbody tr:hover {
    background-color: rgba(79, 140, 247, 0.05);
}

/* ====================================================
   Dark Mode Overrides for Custom Table
   ==================================================== */
[data-theme="dark"] .table-custom {
    background: var(--card-bg) !important;
}

[data-theme="dark"] .table-custom thead th {
    background: var(--table-header-bg) !important;
    color: var(--table-header-text) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .table-custom tbody td {
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .table-custom tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .table-custom tbody tr:nth-of-type(even) {
    background-color: transparent !important;
}

[data-theme="dark"] .table-custom tbody tr:hover {
    background-color: rgba(79, 140, 247, 0.10) !important;
}

[data-theme="dark"] .table-custom .text-muted {
    color: var(--text-muted) !important;
}

/* DataTables integration with custom table */
[data-theme="dark"] .dataTables_wrapper .table-custom {
    background: var(--card-bg) !important;
}

[data-theme="dark"] .dataTables_wrapper .table-custom thead th {
    background: var(--table-header-bg) !important;
    color: var(--table-header-text) !important;
}

[data-theme="dark"] .dataTables_wrapper .table-custom tbody td {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_wrapper .table-custom tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .dataTables_wrapper .table-custom tbody tr:hover {
    background-color: rgba(79, 140, 247, 0.10) !important;
}

/* Ensure DataTable controls are styled */
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--input-text) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--input-text) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter {
    color: var(--text-secondary) !important;
}
/* ====================================================
   Custom DataTable Styles (No Bootstrap classes)
   ==================================================== */

/* Wrapper */
.dataTables_wrapper {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Top bar: length + search + buttons */
.dt-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.8rem;
}
.dt-top .dataTables_length,
.dt-top .dataTables_filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dt-top .dataTables_length label,
.dt-top .dataTables_filter label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dt-top .dataTables_length select,
.dt-top .dataTables_filter input {
    background: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--input-text) !important;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
}
.dt-top .dataTables_filter input {
    min-width: 200px;
}
.dt-top .dt-buttons {
    display: flex;
    gap: 0.4rem;
}
.dt-top .dt-buttons .dt-button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.dt-top .dt-buttons .dt-button:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}
[data-theme="dark"] .dt-top .dt-buttons .dt-button {
    background: #4f8cf7;
}
[data-theme="dark"] .dt-top .dt-buttons .dt-button:hover {
    background: #6b5bff;
}

/* Table wrapper */
.dt-wrapper {
    overflow-x: auto;
    margin-bottom: 0.8rem;
}

/* Table itself – no Bootstrap classes */
table.display {
    width: 100% !important;
    border-collapse: collapse;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
}
table.display thead th {
    background: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
    padding: 0.7rem 0.8rem;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}
table.display tbody td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
table.display tbody tr:hover {
    background: rgba(79, 140, 247, 0.06);
}
[data-theme="dark"] table.display tbody tr:hover {
    background: rgba(79, 140, 247, 0.10);
}
/* Striping */
table.display tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] table.display tbody tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.03);
}
table.display tbody tr:nth-of-type(even) {
    background: transparent;
}

/* Bottom: info + pagination */
.dt-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}
.dt-bottom .dataTables_info {
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.dt-bottom .dataTables_paginate {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.dt-bottom .dataTables_paginate .paginate_button {
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}
.dt-bottom .dataTables_paginate .paginate_button:hover {
    background: rgba(79, 140, 247, 0.08);
    color: var(--text-primary);
}
.dt-bottom .dataTables_paginate .paginate_button.current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
[data-theme="dark"] .dt-bottom .dataTables_paginate .paginate_button.current {
    background: #4f8cf7;
    border-color: #4f8cf7;
}
.dt-bottom .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: default;
}

/* Responsive */
@media (max-width: 768px) {
    .dt-top {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    .dt-top .dataTables_filter input {
        min-width: 100%;
    }
    .dt-top .dt-buttons {
        flex-wrap: wrap;
    }
    .dt-bottom {
        flex-direction: column;
        align-items: center;
    }
    table.display {
        font-size: 0.8rem;
    }
    table.display thead th,
    table.display tbody td {
        padding: 0.4rem 0.5rem;
    }
}/* ====================================================
   Profile Page Dark Mode – Force text readability
   ==================================================== */

/* Force all text inside the profile card to use theme colors */
[data-theme="dark"] .card h3,
[data-theme="dark"] .card .h3,
[data-theme="dark"] .card h5,
[data-theme="dark"] .card h6,
[data-theme="dark"] .card .h5,
[data-theme="dark"] .card p:not(.text-muted),
[data-theme="dark"] .card .form-label,
[data-theme="dark"] .card label:not(.form-check-label),
[data-theme="dark"] .card .text-primary {
    color: var(--text-primary) !important;
}

/* Ensure muted text is also visible */
[data-theme="dark"] .card .text-muted {
    color: var(--text-muted) !important;
}

/* Badges – already have white text, but ensure they stay readable */
[data-theme="dark"] .card .badge {
    color: #fff !important;
}

/* Alert boxes in dark mode */
[data-theme="dark"] .card .alert-success {
    color: #0f5132 !important;
    background-color: #d1e7dd !important;
    border-color: #badbcc !important;
}
[data-theme="dark"] .card .alert-danger {
    color: #842029 !important;
    background-color: #f8d7da !important;
    border-color: #f5c2c7 !important;
}
[data-theme="dark"] .card .alert-info {
    color: #055160 !important;
    background-color: #cff4fc !important;
    border-color: #b6effb !important;
}
[data-theme="dark"] .card .alert-warning {
    color: #664d03 !important;
    background-color: #fff3cd !important;
    border-color: #ffecb5 !important;
}

/* Profile image border */
[data-theme="dark"] .card img.rounded-circle {
    border-color: var(--accent) !important;
}

/* Input fields in dark mode already use var(--input-text) */
/* ====================================================
   ULTIMATE DARK MODE TABLE FIX – Override Bootstrap vars
   ==================================================== */
html[data-theme="dark"] .table,
html[data-theme="dark"] .table-striped,
html[data-theme="dark"] .table-hover,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .dataTables_wrapper,
html[data-theme="dark"] .card .table {
    --bs-table-bg: #161b22 !important;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.04) !important;
    --bs-table-hover-bg: rgba(79, 140, 247, 0.10) !important;
    --bs-table-color: #e6edf5 !important;
    --bs-table-striped-color: #e6edf5 !important;
    --bs-table-hover-color: #e6edf5 !important;
    background-color: #161b22 !important;
    color: #e6edf5 !important;
}

html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table thead td,
html[data-theme="dark"] .dataTables_wrapper thead th,
html[data-theme="dark"] .dataTables_wrapper thead td {
    background-color: #1c2333 !important;
    color: #e6edf5 !important;
    border-color: #30363d !important;
}

html[data-theme="dark"] .table tbody td,
html[data-theme="dark"] .table tbody th,
html[data-theme="dark"] .dataTables_wrapper tbody td,
html[data-theme="dark"] .dataTables_wrapper tbody th {
    color: #e6edf5 !important;
    border-color: #30363d !important;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd),
html[data-theme="dark"] .dataTables_wrapper .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even),
html[data-theme="dark"] .dataTables_wrapper .table-striped > tbody > tr:nth-of-type(even) {
    background-color: transparent !important;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover,
html[data-theme="dark"] .dataTables_wrapper .table-hover > tbody > tr:hover {
    background-color: rgba(79, 140, 247, 0.10) !important;
}

/* Badges inside tables */
html[data-theme="dark"] .table .badge,
html[data-theme="dark"] .dataTables_wrapper .badge {
    color: #fff !important;
}
html[data-theme="dark"] .table .badge.bg-success,
html[data-theme="dark"] .dataTables_wrapper .badge.bg-success {
    background-color: #10b981 !important;
}
html[data-theme="dark"] .table .badge.bg-danger,
html[data-theme="dark"] .dataTables_wrapper .badge.bg-danger {
    background-color: #ef4444 !important;
}
html[data-theme="dark"] .table .badge.bg-warning,
html[data-theme="dark"] .dataTables_wrapper .badge.bg-warning {
    background-color: #fbbf24 !important;
    color: #0d1117 !important;
}

/* Progress bars inside tables */
html[data-theme="dark"] .table .progress,
html[data-theme="dark"] .dataTables_wrapper .progress {
    background-color: rgba(255, 255, 255, 0.08) !important;
}
html[data-theme="dark"] .table .progress-bar,
html[data-theme="dark"] .dataTables_wrapper .progress-bar {
    color: #fff !important;
}
html[data-theme="dark"] .table .progress-bar.bg-success,
html[data-theme="dark"] .dataTables_wrapper .progress-bar.bg-success {
    background-color: #10b981 !important;
}
html[data-theme="dark"] .table .progress-bar.bg-warning,
html[data-theme="dark"] .dataTables_wrapper .progress-bar.bg-warning {
    background-color: #fbbf24 !important;
    color: #0d1117 !important;
}
html[data-theme="dark"] .table .progress-bar.bg-danger,
html[data-theme="dark"] .dataTables_wrapper .progress-bar.bg-danger {
    background-color: #ef4444 !important;
}

/* DataTables pagination, search, etc. */
html[data-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: #b0c4de !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    color: #e6edf5 !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #b0c4de !important;
    border: 1px solid #30363d !important;
    background: #161b22 !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #4f8cf7 !important;
    color: #fff !important;
    border-color: #4f8cf7 !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(79, 140, 247, 0.15) !important;
    color: #e6edf5 !important;
}
/* ====================================================
   DataTable Mobile Responsiveness
   ==================================================== */

/* Search box on mobile */
@media (max-width: 768px) {
    .dt-top {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    .dt-top .dataTables_filter {
        width: 100%;
    }
    .dt-top .dataTables_filter input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: unset !important;
    }
    .dt-top .dataTables_length {
        width: 100%;
    }
    .dt-top .dataTables_length select {
        width: 100%;
        max-width: 100%;
    }
    .dt-wrapper {
        overflow-x: auto;
    }
    .dt-bottom {
        flex-direction: column;
        align-items: center;
    }
    .dt-bottom .dataTables_paginate {
        flex-wrap: wrap;
        justify-content: center;
    }
}
/* ====================================================
   Light Theme – Override Bootstrap dark/white classes
   ==================================================== */
/* Force .table-dark to be dark text on light background in light mode */
html:not([data-theme="dark"]) .table-dark {
    --bs-table-bg: #f8fafc !important;
    --bs-table-color: #1e293b !important;
    background-color: #f8fafc !important;
    color: #1e293b !important;
}

html:not([data-theme="dark"]) .table-dark thead th {
    background-color: #e9edf2 !important;
    color: #1e293b !important;
}

html:not([data-theme="dark"]) .table-dark tbody td {
    color: #1e293b !important;
}

/* Force .text-white to be dark text in light mode */
html:not([data-theme="dark"]) .text-white {
    color: var(--text-primary) !important;
}

/* Specifically for .bg-transparent.text-white elements (like announcements) */
html:not([data-theme="dark"]) .bg-transparent.text-white {
    color: var(--text-primary) !important;
}

/* Also ensure any .text-white inside cards becomes dark */
html:not([data-theme="dark"]) .card .text-white {
    color: var(--text-primary) !important;
}

/* For the announcement small text */
html:not([data-theme="dark"]) .text-muted {
    color: var(--text-muted) !important;
}
