/* Default to dark theme on load */
html {
    color-scheme: dark;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #0d1117;
    color: #ffffff;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}


/* Fix dropdown z-index layering issues */
.dropdown-menu {
    z-index: 1050 !important;
    position: absolute !important;
}


/* Fix sticky table headers to not interfere with dropdowns */
.table thead th {
    z-index: 1 !important;
}

/* Create proper stacking context for dropdown containers */
.dropdown {
    position: relative;
    z-index: auto;
}

.dropdown.show {
    z-index: 1051 !important;
}

/* Theme transition styles */
:root {
    transition: color 0.3s ease, background-color 0.3s ease;
}

body {
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Dark theme custom properties override */
[data-bs-theme="dark"] {
    --bs-light: #1a1d20;
    --bs-light-rgb: 26, 29, 32;
}

/* Dark theme specific adjustments */
[data-bs-theme="dark"] .top-row {
    background-color: var(--bs-dark) !important;
    border-bottom: 1px solid var(--bs-border-color-translucent) !important;
    color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .top-row a {
    color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .top-row a:hover {
    color: var(--bs-primary) !important;
}

/* Light theme specific adjustments */
[data-bs-theme="light"] .top-row {
    background-color: #f7f7f7 !important;
    border-bottom: 1px solid #d6d5d5 !important;
    color: var(--bs-dark) !important;
}

[data-bs-theme="light"] .top-row a {
    color: var(--bs-dark) !important;
}

[data-bs-theme="light"] .top-row a:hover {
    color: var(--bs-primary) !important;
}

/* Sidebar theme adjustments */
[data-bs-theme="dark"] .sidebar {
    background-color: var(--bs-dark) !important;
    border-right: 1px solid var(--bs-border-color-translucent) !important;
}

[data-bs-theme="light"] .sidebar {
    background-color: var(--bs-light) !important;
    border-right: 1px solid var(--bs-border-color) !important;
}

[data-bs-theme="light"] .sidebar .navbar-dark {
    background-color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .sidebar .navbar-brand {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .sidebar .nav-link svg {
    fill: #ffffff !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .sidebar .bi-house-door-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E") !important;
}

[data-bs-theme="light"] .sidebar .navbar-brand {
    color: var(--bs-dark) !important;
}

[data-bs-theme="light"] .sidebar .nav-link {
    color: var(--bs-dark) !important;
}

[data-bs-theme="light"] .sidebar .nav-link svg {
    fill: var(--bs-dark) !important;
    color: var(--bs-dark) !important;
}

[data-bs-theme="light"] .sidebar .bi-house-door-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23212529' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E") !important;
}

[data-bs-theme="light"] .sidebar .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--bs-dark) !important;
}

[data-bs-theme="light"] .sidebar .nav-item ::deep a.active {
    background-color: var(--bs-primary) !important;
    color: white !important;
}

/* Global theme styles for all content */
[data-bs-theme="dark"] {
    color-scheme: dark;
}

[data-bs-theme="light"] {
    color-scheme: light;
}

/* Main content area theme support */
[data-bs-theme="dark"] main {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="light"] main {
    background-color: var(--bs-light) !important;
    color: var(--bs-dark) !important;
}

[data-bs-theme="dark"] article {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="light"] article {
    background-color: var(--bs-light) !important;
    color: var(--bs-dark) !important;
}

/* Body and page container theme support */
[data-bs-theme="dark"] body {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="light"] body {
    background-color: var(--bs-light) !important;
    color: var(--bs-dark) !important;
}

[data-bs-theme="dark"] .page {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="light"] .page {
    background-color: var(--bs-light) !important;
    color: var(--bs-dark) !important;
}

/* Form controls theme support */
[data-bs-theme="dark"] .form-control {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-border-color-translucent) !important;
    color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-primary) !important;
    color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .form-select {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-border-color-translucent) !important;
    color: var(--bs-light) !important;
}

/* Table theme support */
[data-bs-theme="dark"] .table {
    --bs-table-bg: var(--bs-dark);
    --bs-table-color: #ffffff;
    --bs-table-border-color: var(--bs-border-color-translucent);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    color: #ffffff !important;
    border-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .table thead th {
    color: #ffffff !important;
    background-color: #1a1d20 !important;
    border-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.075) !important;
}

[data-bs-theme="dark"] .table-responsive {
    background-color: var(--bs-dark) !important;
}

/* Enhanced contrast for table content */
[data-bs-theme="dark"] .table input,
[data-bs-theme="dark"] .table select,
[data-bs-theme="dark"] .table textarea {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--bs-border-color-translucent) !important;
}

[data-bs-theme="dark"] .table input:focus,
[data-bs-theme="dark"] .table select:focus,
[data-bs-theme="dark"] .table textarea:focus {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Specific styling for table buttons */
[data-bs-theme="dark"] .table .btn {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table .btn-outline-secondary {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

[data-bs-theme="dark"] .table .btn-outline-secondary:hover {
    color: #000000 !important;
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}

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

[data-bs-theme="dark"] .table .btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

/* Card theme support */
[data-bs-theme="dark"] .card {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-border-color-translucent) !important;
    color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #1a1d20 !important;
    border-bottom-color: var(--bs-border-color-translucent) !important;
    color: #ffffff !important;
}

/* Title and header backgrounds */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #ffffff !important;
}

/* Page title sections */
[data-bs-theme="dark"] .page-title,
[data-bs-theme="dark"] .section-header,
[data-bs-theme="dark"] .content-header {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
    border-bottom: 1px solid var(--bs-border-color-translucent) !important;
}

/* Table headers with darker background */
[data-bs-theme="dark"] .table thead th {
    color: #ffffff !important;
    background-color: #1a1d20 !important;
    border-color: var(--bs-border-color-translucent) !important;
}

/* Panel and section headers */
[data-bs-theme="dark"] .panel-header,
[data-bs-theme="dark"] .section-title,
[data-bs-theme="dark"] .header-row {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
    border-bottom: 1px solid var(--bs-border-color-translucent) !important;
}

/* Bootstrap badge headers */
[data-bs-theme="dark"] .bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-secondary {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

/* Any div with header-like classes */
[data-bs-theme="dark"] .header,
[data-bs-theme="dark"] .title,
[data-bs-theme="dark"] .heading {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

/* Modal theme support */
[data-bs-theme="dark"] .modal-content {
    background-color: var(--bs-secondary) !important;
    color: var(--bs-light) !important;
    border-color: var(--bs-border-color-translucent) !important;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom-color: var(--bs-border-color-translucent) !important;
}

[data-bs-theme="dark"] .modal-footer {
    border-top-color: var(--bs-border-color-translucent) !important;
}

/* Button theme adjustments */
[data-bs-theme="dark"] .btn-outline-secondary {
    color: var(--bs-light) !important;
    border-color: var(--bs-border-color-translucent) !important;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--bs-secondary) !important;
    color: var(--bs-light) !important;
}

/* Dropdown theme support */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-border-color-translucent) !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: var(--bs-primary) !important;
    color: white !important;
}

/* Alert theme support */
[data-bs-theme="dark"] .alert {
    border-color: var(--bs-border-color-translucent) !important;
}

[data-bs-theme="dark"] .alert-info {
    background-color: rgba(13, 202, 240, 0.1) !important;
    border-color: rgba(13, 202, 240, 0.2) !important;
    color: #9eeaf9 !important;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
    border-color: rgba(255, 193, 7, 0.2) !important;
    color: #fff3cd !important;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.1) !important;
    border-color: rgba(220, 53, 69, 0.2) !important;
    color: #f8d7da !important;
}

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

/* Additional high contrast text improvements */
[data-bs-theme="dark"] strong,
[data-bs-theme="dark"] b {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .text-secondary {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .table .text-muted {
    color: #ced4da !important;
}

[data-bs-theme="dark"] .table .text-secondary {
    color: #ced4da !important;
}

/* Ensure labels and small text are visible */
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] .form-label {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .small,
[data-bs-theme="dark"] small {
    color: #ced4da !important;
}

/* Link colors in dark mode for better contrast */
[data-bs-theme="dark"] a {
    color: #6ea8fe !important;
}

[data-bs-theme="dark"] a:hover {
    color: #9ec5fe !important;
}

[data-bs-theme="dark"] .table a {
    color: #6ea8fe !important;
}

[data-bs-theme="dark"] .table a:hover {
    color: #9ec5fe !important;
}

/* Highlighted line items styling for dark mode */
[data-bs-theme="dark"] .table tr.highlighted,
[data-bs-theme="dark"] .table tr[style*="background-color: yellow"],
[data-bs-theme="dark"] .table tr[style*="background-color: #ffff00"],
[data-bs-theme="dark"] .table tr[style*="background-color: #ffc107"],
[data-bs-theme="dark"] .table tr.table-warning {
    background-color: #856404 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table tr.highlighted td,
[data-bs-theme="dark"] .table tr[style*="background-color: yellow"] td,
[data-bs-theme="dark"] .table tr[style*="background-color: #ffff00"] td,
[data-bs-theme="dark"] .table tr[style*="background-color: #ffc107"] td,
[data-bs-theme="dark"] .table tr.table-warning td {
    background-color: #856404 !important;
    color: #ffffff !important;
    border-color: #664d03 !important;
}

/* Alternative highlighting styles for dark mode */
[data-bs-theme="dark"] .highlighted-row {
    background-color: #856404 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .highlighted-row td {
    background-color: #856404 !important;
    color: #ffffff !important;
    border-color: #664d03 !important;
}

/* If using a different highlight approach */
[data-bs-theme="dark"] .table .bg-warning {
    background-color: #856404 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table .text-dark {
    color: #ffffff !important;
}

/* Specific highlighting for project details page */
[data-bs-theme="dark"] .highlighted-row {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-row td {
    background-color: #ffff00 !important;
    color: #000000 !important;
    border-color: #e6e600 !important;
}

[data-bs-theme="dark"] .highlighted-print-row {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-print-row td {
    background-color: #ffff00 !important;
    color: #000000 !important;
    border-color: #e6e600 !important;
}

/* Ensure highlighted row inputs and controls are visible */
[data-bs-theme="dark"] .highlighted-row input,
[data-bs-theme="dark"] .highlighted-row select,
[data-bs-theme="dark"] .highlighted-row textarea {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #cccc00 !important;
}

[data-bs-theme="dark"] .highlighted-row .btn {
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-row .btn-warning {
    background-color: #ffc107 !important;
    border-color: #ffb700 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-row .btn-outline-warning {
    background-color: transparent !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-row .btn-outline-secondary {
    background-color: transparent !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-row .btn-outline-primary {
    background-color: transparent !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .highlighted-row .btn-outline-danger {
    background-color: transparent !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

/* Enhanced button contrast for dark mode */
[data-bs-theme="dark"] .btn {
    color: #ffffff !important;
}

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

[data-bs-theme="dark"] .btn-primary:hover,
[data-bs-theme="dark"] .btn-primary:focus {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    color: #ffffff !important;
}

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

[data-bs-theme="dark"] .btn-secondary:hover,
[data-bs-theme="dark"] .btn-secondary:focus {
    background-color: #5c636a !important;
    border-color: #565e64 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-success {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-success:hover,
[data-bs-theme="dark"] .btn-success:focus {
    background-color: #157347 !important;
    border-color: #146c43 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-warning {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-warning:hover,
[data-bs-theme="dark"] .btn-warning:focus {
    background-color: #ffca2c !important;
    border-color: #ffc720 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-danger:hover,
[data-bs-theme="dark"] .btn-danger:focus {
    background-color: #bb2d3b !important;
    border-color: #b02a37 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-info {
    background-color: #0dcaf0 !important;
    border-color: #0dcaf0 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-info:hover,
[data-bs-theme="dark"] .btn-info:focus {
    background-color: #31d2f2 !important;
    border-color: #25cff2 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-light {
    background-color: #f8f9fa !important;
    border-color: #f8f9fa !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-light:hover,
[data-bs-theme="dark"] .btn-light:focus {
    background-color: #d3d4d5 !important;
    border-color: #c6c7c8 !important;
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-dark {
    background-color: #212529 !important;
    border-color: #212529 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-dark:hover,
[data-bs-theme="dark"] .btn-dark:focus {
    background-color: #424649 !important;
    border-color: #373b3e !important;
    color: #ffffff !important;
}

/* Darker dividers and borders for better contrast */
[data-bs-theme="dark"] .border {
    border-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .border-top {
    border-top-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .border-left {
    border-left-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .border-right {
    border-right-color: #1a1d20 !important;
}

[data-bs-theme="dark"] hr {
    border-color: #1a1d20 !important;
    opacity: 1 !important;
}

/* Fix light grey backgrounds that are too light in dark mode */
[data-bs-theme="dark"] .bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
    --bs-bg-opacity: 1 !important;
}

[data-bs-theme="dark"] .bg-secondary {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-body {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-body-secondary {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

/* Card and panel backgrounds */
[data-bs-theme="dark"] .card {
    background-color: #0d1117 !important;
    border-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-body {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #1a1d20 !important;
    border-bottom-color: #1a1d20 !important;
    color: #ffffff !important;
}

/* Specific override for card headers with bg-light class */
[data-bs-theme="dark"] .card-header.bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

/* Additional specific selectors for divider backgrounds */
[data-bs-theme="dark"] div.bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-light.rounded {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

/* Additional room total and summary sections */
[data-bs-theme="dark"] .d-flex.bg-light.rounded {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-light.rounded strong {
    color: #ffffff !important;
}

/* Ultra-specific selectors to override Bootstrap defaults */
[data-bs-theme="dark"] body .bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] body .card-header.bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] body div.card-header.bg-light {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-footer {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

/* List group backgrounds */
[data-bs-theme="dark"] .list-group-item {
    background-color: #0d1117 !important;
    color: #ffffff !important;
    border-color: #1a1d20 !important;
}

[data-bs-theme="dark"] .list-group-item.active {
    background-color: var(--bs-primary) !important;
    color: #ffffff !important;
}

/* Navbar light backgrounds */
[data-bs-theme="dark"] .navbar-light {
    background-color: #0d1117 !important;
}

[data-bs-theme="dark"] .navbar-light .navbar-brand {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: #ffffff !important;
}

/* Breadcrumb backgrounds */
[data-bs-theme="dark"] .breadcrumb {
    background-color: #0d1117 !important;
}

[data-bs-theme="dark"] .breadcrumb-item a {
    color: #6ea8fe !important;
}

/* Limit description column width in project details table */
.table th[style*="min-width: 200px"] {
    max-width: 300px !important;
    min-width: 200px !important;
    width: 300px !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
}

/* Limit description column content in table cells */
.table tbody td:nth-child(3) {
    max-width: 300px !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    text-overflow: ellipsis !important;
}

/* Room totals sections with light backgrounds - override inline styles */
[data-bs-theme="dark"] .d-flex[style*="background: linear-gradient(135deg, #f8f9fa"] {
    background: linear-gradient(135deg, #1a1d20 0%, #2d3748 100%) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .d-flex[style*="background-color: #f8f9fa"] {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .d-flex[style*="background: linear-gradient(135deg, #d4edda"] {
    background: linear-gradient(135deg, #1a4332 0%, #155724 100%) !important;
    color: #ffffff !important;
}

/* Ensure text in room totals sections is visible in dark mode */
[data-bs-theme="dark"] .d-flex[style*="background:"] span,
[data-bs-theme="dark"] .d-flex[style*="background-color:"] span {
    color: #ffffff !important;
}

/* Margin Percentage sections with light background */
[data-bs-theme="dark"] .text-center[style*="background-color: #f8f9fa"] {
    background-color: #1a1d20 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .text-center[style*="background-color: #f8f9fa"] .text-muted {
    color: #adb5bd !important;
}

/* Divider line items from Add Divider button */
[data-bs-theme="dark"] .table-secondary {
    --bs-table-bg: #2d3748 !important;
    background-color: #2d3748 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table-secondary td {
    background-color: #2d3748 !important;
    color: #ffffff !important;
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] tr.table-secondary {
    background-color: #2d3748 !important;
    color: #ffffff !important;
}

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

/* Equipment Order Summary page should always have white background with black text */
[data-bs-theme="dark"] .equipment-order-summary,
[data-bs-theme="dark"] .equipment-order-summary body,
[data-bs-theme="dark"] .equipment-order-summary *:not(.btn):not(.badge) {
    background-color: white !important;
    color: black !important;
}

[data-bs-theme="dark"] .equipment-order-summary .table {
    color: black !important;
    background-color: white !important;
}

[data-bs-theme="dark"] .equipment-order-summary .table td,
[data-bs-theme="dark"] .equipment-order-summary .table th {
    color: black !important;
    background-color: white !important;
    border-color: #dee2e6 !important;
}

/* ========================================
   QuickGrid Dark Mode - Column Options Button (Filter Icons)
   ======================================== */

/*
   QuickGrid's hamburger icon uses a background-image with an inline SVG.
   The SVG uses stroke="currentColor", so it inherits from the CSS color property.
   QuickGrid uses scoped CSS with [b-vznuo5fmpv] attribute, so we need !important.
*/

/* The hamburger/filter button - SVG uses stroke="currentColor" */
/* Need high specificity to override QuickGrid's scoped CSS: th[b-xxx] .col-options-button */
[data-bs-theme="dark"] th .col-options-button,
[data-bs-theme="dark"] table th .col-options-button,
[data-bs-theme="dark"] thead th .col-options-button,
[data-bs-theme="dark"] .col-header-content .col-options-button {
    color: #ffffff !important;
    /* Fallback: override background-image with white SVG if currentColor doesn't work */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 0 21 24" stroke="white" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h16" /></svg>') !important;
}

/* Also set on table headers to ensure inheritance */
[data-bs-theme="dark"] th {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .col-header-content {
    color: #e6edf3 !important;
}

/* Hover state */
[data-bs-theme="dark"] th .col-options-button:hover,
[data-bs-theme="dark"] table th .col-options-button:hover,
[data-bs-theme="dark"] thead th .col-options-button:hover,
[data-bs-theme="dark"] .col-header-content .col-options-button:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 0 21 24" stroke="white" stroke-width="2"><path d="M4 6h16M4 12h16M4 18h16" /></svg>') !important;
}

/* QuickGrid column options dropdown panel */
[data-bs-theme="dark"] .col-options {
    background-color: #21262d !important;
    border: 1px solid #30363d !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    color: #ffffff !important;
}

/* QuickGrid sortable column title buttons */
[data-bs-theme="dark"] .col-title {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] button.col-title {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] button.col-title:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Sort indicator */
[data-bs-theme="dark"] .sort-indicator {
    filter: invert(1) !important;
}
