/* =====================================================
   COMPLETE CSS.CSS FILE - PASQUOTANK VOTER DATA
   ===================================================== */

/* ===== THEME VARIABLES ===== */
:root {
    /* Light theme variables */
    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #f8f9fa;
    --theme-bg-tertiary: #e9ecef;
    --theme-text-primary: #212529;
    --theme-text-secondary: #6c757d;
    --theme-border-color: #dee2e6;
    --theme-btn-primary: #0d6efd;
    --theme-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --theme-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --theme-table-hover: rgba(0, 0, 0, 0.075);
    --theme-table-stripe: rgba(0, 0, 0, 0.05);
}

/* Dark theme variables */
[data-theme="dark"] {
    --theme-bg-primary: #212529;
    --theme-bg-secondary: #343a40;
    --theme-bg-tertiary: #495057;
    --theme-text-primary: #ffffff;
    --theme-text-secondary: #adb5bd;
    --theme-border-color: #495057;
    --theme-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5);
    --theme-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.5);
    --theme-table-hover: rgba(255, 255, 255, 0.075);
    --theme-table-stripe: rgba(255, 255, 255, 0.05);
}

/* ===== GLOBAL STYLES ===== */
body {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
    transition: all 0.3s ease;
    margin: 10px;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--theme-text-primary) !important;
}

p, span, div {
    color: var(--theme-text-primary) !important;
}

.text-muted {
    color: var(--theme-text-secondary) !important;
}

small {
    color: var(--theme-text-secondary) !important;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    position: fixed;
    top: 7px;
    right: 20px;
    z-index: 1050;
    background: var(--theme-bg-primary);
    border: 2px solid var(--theme-border-color);
    border-radius: 25px;
    padding: 4px;
    box-shadow: var(--theme-shadow-lg);
    display: flex;
    transition: all 0.3s ease;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--theme-text-primary);
    padding: 8px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 16px;
    cursor: pointer;
}

.theme-btn.active {
    background: var(--theme-btn-primary);
    color: white;
}

.theme-btn:hover {
    background: var(--theme-border-color);
}

.theme-btn.active:hover {
    background: #0b5ed7;
}

/* ===== HEADER AND FOOTER ===== */
#header {
    top: 0px;
    left: 0px;
    width: 100%;
    height: 65px;
    background: var(--theme-bg-primary) !important;
    border: 1px solid var(--theme-border-color) !important;
    position: fixed;
    color: var(--theme-text-primary) !important;
    z-index: 1;
    transition: all 0.3s ease;
}

#footer {
    position: fixed;
    bottom: 0px;
    left: 0;
    width: 100%;
    height: 20px;
    background: #071630;
    color: white;
}

div#footer a:link,
div#footer a:visited,
div#footer a:hover,
div#footer a:active {
    color: #ffffff;
}

.logo {
    position: fixed;
    left: 3px;
    top: 8px;
}

.logoutLblPos {
    position: fixed;
    right: 130px;
    top: 5px;
}

.logout {
    background-color: #071630;
    border: none;
    color: #ffffff;
    padding: 12px 22px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 1px 1px;
    cursor: pointer;
    position: fixed;
    right: 110px;
    top: 8px;
    border-radius: 12px;
}

.buttonsearch {
    background-color: #071630;
    border: none;
    color: #ffffff;
    padding: 12px 22px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 1px 1px;
    cursor: pointer;
    position: fixed;
    right: 150px;
    top: 8px;
    border-radius: 12px;
}

/* ===== FORM ELEMENTS ===== */
.form-control, .form-select {
    background-color: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-color) !important;
    color: var(--theme-text-primary) !important;
}

.form-control:focus, .form-select:focus {
    background-color: var(--theme-bg-primary) !important;
    border-color: var(--theme-btn-primary) !important;
    color: var(--theme-text-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    color: var(--theme-text-primary) !important;
    font-weight: 500;
}

/* ===== CARDS ===== */
.card {
    background-color: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-color) !important;
    color: var(--theme-text-primary) !important;
    box-shadow: var(--theme-shadow);
}

.card-header {
    background-color: var(--theme-bg-secondary) !important;
    border-color: var(--theme-border-color) !important;
    color: var(--theme-text-primary) !important;
}

.card-body {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-primary) !important;
}

.card-header.bg-warning {
    background-color: #fd7e14 !important;
    color: #000000 !important;
}

[data-theme="dark"] .card-header.bg-warning {
    background-color: #fd7e14 !important;
    color: #000000 !important;
}

/* ===== ALERTS ===== */
.alert {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

.alert-info {
    background-color: var(--theme-bg-primary) !important;
    border-left: 4px solid var(--theme-btn-primary) !important;
    color: var(--theme-text-primary) !important;
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.2) !important;
    border-color: #198754 !important;
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .alert-info {
    background-color: rgba(13, 110, 253, 0.2) !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(25, 135, 84, 0.2) !important;
    border-color: #198754 !important;
    color: #ffffff !important;
}

/* ===== BUTTONS ===== */
.btn-secondary {
    background-color: var(--theme-bg-secondary) !important;
    border-color: var(--theme-border-color) !important;
    color: var(--theme-text-primary) !important;
}

.btn-secondary:hover {
    background-color: var(--theme-btn-primary) !important;
    color: white !important;
}

.btn-outline-primary {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
}

.btn-outline-primary:hover {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

.btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
}

.btn-outline-secondary:hover {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-primary {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

/* ===== BADGES ===== */
.badge {
    font-weight: 500;
}

.badge.bg-light {
    color: #000 !important;
}

[data-theme="dark"] .badge.bg-light {
    background-color: #6c757d !important;
    color: #fff !important;
}

.badge.bg-warning {
    color: #000 !important;
}

[data-theme="dark"] .badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

/* ===== TABLES - MAIN STYLING ===== */
.table {
    --bs-table-bg: var(--theme-bg-primary) !important;
    --bs-table-color: var(--theme-text-primary) !important;
    --bs-table-border-color: var(--theme-border-color) !important;
    --bs-table-striped-bg: var(--theme-table-stripe) !important;
    --bs-table-hover-bg: var(--theme-table-hover) !important;
}

.table td,
.table th {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

.table thead th {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

.table-dark th {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

/* ===== TABLE STRIPING ===== */
.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--theme-table-stripe) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: var(--theme-table-stripe) !important;
    color: var(--theme-text-primary) !important;
}

.table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-primary) !important;
}

/* ===== TABLE HOVER ===== */
.table-hover > tbody > tr:hover > td {
    background-color: var(--theme-table-hover) !important;
    color: var(--theme-text-primary) !important;
}

/* ===== TABLE-SECONDARY (CATEGORY ROWS) ===== */
.table-secondary,
tr.table-secondary,
.table-secondary td,
tr.table-secondary td,
.table-secondary th,
tr.table-secondary th {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

/* ===== DARK THEME TABLE OVERRIDES ===== */
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    color: #ffffff !important;
    background-color: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-color) !important;
}

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

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: var(--theme-bg-primary) !important;
    color: #ffffff !important;
}

/* ===== DARK THEME TABLE-SECONDARY FIXES ===== */
[data-theme="dark"] .table-secondary,
[data-theme="dark"] tr.table-secondary,
[data-theme="dark"] .table-secondary td,
[data-theme="dark"] tr.table-secondary td,
[data-theme="dark"] .table-secondary th,
[data-theme="dark"] tr.table-secondary th {
    background-color: #495057 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

/* ===== VOTER DIFFERENCES TABLE SPECIFIC ===== */
[data-theme="dark"] #voterDifferencesTable tbody tr,
[data-theme="dark"] #voterDifferencesTable tbody tr td,
[data-theme="dark"] #voterDifferencesTable tbody tr th {
    background-color: var(--theme-bg-primary) !important;
    color: #ffffff !important;
    border-color: var(--theme-border-color) !important;
}

[data-theme="dark"] #voterDifferencesTable tbody tr.table-secondary,
[data-theme="dark"] #voterDifferencesTable tbody tr.table-secondary td {
    background-color: #495057 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

/* ===== NUCLEAR OVERRIDES FOR STUBBORN ELEMENTS ===== */
[data-theme="dark"] * tr.table-secondary,
[data-theme="dark"] * tr.table-secondary td,
[data-theme="dark"] * .table-secondary,
[data-theme="dark"] * .table-secondary td {
    background-color: #495057 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

html[data-theme="dark"] body .table-secondary {
    background-color: #495057 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] body tr.table-secondary td {
    background-color: #495057 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

/* ===== SORTABLE TABLE STYLES ===== */
.sr-only {
    position: absolute;
    top: -30em;
}

table.sortable td,
table.sortable th {
    padding: 0.125em 0.25em;
    width: 8em;
}

table.sortable th {
    font-weight: bold;
    border-bottom: thin solid #888;
    position: sticky;
}

table.sortable th.no-sort {
    padding-top: 0.35em;
}

table.sortable th:nth-child(5) {
    width: 10em;
}

table.sortable th button {
    position: absolute;
    padding: 4px;
    margin: 1px;
    font-size: 100%;
    font-weight: bold;
    background: transparent;
    border: none;
    display: inline;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    text-align: left;
    outline: none;
    cursor: pointer;
    color: var(--theme-text-primary) !important;
}

table.sortable th button span {
    position: absolute;
    right: 4px;
}

table.sortable th[aria-sort="descending"] button span::after {
    content: "▼";
    color: currentcolor;
    font-size: 100%;
    top: 0;
}

table.sortable th[aria-sort="ascending"] button span::after {
    content: "▲";
    color: currentcolor;
    font-size: 100%;
    top: 0;
}

table.show-unsorted-icon th:not([aria-sort]) button span::after {
    content: "♢";
    color: currentcolor;
    font-size: 100%;
    position: relative;
    top: -3px;
    left: -4px;
}

table.sortable td.num {
    text-align: right;
}

table.sortable tbody tr:nth-child(odd) {
    background-color: var(--theme-table-stripe) !important;
}

table.sortable th button:focus,
table.sortable th button:hover {
    padding: 2px;
    border: 2px solid currentcolor;
    background-color: var(--theme-table-hover);
}

table.sortable th button:focus span,
table.sortable th button:hover span {
    right: 2px;
}

table.sortable th:not([aria-sort]) button:focus span::after,
table.sortable th:not([aria-sort]) button:hover span::after {
    content: "▼";
    color: currentcolor;
    font-size: 100%;
    top: 0;
}

/* ===== UTILITY CLASSES ===== */
.wrapper {
    font: 14px sans-serif;
    width: 360px;
    padding: 20px;
}

.note-item {
    font-size: 0.9em;
    background-color: var(--theme-bg-secondary) !important;
    border-color: var(--theme-border-color) !important;
    color: var(--theme-text-primary) !important;
}

.change-summary-card {
    background-color: var(--theme-bg-secondary) !important;
    border-color: var(--theme-border-color) !important;
    transition: all 0.2s ease;
}

.change-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow-lg);
}

.change-summary-card .card-body {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
}

.bg-light {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
}

/* ===== DROPDOWN MENUS ===== */
.dropdown-menu {
    background-color: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-color) !important;
}

.dropdown-item {
    color: var(--theme-text-primary) !important;
}

.dropdown-item:hover {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--theme-bg-primary) !important;
    border-color: var(--theme-border-color) !important;
}

[data-theme="dark"] .dropdown-item {
    color: #ffffff !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--theme-bg-secondary) !important;
    color: #ffffff !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 3px;
    }

    .theme-btn {
        padding: 6px 8px;
        font-size: 14px;
    }

    body {
        margin: 5px;
    }

    .table-responsive {
        font-size: 0.875rem;
    }
}


/* ===== PRINT STYLES ===== */
@media print {
    .theme-toggle,
    .btn,
    #header,
    #footer {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .table {
        border-collapse: collapse !important;
    }

    .table td,
    .table th {
        background: white !important;
        color: black !important;
        border: 1px solid #000 !important;
    }
}
/* Theme-aware table styling */
[data-bs-theme="dark"] .table-theme-aware {
    background-color: #212529;
    color: #f8f9fa;
    border-color: #4b4b4b;
}

[data-bs-theme="dark"] .table-theme-aware thead {
    background-color: #2c2f33;
    color: #ffffff;
}

/* Optional: Make striped rows darker */
[data-bs-theme="dark"] .table-theme-aware tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .border-warning-subtle {
    border-color: var(--theme-border-color) !important;
}