/**
 * Global Dark Theme Support for Vera Web Application
 * This file contains all dark theme CSS rules that apply across all pages
 */

/* ============================================
   GLOBAL DARK THEME SUPPORT FOR ALL PAGES
   ============================================ */

/* Buttons - Dark theme support */
[data-bs-theme="dark"] .btn-outline-dark {
    color: #e2e8f0 !important;
    border-color: #4b5563 !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
    color: #fff !important;
    background-color: #4b5563 !important;
    border-color: #6b7280 !important;
}

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

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

/* Form elements - Dark theme support */
/* Override inline styles with maximum specificity */
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] body .form-select,
[data-bs-theme="dark"] body .form-control,
[data-bs-theme="dark"] html .form-select,
[data-bs-theme="dark"] html .form-control,
[data-bs-theme="dark"] html body .form-select,
[data-bs-theme="dark"] html body .form-control,
[data-bs-theme="dark"] .form-select[style*="background"],
[data-bs-theme="dark"] .form-control[style*="background"],
[data-bs-theme="dark"] .history-popup-card .form-select,
[data-bs-theme="dark"] .history-popup-card .form-control,
[data-bs-theme="dark"] html body .history-popup-card .form-select,
[data-bs-theme="dark"] html body .history-popup-card .form-control {
    background-color: #2d3748 !important;
    background: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] body .form-select:focus,
[data-bs-theme="dark"] body .form-control:focus,
[data-bs-theme="dark"] html .form-select:focus,
[data-bs-theme="dark"] html .form-control:focus,
[data-bs-theme="dark"] html body .form-select:focus,
[data-bs-theme="dark"] html body .form-control:focus,
[data-bs-theme="dark"] .history-popup-card .form-select:focus,
[data-bs-theme="dark"] .history-popup-card .form-control:focus,
[data-bs-theme="dark"] html body .history-popup-card .form-select:focus,
[data-bs-theme="dark"] html body .history-popup-card .form-control:focus {
    background-color: #2d3748 !important;
    background: #2d3748 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .form-label {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .form-check-label {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .form-check-input,
[data-bs-theme="dark"] body .form-check-input,
[data-bs-theme="dark"] html .form-check-input,
[data-bs-theme="dark"] html body .form-check-input,
[data-bs-theme="dark"] .form-check-input[style*="background"],
[data-bs-theme="dark"] .form-check-input[style*="border"] {
    background-color: #2d3748 !important;
    background: #2d3748 !important;
    border-color: #4b5563 !important;
    border: 1px solid #4b5563 !important;
    background-image: none !important;
}

[data-bs-theme="dark"] .form-check-input:checked,
[data-bs-theme="dark"] body .form-check-input:checked,
[data-bs-theme="dark"] html .form-check-input:checked,
[data-bs-theme="dark"] html body .form-check-input:checked {
    background-color: #3b82f6 !important;
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    border: 1px solid #3b82f6 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

[data-bs-theme="dark"] .form-check-input:focus,
[data-bs-theme="dark"] body .form-check-input:focus,
[data-bs-theme="dark"] html .form-check-input:focus,
[data-bs-theme="dark"] html body .form-check-input:focus {
    border-color: #3b82f6 !important;
    border: 1px solid #3b82f6 !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

[data-bs-theme="dark"] .form-check-input:checked:focus,
[data-bs-theme="dark"] body .form-check-input:checked:focus,
[data-bs-theme="dark"] html .form-check-input:checked:focus,
[data-bs-theme="dark"] html body .form-check-input:checked:focus {
    background-color: #3b82f6 !important;
    background: #3b82f6 url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

/* Date range picker - Dark theme support */
/* Light theme defaults */
.reportrange-input {
    background: #fff;
    border-color: #ccc;
    color: #212529;
}

.reportrange-input i,
.reportrange-input .fa {
    color: #495057;
}

.reportrange-input span {
    color: #212529;
}

/* Dark theme overrides */
[data-bs-theme="dark"] .reportrange-input,
[data-bs-theme="dark"] #reportrange,
[data-bs-theme="dark"] #reportrange.reportrange-input,
[data-bs-theme="dark"] body .reportrange-input,
[data-bs-theme="dark"] body #reportrange {
    background: #2d3748 !important;
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .reportrange-input i,
[data-bs-theme="dark"] .reportrange-input .fa,
[data-bs-theme="dark"] #reportrange i,
[data-bs-theme="dark"] #reportrange .fa {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .reportrange-input span,
[data-bs-theme="dark"] #reportrange span {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .reportrange-input i,
[data-bs-theme="dark"] .reportrange-input .fa,
[data-bs-theme="dark"] #reportrange i,
[data-bs-theme="dark"] #reportrange .fa,
[data-bs-theme="dark"] body .reportrange-input i,
[data-bs-theme="dark"] body #reportrange i {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .reportrange-input span,
[data-bs-theme="dark"] #reportrange span,
[data-bs-theme="dark"] body .reportrange-input span,
[data-bs-theme="dark"] body #reportrange span {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .reportrange-input .text-dark,
[data-bs-theme="dark"] #reportrange .text-dark {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .reportrange-input .text-primary,
[data-bs-theme="dark"] #reportrange .text-primary {
    color: #60a5fa !important;
}

[data-bs-theme="dark"] .reportrange-input .text-muted,
[data-bs-theme="dark"] #reportrange .text-muted {
    color: #9ca3af !important;
}

/* Daterangepicker dropdown - Dark theme support */
[data-bs-theme="dark"] .daterangepicker {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table {
    background-color: #1a1d23 !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table th,
[data-bs-theme="dark"] .daterangepicker .calendar-table td {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table .available {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table .available:hover {
    background-color: #2d3748 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table .in-range {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table .start-date,
[data-bs-theme="dark"] .daterangepicker .calendar-table .end-date,
[data-bs-theme="dark"] .daterangepicker .calendar-table .active {
    background-color: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges li {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges li:hover {
    background-color: #2d3748 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges li.active {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .daterangepicker .drp-buttons {
    border-top-color: #2d3748 !important;
}

[data-bs-theme="dark"] .daterangepicker .drp-buttons .btn {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .drp-buttons .btn:hover {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}

/* Daterangepicker - Custom range inputs and selects - Dark theme support */
[data-bs-theme="dark"] .daterangepicker select.monthselect,
[data-bs-theme="dark"] .daterangepicker select.yearselect {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker select.hourselect,
[data-bs-theme="dark"] .daterangepicker select.minuteselect,
[data-bs-theme="dark"] .daterangepicker select.secondselect,
[data-bs-theme="dark"] .daterangepicker select.ampmselect {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker select.monthselect:focus,
[data-bs-theme="dark"] .daterangepicker select.yearselect:focus,
[data-bs-theme="dark"] .daterangepicker select.hourselect:focus,
[data-bs-theme="dark"] .daterangepicker select.minuteselect:focus,
[data-bs-theme="dark"] .daterangepicker select.secondselect:focus,
[data-bs-theme="dark"] .daterangepicker select.ampmselect:focus {
    background-color: #2d3748 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
    outline: none !important;
}

/* Daterangepicker - Range inputs (custom range date inputs) - Dark theme support */
[data-bs-theme="dark"] .daterangepicker .ranges .range_inputs input,
[data-bs-theme="dark"] .daterangepicker .daterangepicker_start_input input,
[data-bs-theme="dark"] .daterangepicker .daterangepicker_end_input input,
[data-bs-theme="dark"] .daterangepicker .ranges .range_inputs .input-mini {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges .range_inputs input:focus,
[data-bs-theme="dark"] .daterangepicker .daterangepicker_start_input input:focus,
[data-bs-theme="dark"] .daterangepicker .daterangepicker_end_input input:focus,
[data-bs-theme="dark"] .daterangepicker .ranges .range_inputs .input-mini:focus {
    background-color: #2d3748 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
    outline: none !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges .range_inputs label,
[data-bs-theme="dark"] .daterangepicker .daterangepicker_start_input label,
[data-bs-theme="dark"] .daterangepicker .daterangepicker_end_input label {
    color: #e2e8f0 !important;
}

/* Daterangepicker - Calendar navigation arrows - Dark theme support */
[data-bs-theme="dark"] .daterangepicker .calendar-table .next span,
[data-bs-theme="dark"] .daterangepicker .calendar-table .prev span {
    border-color: #e2e8f0 !important;
}

/* Daterangepicker - Arrow (before/after pseudo-elements) - Dark theme support */
[data-bs-theme="dark"] .daterangepicker:before {
    border-bottom-color: #2d3748 !important;
}

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

[data-bs-theme="dark"] .daterangepicker.drop-up:before {
    border-top-color: #2d3748 !important;
}

[data-bs-theme="dark"] .daterangepicker.drop-up:after {
    border-top-color: #1a1d23 !important;
}

/* Daterangepicker - Off dates and week numbers - Dark theme support */
[data-bs-theme="dark"] .daterangepicker td.off,
[data-bs-theme="dark"] .daterangepicker td.off.in-range,
[data-bs-theme="dark"] .daterangepicker td.off.start-date,
[data-bs-theme="dark"] .daterangepicker td.off.end-date {
    background-color: #1a1d23 !important;
    color: #6b7280 !important;
}

[data-bs-theme="dark"] .daterangepicker td.week,
[data-bs-theme="dark"] .daterangepicker th.week {
    color: #6b7280 !important;
}

[data-bs-theme="dark"] .daterangepicker td.disabled,
[data-bs-theme="dark"] .daterangepicker option.disabled {
    color: #6b7280 !important;
}

/* Daterangepicker - Calendar table borders - Dark theme support */
[data-bs-theme="dark"] .daterangepicker .calendar-table {
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] .daterangepicker.show-ranges.single.rtl .drp-calendar.left,
[data-bs-theme="dark"] .daterangepicker.show-ranges.single.ltr .drp-calendar.left,
[data-bs-theme="dark"] .daterangepicker.show-ranges.rtl .drp-calendar.right,
[data-bs-theme="dark"] .daterangepicker.show-ranges.ltr .drp-calendar.left {
    border-color: #2d3748 !important;
}

/* Daterangepicker - Calendar time section - Dark theme support */
[data-bs-theme="dark"] .daterangepicker .calendar-time {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-time select.disabled {
    color: #6b7280 !important;
}

/* Daterangepicker - Selected date range text - Dark theme support */
[data-bs-theme="dark"] .daterangepicker .drp-selected {
    color: #e2e8f0 !important;
}

/* Cards - Dark theme support */
[data-bs-theme="dark"] .card {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
}

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

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

/* Modals - Dark theme support */
[data-bs-theme="dark"] .modal-content {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] .modal-header {
    background-color: #1a1d23 !important;
    border-bottom-color: #2d3748 !important;
}

[data-bs-theme="dark"] .modal-footer {
    background-color: #1a1d23 !important;
    border-top-color: #2d3748 !important;
}

/* Dropdown menus - Dark theme support */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
}

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

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #4b5563 !important;
    color: #fff !important;
}

/* Alerts - Dark theme support */
[data-bs-theme="dark"] .alert-info,
[data-bs-theme="dark"] body .alert-info,
[data-bs-theme="dark"] html .alert-info,
[data-bs-theme="dark"] .alert-info[style*="background"],
[data-bs-theme="dark"] .alert-info[style*="border"] {
    background-color: #1e3a5f !important;
    background: #1e3a5f !important;
    border-color: #2563eb !important;
    color: #93c5fd !important;
}

[data-bs-theme="dark"] .alert-success {
    background-color: #14532d !important;
    border-color: #16a34a !important;
    color: #86efac !important;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: #78350f !important;
    border-color: #d97706 !important;
    color: #fde047 !important;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: #7f1d1d !important;
    border-color: #dc2626 !important;
    color: #fca5a5 !important;
}

/* Tables - Dark theme support */
[data-bs-theme="dark"] .table {
    color: #e2e8f0 !important;
}

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

[data-bs-theme="dark"] .table thead th {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

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

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

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

/* Nav tabs - Dark theme support */
[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #e2e8f0 !important;
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
    border-color: #6b7280 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #2d3748 !important;
    border-color: #4b5563 #4b5563 #2d3748 !important;
    color: #fff !important;
}

/* Bootstrap utility classes - Dark theme support */
[data-bs-theme="dark"] .bg-light {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
}

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

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

[data-bs-theme="dark"] .border {
    border-color: #4b5563 !important;
}

/* Override common inline styles for dark theme */
[data-bs-theme="dark"] div[style*="background: #fff"],
[data-bs-theme="dark"] div[style*="background:#fff"],
[data-bs-theme="dark"] div[style*="background: #ffffff"],
[data-bs-theme="dark"] div[style*="background:#ffffff"] {
    background: #2d3748 !important;
}

[data-bs-theme="dark"] div[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] div[style*="border-color:#d1d5db"],
[data-bs-theme="dark"] select[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] select[style*="border-color:#d1d5db"],
[data-bs-theme="dark"] input[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] input[style*="border-color:#d1d5db"] {
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] div[style*="border: 2px solid #d1d5db"],
[data-bs-theme="dark"] div[style*="border:2px solid #d1d5db"] {
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] .table thead[style*="background-color: #f1f5f9"],
[data-bs-theme="dark"] .table thead[style*="background-color:#f1f5f9"] {
    background-color: #2d3748 !important;
}

[data-bs-theme="dark"] tr[style*="border-bottom: 1px solid #f1f5f9"],
[data-bs-theme="dark"] tr[style*="border-bottom:1px solid #f1f5f9"] {
    border-bottom-color: #2d3748 !important;
}

[data-bs-theme="dark"] .card[style*="border: 1px solid #e5e7eb"],
[data-bs-theme="dark"] .card[style*="border:1px solid #e5e7eb"] {
    border-color: #2d3748 !important;
}

/* Flexible report page specific - Dark theme support */
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] div.bg-light,
[data-bs-theme="dark"] .border.bg-light {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] .fw-bold.text-dark,
[data-bs-theme="dark"] .form-label.fw-bold.text-dark,
[data-bs-theme="dark"] .form-label.text-dark,
[data-bs-theme="dark"] label.text-dark,
[data-bs-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] td.text-dark,
[data-bs-theme="dark"] th.text-dark {
    color: #e2e8f0 !important;
}

/* Additional inline style overrides for date range picker */
[data-bs-theme="dark"] #reportrange[style*="border: 1px solid #ccc"],
[data-bs-theme="dark"] #reportrange[style*="border:1px solid #ccc"],
[data-bs-theme="dark"] #reportrange[style*="border: 2px solid #d1d5db"],
[data-bs-theme="dark"] #reportrange[style*="border:2px solid #d1d5db"],
[data-bs-theme="dark"] body #reportrange[style*="border"],
[data-bs-theme="dark"] html #reportrange[style*="border"] {
    border-color: #4b5563 !important;
    border: 1px solid #4b5563 !important;
}

/* Ensure all text inside reportrange is visible in dark theme */
[data-bs-theme="dark"] #reportrange * {
    color: inherit;
}

/* Form elements inside bg-light containers - Dark theme support */
[data-bs-theme="dark"] .bg-light .form-select,
[data-bs-theme="dark"] .bg-light .form-control,
[data-bs-theme="dark"] .bg-light select,
[data-bs-theme="dark"] .bg-light input {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .bg-light .form-select:focus,
[data-bs-theme="dark"] .bg-light .form-control:focus,
[data-bs-theme="dark"] .bg-light select:focus,
[data-bs-theme="dark"] .bg-light input:focus {
    background-color: #2d3748 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
}

/* Override inline border-color styles */
[data-bs-theme="dark"] select[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] select[style*="border-color:#d1d5db"],
[data-bs-theme="dark"] input[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] input[style*="border-color:#d1d5db"],
[data-bs-theme="dark"] .form-select[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] .form-select[style*="border-color:#d1d5db"],
[data-bs-theme="dark"] .form-control[style*="border-color: #d1d5db"],
[data-bs-theme="dark"] .form-control[style*="border-color:#d1d5db"] {
    border-color: #4b5563 !important;
}

/* Card with inline border style */
[data-bs-theme="dark"] .card[style*="border: 1px solid #e5e7eb"],
[data-bs-theme="dark"] .card[style*="border:1px solid #e5e7eb"] {
    border-color: #2d3748 !important;
    background-color: #1a1d23 !important;
}

/* Form check labels inside bg-light */
[data-bs-theme="dark"] .bg-light .form-check-label {
    color: #e2e8f0 !important;
}

/* Placeholder text in dark theme */
[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] input::placeholder {
    color: #9ca3af !important;
    opacity: 1;
}

/* Shift distance report - Dark theme support */
[data-bs-theme="dark"] .shift-container {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .shift-time-row {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .shift-time-inputs input.time-input {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .shift-time-inputs input.time-input:focus {
    background-color: #2d3748 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .shift-time-inputs input.time-input.is-invalid {
    border-color: #dc2626 !important;
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

[data-bs-theme="dark"] .shift-time-inputs span {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .shift-time-inputs datalist option {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

/* Login page - Dark theme support */
[data-bs-theme="dark"] body.bg-white {
    background-color: #1a1d23 !important;
}

[data-bs-theme="dark"] .container-tight {
    background-color: transparent !important;
}

[data-bs-theme="dark"] .navbar-brand img {
    filter: brightness(1.2);
}

/* Map POI/Region Edit Dialogs - Dark theme support */
[data-bs-theme="dark"] #dlg-poi-edit,
[data-bs-theme="dark"] #dlg-region-edit,
[data-bs-theme="dark"] #dlg-region-add {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .card-header,
[data-bs-theme="dark"] #dlg-region-edit .card-header,
[data-bs-theme="dark"] #dlg-region-add .card-header {
    background-color: #1a1d23 !important;
    border-bottom-color: #2d3748 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .card-title,
[data-bs-theme="dark"] #dlg-region-edit .card-title,
[data-bs-theme="dark"] #dlg-region-add .card-title {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .card-actions a,
[data-bs-theme="dark"] #dlg-region-edit .card-actions a,
[data-bs-theme="dark"] #dlg-region-add .card-actions a {
    color: #e2e8f0 !important;
    text-decoration: none;
}

[data-bs-theme="dark"] #dlg-poi-edit .card-actions a:hover,
[data-bs-theme="dark"] #dlg-region-edit .card-actions a:hover,
[data-bs-theme="dark"] #dlg-region-add .card-actions a:hover {
    color: #fff !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .card-body,
[data-bs-theme="dark"] #dlg-region-edit .card-body,
[data-bs-theme="dark"] #dlg-region-add .card-body {
    background-color: #1a1d23 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .form-label,
[data-bs-theme="dark"] #dlg-region-edit .form-label,
[data-bs-theme="dark"] #dlg-region-add .form-label {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .text-muted,
[data-bs-theme="dark"] #dlg-region-edit .text-muted,
[data-bs-theme="dark"] #dlg-region-add .text-muted {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .small,
[data-bs-theme="dark"] #dlg-region-edit .small,
[data-bs-theme="dark"] #dlg-region-add .small {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] #dlg-poi-edit span,
[data-bs-theme="dark"] #dlg-region-edit span,
[data-bs-theme="dark"] #dlg-region-add span {
    color: #e2e8f0 !important;
}

/* Map context menu - Dark theme support */
[data-bs-theme="dark"] #map-ctx {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] #map-ctx .list-group-item {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #map-ctx .list-group-item:hover,
[data-bs-theme="dark"] #map-ctx .list-group-item:focus {
    background-color: #2d3748 !important;
    color: #fff !important;
}

/* TomSelect dropdowns in POI/Region dialogs - Dark theme support */
[data-bs-theme="dark"] #dlg-poi-edit .ts-wrapper,
[data-bs-theme="dark"] #dlg-region-edit .ts-wrapper,
[data-bs-theme="dark"] #dlg-region-add .ts-wrapper {
    background-color: #2d3748 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-control,
[data-bs-theme="dark"] #dlg-region-edit .ts-control,
[data-bs-theme="dark"] #dlg-region-add .ts-control {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-control input,
[data-bs-theme="dark"] #dlg-region-edit .ts-control input,
[data-bs-theme="dark"] #dlg-region-add .ts-control input {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-control .item,
[data-bs-theme="dark"] #dlg-region-edit .ts-control .item,
[data-bs-theme="dark"] #dlg-region-add .ts-control .item {
    background-color: transparent !important;
    color: #e2e8f0 !important;
    border-color: transparent !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-dropdown,
[data-bs-theme="dark"] #dlg-region-edit .ts-dropdown,
[data-bs-theme="dark"] #dlg-region-add .ts-dropdown {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-dropdown .option,
[data-bs-theme="dark"] #dlg-region-edit .ts-dropdown .option,
[data-bs-theme="dark"] #dlg-region-add .ts-dropdown .option {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-dropdown .option:hover,
[data-bs-theme="dark"] #dlg-region-edit .ts-dropdown .option:hover,
[data-bs-theme="dark"] #dlg-region-add .ts-dropdown .option:hover {
    background-color: #4b5563 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-dropdown .option.active,
[data-bs-theme="dark"] #dlg-region-edit .ts-dropdown .option.active,
[data-bs-theme="dark"] #dlg-region-add .ts-dropdown .option.active {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-dropdown .option.selected,
[data-bs-theme="dark"] #dlg-region-edit .ts-dropdown .option.selected,
[data-bs-theme="dark"] #dlg-region-add .ts-dropdown .option.selected {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] #dlg-poi-edit .ts-dropdown-content,
[data-bs-theme="dark"] #dlg-region-edit .ts-dropdown-content,
[data-bs-theme="dark"] #dlg-region-add .ts-dropdown-content {
    background-color: #2d3748 !important;
}

/* General TomSelect dark theme support */
[data-bs-theme="dark"] .ts-wrapper {
    background-color: #2d3748 !important;
}

[data-bs-theme="dark"] .ts-control {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .ts-control input {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .ts-control .item {
    background-color: transparent !important;
    color: #e2e8f0 !important;
    border-color: transparent !important;
}

[data-bs-theme="dark"] .ts-dropdown {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
}

[data-bs-theme="dark"] .ts-dropdown .option {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .ts-dropdown .option:hover {
    background-color: #4b5563 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .ts-dropdown .option.active,
[data-bs-theme="dark"] .ts-dropdown .option.selected {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .ts-dropdown-content {
    background-color: #2d3748 !important;
}

/* Location History Popup - Light theme defaults (when NOT in dark mode) */
/* Use more specific selectors to ensure they override dark theme styles */
html:not([data-bs-theme="dark"]) body .map-info-card,
html:not([data-bs-theme="dark"]) .map-info-card {
    border-color: rgba(0, 0, 0, .085) !important;
    background-color: #f8fafc !important;
}

html:not([data-bs-theme="dark"]) body .map-info-card .info-label,
html:not([data-bs-theme="dark"]) .map-info-card .info-label {
    color: #6c757d !important;
}

html:not([data-bs-theme="dark"]) body .map-info-card .info-value,
html:not([data-bs-theme="dark"]) .map-info-card .info-value {
    color: #1e293b !important;
}

html:not([data-bs-theme="dark"]) body .summary-card,
html:not([data-bs-theme="dark"]) .summary-card {
    border-color: rgba(0, 0, 0, .08) !important;
    background-color: #fff !important;
}

html:not([data-bs-theme="dark"]) body .summary-card h4,
html:not([data-bs-theme="dark"]) .summary-card h4 {
    color: #64748b !important;
}

html:not([data-bs-theme="dark"]) body .summary-card span,
html:not([data-bs-theme="dark"]) .summary-card span {
    color: #0f172a !important;
}

html:not([data-bs-theme="dark"]) body .summary-card .text-muted,
html:not([data-bs-theme="dark"]) .summary-card .text-muted {
    color: #6c757d !important;
}

html:not([data-bs-theme="dark"]) body .map-wrapper,
html:not([data-bs-theme="dark"]) .map-wrapper {
    border-color: #dee2e6 !important;
}

html:not([data-bs-theme="dark"]) body .history-popup-card,
html:not([data-bs-theme="dark"]) .history-popup-card {
    background-color: #fff !important;
    border-color: rgba(0, 0, 0, 0.125) !important;
}

html:not([data-bs-theme="dark"]) body .history-popup-card .card-body,
html:not([data-bs-theme="dark"]) .history-popup-card .card-body {
    background-color: #fff !important;
}

html:not([data-bs-theme="dark"]) body .history-popup-card .popup-page-title,
html:not([data-bs-theme="dark"]) .history-popup-card .popup-page-title {
    color: #1e293b !important;
}

/* Location History Popup - Dark theme support */
[data-bs-theme="dark"] .map-info-card {
    border-color: #2d3748 !important;
    background-color: #1a1d23 !important;
}

[data-bs-theme="dark"] .map-info-card .info-label {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .map-info-card .info-value {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .summary-card {
    border-color: #2d3748 !important;
    background-color: #1a1d23 !important;
}

[data-bs-theme="dark"] .summary-card h4 {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .summary-card span {
    color: #e2e8f0 !important;
}

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

[data-bs-theme="dark"] .map-wrapper {
    border-color: #2d3748 !important;
}

/* Popup layout - Light theme defaults */
html:not([data-bs-theme="dark"]) body.layout-fluid {
    background-color: #f8fafc !important;
}

html:not([data-bs-theme="dark"]) body .popup-container,
html:not([data-bs-theme="dark"]) .popup-container {
    background-color: #f8fafc !important;
}

/* Location History Popup - Form card dark theme support */
[data-bs-theme="dark"] .history-popup-card,
[data-bs-theme="dark"] body .history-popup-card {
    background-color: #1a1d23 !important;
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] .history-popup-card .card-body,
[data-bs-theme="dark"] body .history-popup-card .card-body {
    background-color: #1a1d23 !important;
}

[data-bs-theme="dark"] .history-popup-card .popup-page-title,
[data-bs-theme="dark"] body .history-popup-card .popup-page-title {
    color: #e2e8f0 !important;
}

/* Location History Popup - Form elements inside popup card - Maximum specificity */
html[data-bs-theme="dark"] .history-popup-card .form-select,
html[data-bs-theme="dark"] .history-popup-card .form-control,
html[data-bs-theme="dark"] body .history-popup-card .form-select,
html[data-bs-theme="dark"] body .history-popup-card .form-control,
[data-bs-theme="dark"] .history-popup-card .form-select,
[data-bs-theme="dark"] .history-popup-card .form-control,
[data-bs-theme="dark"] body .history-popup-card .form-select,
[data-bs-theme="dark"] body .history-popup-card .form-control {
    background-color: #2d3748 !important;
    background: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

html[data-bs-theme="dark"] .history-popup-card .form-select:focus,
html[data-bs-theme="dark"] .history-popup-card .form-control:focus,
html[data-bs-theme="dark"] body .history-popup-card .form-select:focus,
html[data-bs-theme="dark"] body .history-popup-card .form-control:focus,
[data-bs-theme="dark"] .history-popup-card .form-select:focus,
[data-bs-theme="dark"] .history-popup-card .form-control:focus,
[data-bs-theme="dark"] body .history-popup-card .form-select:focus,
[data-bs-theme="dark"] body .history-popup-card .form-control:focus {
    background-color: #2d3748 !important;
    background: #2d3748 !important;
    border-color: #3b82f6 !important;
    color: #e2e8f0 !important;
}

html[data-bs-theme="dark"] .history-popup-card .form-label,
html[data-bs-theme="dark"] body .history-popup-card .form-label,
[data-bs-theme="dark"] .history-popup-card .form-label,
[data-bs-theme="dark"] body .history-popup-card .form-label {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .history-popup-card .form-check-label,
[data-bs-theme="dark"] body .history-popup-card .form-check-label {
    color: #e2e8f0 !important;
}

/* Vehicle Info Panel - History Modal Dark Theme Support */
[data-bs-theme="dark"] .vip-history-modal,
[data-bs-theme="dark"] html .vip-history-modal,
[data-bs-theme="dark"] html body .vip-history-modal {
    background: #1a1d23 !important;
    background-color: #1a1d23 !important;
}

[data-bs-theme="dark"] .vip-history-header,
[data-bs-theme="dark"] html .vip-history-header,
[data-bs-theme="dark"] html body .vip-history-header {
    background-color: #1a1d23 !important;
    background: #1a1d23 !important;
    border-bottom-color: #2d3748 !important;
    border-bottom: 1px solid #2d3748 !important;
}

[data-bs-theme="dark"] .vip-history-header .vip-history-title,
[data-bs-theme="dark"] html .vip-history-header .vip-history-title,
[data-bs-theme="dark"] html body .vip-history-header .vip-history-title {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .vip-history-header .btn-close,
[data-bs-theme="dark"] html .vip-history-header .btn-close,
[data-bs-theme="dark"] html body .vip-history-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Location History Popup - Table dark theme support */
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td,
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: #1a1d23 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > td,
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > th {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > td,
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > th {
    background-color: #374151 !important;
    color: #fff !important;
}

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

[data-bs-theme="dark"] .table-bordered > thead > tr > th,
[data-bs-theme="dark"] .table-bordered > tbody > tr > th,
[data-bs-theme="dark"] .table-bordered > tfoot > tr > th,
[data-bs-theme="dark"] .table-bordered > thead > tr > td,
[data-bs-theme="dark"] .table-bordered > tbody > tr > td,
[data-bs-theme="dark"] .table-bordered > tfoot > tr > td {
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] .table thead.table-light th,
[data-bs-theme="dark"] .table tfoot.table-light th {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .table tbody td {
    color: #e2e8f0 !important;
}

/* Location History Popup - Light theme defaults for tables */
html:not([data-bs-theme="dark"]) body .table-striped > tbody > tr:nth-of-type(odd) > td,
html:not([data-bs-theme="dark"]) body .table-striped > tbody > tr:nth-of-type(odd) > th,
html:not([data-bs-theme="dark"]) .table-striped > tbody > tr:nth-of-type(odd) > td,
html:not([data-bs-theme="dark"]) .table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: transparent !important;
    color: #212529 !important;
}

html:not([data-bs-theme="dark"]) body .table-striped > tbody > tr:nth-of-type(even) > td,
html:not([data-bs-theme="dark"]) body .table-striped > tbody > tr:nth-of-type(even) > th,
html:not([data-bs-theme="dark"]) .table-striped > tbody > tr:nth-of-type(even) > td,
html:not([data-bs-theme="dark"]) .table-striped > tbody > tr:nth-of-type(even) > th {
    background-color: rgba(0, 0, 0, 0.02) !important;
    color: #212529 !important;
}

html:not([data-bs-theme="dark"]) body .table-hover > tbody > tr:hover > td,
html:not([data-bs-theme="dark"]) body .table-hover > tbody > tr:hover > th,
html:not([data-bs-theme="dark"]) .table-hover > tbody > tr:hover > td,
html:not([data-bs-theme="dark"]) .table-hover > tbody > tr:hover > th {
    background-color: rgba(0, 0, 0, 0.075) !important;
    color: #212529 !important;
}

html:not([data-bs-theme="dark"]) body .table-bordered,
html:not([data-bs-theme="dark"]) .table-bordered {
    border-color: #dee2e6 !important;
}

html:not([data-bs-theme="dark"]) body .table-bordered > thead > tr > th,
html:not([data-bs-theme="dark"]) body .table-bordered > tbody > tr > th,
html:not([data-bs-theme="dark"]) body .table-bordered > tfoot > tr > th,
html:not([data-bs-theme="dark"]) body .table-bordered > thead > tr > td,
html:not([data-bs-theme="dark"]) body .table-bordered > tbody > tr > td,
html:not([data-bs-theme="dark"]) body .table-bordered > tfoot > tr > td,
html:not([data-bs-theme="dark"]) .table-bordered > thead > tr > th,
html:not([data-bs-theme="dark"]) .table-bordered > tbody > tr > th,
html:not([data-bs-theme="dark"]) .table-bordered > tfoot > tr > th,
html:not([data-bs-theme="dark"]) .table-bordered > thead > tr > td,
html:not([data-bs-theme="dark"]) .table-bordered > tbody > tr > td,
html:not([data-bs-theme="dark"]) .table-bordered > tfoot > tr > td {
    border-color: #dee2e6 !important;
}

html:not([data-bs-theme="dark"]) body .table thead.table-light th,
html:not([data-bs-theme="dark"]) body .table tfoot.table-light th,
html:not([data-bs-theme="dark"]) .table thead.table-light th,
html:not([data-bs-theme="dark"]) .table tfoot.table-light th {
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #495057 !important;
}

html:not([data-bs-theme="dark"]) body .table tbody td,
html:not([data-bs-theme="dark"]) .table tbody td {
    color: #212529 !important;
}

/* DataTables dark theme support - Global for all report pages */
[data-bs-theme="dark"] .dataTables_wrapper {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #2d3748 !important;
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
}

/* DataTables pagination buttons - Make them bright white and visible in dark theme */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: #000000 !important;
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    font-weight: 600 !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    opacity: 0.7 !important;
}

/* Ensure pagination links are also white */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button a {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current a {
    color: #000000 !important;
}
