/* Dark mode for the entire site */
html.dark-mode body {
    background-color: #202020; /* Updated base background (rgb: 32) */
    color: #d7d7d7;            /* Updated text brightness (rgb: 215) */
}

html.dark-mode a:link,
html.dark-mode a:visited {
    color: #80c0ff;            /* highly readable link color */
}

html.dark-mode a:hover {
    color: #a0d0ff !important;
}

html.dark-mode .navbar {
    background-color: #2a2a2a; /* Slightly elevated from base to show hierarchy */
    border-top-color: #80c0ff; 
}

html.dark-mode footer {
    border-bottom-color: #80c0ff;
}

/* ResearchGate icon */
html.dark-mode .navbar-icon-img {
    filter: invert(100%);
}

/* Font Awesome icons */
html.dark-mode .navbar-icon i {
    color: #d7d7d7; /* Matched to new text color */
}

/* Smooth transition */
body, .navbar, a, .navbar-icon-img, .navbar-icon i {
    transition: all 0.3s ease;
}

/* CSS Variables for Dark Mode */
html.dark-mode {
    --button-bg: #004c8c; /* Darker blue */
    --button-hover-bg: #003a6c;
    --button-color: #ffffff; /* Keep text white */
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--button-bg);
    color: var(--button-color);
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    margin-top: 0.5rem;
}

.btn:hover {
    opacity: 0.85;
}

/* GT Tables - Syntax Fixed & Colors Adjusted for Legibility */
html.dark-mode .gt_table {
    color: #d7d7d7;
    background-color: #202020;
}

html.dark-mode .gt_table th {
    background-color: #2c2c2c;
}

html.dark-mode .gt_row th {
    background-color: #2a2a2a;
}

html.dark-mode .gt_row:hover th {
    background-color: #383838;
}

/* Post Meta */
html.dark-mode .post-author {
    color: #a3a3a3; /* Muted variant of new text color */
}

html.dark-mode .post-date {
    color: #8a8a8a;
}

/* Modern Panel Shadows & Borders for Dark Mode */
html.dark-mode .homepage-content .panel {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background-color: var(--section-bg); /* Explicitly calls the elevated color */
}

/* Force DT (DataTables) bodies and cells to use dark mode variables */
html.dark-mode table.dataTable,
html.dark-mode table.dataTable thead th,
html.dark-mode table.dataTable tbody td,
html.dark-mode table.dataTable tbody tr {
    background-color: var(--panel-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* Add a subtle dark contrast for zebra-striped "odd" rows */
html.dark-mode table.dataTable.stripe tbody tr.odd,
html.dark-mode table.dataTable.display tbody tr.odd {
    background-color: rgba(255, 255, 255, 0.03) !important; 
}

/* DT Hover effect */
html.dark-mode table.dataTable.hover tbody tr:hover,
html.dark-mode table.dataTable.display tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Fix DT search bar, pagination, and bottom info text */
html.dark-mode .dataTables_wrapper .dataTables_length,
html.dark-mode .dataTables_wrapper .dataTables_filter,
html.dark-mode .dataTables_wrapper .dataTables_info,
html.dark-mode .dataTables_wrapper .dataTables_processing,
html.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: var(--text-color) !important;
}

/* Style the DT Search Input and Length Select dropdown */
html.dark-mode .dataTables_wrapper .dataTables_filter input,
html.dark-mode .dataTables_wrapper .dataTables_length select {
    background-color: var(--panel-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px;
}

/* Fix DT Pagination Buttons */
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-color) !important;
}

/* Active and Hover states for DT Pagination Buttons */
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
}