/* ============================================
   COMPREHENSIVE DARK MODE STYLES
   ============================================ */

/* Filter rows and backgrounds */
[data-theme="dark"] .filter-row,
[data-theme="dark"] .bg-light {
    background-color: #2d3748 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .bg-white {
    background-color: #1f2937 !important;
}

/* Labels */
[data-theme="dark"] label {
    color: #e4e4e4;
}

/* Content header / page titles */
[data-theme="dark"] .content-header h1,
[data-theme="dark"] .content-header .h1,
[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: #e4e4e4;
}

/* Card titles */
[data-theme="dark"] .card-title {
    color: #e4e4e4;
}

/* DataTables */
[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: #e4e4e4;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #e4e4e4 !important;
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #4b5563 !important;
    border-color: #6b7280 !important;
    color: #fff !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: #6b7280 !important;
    background-color: #1f2937 !important;
}
[data-theme="dark"] table.dataTable.table-striped > tbody > tr.odd > * {
    box-shadow: inset 0 0 0 9999px #2d3748;
}
[data-theme="dark"] table.dataTable tbody tr.selected,
[data-theme="dark"] table.dataTable tbody tr.selected > * {
    background-color: #3b82f6 !important;
    color: #fff !important;
}
[data-theme="dark"] .dataTables_empty {
    color: #9ca3af;
}

/* Select2 */
[data-theme="dark"] .select2-container--bootstrap4 .select2-selection,
[data-theme="dark"] .select2-container--default .select2-selection {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}
[data-theme="dark"] .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e4e4e4;
}
[data-theme="dark"] .select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder,
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af;
}
[data-theme="dark"] .select2-dropdown {
    background-color: #1f2937;
    border-color: #374151;
}
[data-theme="dark"] .select2-container--bootstrap4 .select2-results__option,
[data-theme="dark"] .select2-container--default .select2-results__option {
    color: #e4e4e4;
}
[data-theme="dark"] .select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected],
[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6;
    color: #fff;
}
[data-theme="dark"] .select2-container--bootstrap4 .select2-results__option[aria-selected=true],
[data-theme="dark"] .select2-container--default .select2-results__option--selected {
    background-color: #374151;
}
[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}
[data-theme="dark"] .select2-container--bootstrap4 .select2-selection__arrow b,
[data-theme="dark"] .select2-container--default .select2-selection__arrow b {
    border-color: #9ca3af transparent transparent transparent;
}

/* Badges */
[data-theme="dark"] .badge.bg-light {
    background-color: #374151 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .badge.text-dark {
    color: #e4e4e4 !important;
}

/* Borders */
[data-theme="dark"] .border {
    border-color: #374151 !important;
}
[data-theme="dark"] .border-bottom {
    border-bottom-color: #374151 !important;
}
[data-theme="dark"] .border-top {
    border-top-color: #374151 !important;
}

/* Text utilities */
[data-theme="dark"] .text-dark {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .text-muted {
    color: #9ca3af !important;
}
[data-theme="dark"] .text-body {
    color: #e4e4e4 !important;
}

/* Inputs and textareas */
[data-theme="dark"] textarea.form-control {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="search"] {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #9ca3af;
}

/* AdminLTE specific backgrounds */
[data-theme="dark"] .bg-lightblue {
    background-color: #1e3a5f !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .bg-lightgreen {
    background-color: #1e3a2f !important;
    color: #e4e4e4 !important;
}

/* Info boxes */
[data-theme="dark"] .info-box {
    background-color: #1f2937;
    color: #e4e4e4;
}
[data-theme="dark"] .info-box-content {
    color: #e4e4e4;
}

/* Pagination */
[data-theme="dark"] .pagination .page-link {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}
[data-theme="dark"] .pagination .page-link:hover {
    background-color: #4b5563;
    color: #fff;
}
[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
[data-theme="dark"] .pagination .page-item.disabled .page-link {
    background-color: #1f2937;
    color: #6b7280;
}

/* Editable fields in tables */
[data-theme="dark"] .editable {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}

/* Nav tabs */
[data-theme="dark"] .nav-tabs {
    border-bottom-color: #374151;
}
[data-theme="dark"] .nav-tabs .nav-link {
    color: #9ca3af;
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
    border-color: #374151 #374151 transparent;
    color: #e4e4e4;
}
[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1f2937;
    border-color: #374151 #374151 #1f2937;
    color: #e4e4e4;
}
[data-theme="dark"] .tab-content {
    background-color: #1f2937;
}

/* Progress bars */
[data-theme="dark"] .progress {
    background-color: #374151;
}

/* Close button for modals/alerts */
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Accordion */
[data-theme="dark"] .accordion-item {
    background-color: #1f2937;
    border-color: #374151;
}
[data-theme="dark"] .accordion-button {
    background-color: #1f2937;
    color: #e4e4e4;
}
[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #2d3748;
    color: #e4e4e4;
}
[data-theme="dark"] .accordion-button::after {
    filter: invert(1);
}

/* Popover */
[data-theme="dark"] .popover {
    background-color: #1f2937;
    border-color: #374151;
}
[data-theme="dark"] .popover-header {
    background-color: #111827;
    border-color: #374151;
    color: #e4e4e4;
}
[data-theme="dark"] .popover-body {
    color: #e4e4e4;
}

/* Tooltip */
[data-theme="dark"] .tooltip-inner {
    background-color: #374151;
    color: #e4e4e4;
}

/* Disabled inputs */
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background-color: #2d3748;
    color: #9ca3af;
}

/* Input groups */
[data-theme="dark"] .input-group-text {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}

/* Rounded boxes with background */
[data-theme="dark"] .rounded.p-2[style*="background"],
[data-theme="dark"] div[class*="border rounded"] {
    background-color: #2d3748 !important;
    color: #e4e4e4 !important;
}

/* Off-canvas / sidebar panels */
[data-theme="dark"] .offcanvas {
    background-color: #1f2937;
    color: #e4e4e4;
}
[data-theme="dark"] .offcanvas-header {
    border-bottom-color: #374151;
}

/* Toast */
[data-theme="dark"] .toast {
    background-color: #1f2937;
    border-color: #374151;
}
[data-theme="dark"] .toast-header {
    background-color: #111827;
    border-bottom-color: #374151;
    color: #e4e4e4;
}
[data-theme="dark"] .toast-body {
    color: #e4e4e4;
}

/* Calendar/date picker */
[data-theme="dark"] .datepicker {
    background-color: #1f2937;
    border-color: #374151;
}
[data-theme="dark"] .datepicker table {
    color: #e4e4e4;
}
[data-theme="dark"] .datepicker .datepicker-switch,
[data-theme="dark"] .datepicker .prev,
[data-theme="dark"] .datepicker .next {
    color: #e4e4e4;
}
[data-theme="dark"] .datepicker .datepicker-switch:hover,
[data-theme="dark"] .datepicker .prev:hover,
[data-theme="dark"] .datepicker .next:hover {
    background-color: #374151;
}
[data-theme="dark"] .datepicker td.day:hover {
    background-color: #374151;
}
[data-theme="dark"] .datepicker td.active {
    background-color: #3b82f6 !important;
}

/* jQuery UI autocomplete */
[data-theme="dark"] .ui-autocomplete {
    background-color: #1f2937;
    border-color: #374151;
}
[data-theme="dark"] .ui-menu-item {
    color: #e4e4e4;
}
[data-theme="dark"] .ui-menu-item:hover,
[data-theme="dark"] .ui-state-active {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

/* Spinner/loading */
[data-theme="dark"] #loadingSpinner,
[data-theme="dark"] .loading-spinner {
    color: #e4e4e4;
}

/* Empty state messages */
[data-theme="dark"] .empty-state,
[data-theme="dark"] .no-data {
    color: #9ca3af;
}

/* Custom scrollbar for dark mode */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1f2937;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 5px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Additional page-specific dark mode styles */

/* Container info boxes */
[data-theme="dark"] .container-info {
    background-color: #2d3748 !important;
    color: #e4e4e4 !important;
}

/* CRM specific styles */
[data-theme="dark"] .timeline-card {
    background-color: #1f2937 !important;
    border-color: #374151;
}
[data-theme="dark"] .timeline-card.cancelled {
    background-color: #3d1f1f !important;
}
[data-theme="dark"] .selection-header {
    background-color: #1f2937 !important;
}
[data-theme="dark"] .stat-card {
    background-color: #1f2937 !important;
}
[data-theme="dark"] .quick-action-btn {
    background-color: #374151 !important;
    color: #e4e4e4 !important;
    border-color: #4b5563 !important;
}
[data-theme="dark"] .quick-action-btn:hover {
    background-color: #4b5563 !important;
}

/* General white backgrounds */
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #fff"] {
    background-color: #1f2937 !important;
}

/* Override inline styles for common elements */
[data-theme="dark"] .card,
[data-theme="dark"] .panel,
[data-theme="dark"] .box {
    background-color: #1f2937 !important;
}

/* Main footer */
[data-theme="dark"] .main-footer {
    background-color: #1f2937;
    border-top-color: #374151;
    color: #9ca3af;
}

/* Disclaimer */
[data-theme="dark"] .disclaimer,
[data-theme="dark"] #disclaimer {
    background-color: #1f2937;
    color: #9ca3af;
}

/* DataTables processing message */
[data-theme="dark"] .dataTables_processing {
    background-color: #1f2937;
    color: #e4e4e4;
}

/* SweetAlert2 */
[data-theme="dark"] .swal2-popup {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .swal2-title {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .swal2-html-container {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .swal2-input {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    color: #e4e4e4 !important;
}

/* Fullcalendar */
[data-theme="dark"] .fc {
    --fc-page-bg-color: #1f2937;
    --fc-neutral-bg-color: #2d3748;
    --fc-border-color: #374151;
}
[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard th {
    border-color: #374151;
}
[data-theme="dark"] .fc .fc-daygrid-day-number {
    color: #e4e4e4;
}
[data-theme="dark"] .fc .fc-col-header-cell-cushion {
    color: #e4e4e4;
}

/* Table bordered explicit */
[data-theme="dark"] .table-bordered {
    border-color: #374151;
}
[data-theme="dark"] .table-bordered th,
[data-theme="dark"] .table-bordered td {
    border-color: #374151;
}

/* Table responsive wrapper */
[data-theme="dark"] .table-responsive {
    background-color: transparent;
}

/* Loading overlay */
[data-theme="dark"] #loadingOverlay,
[data-theme="dark"] .loading-overlay {
    background-color: rgba(31, 41, 55, 0.9);
}

/* Error/Alert boxes */
[data-theme="dark"] .alert-info {
    background-color: #1e3a5f;
    border-color: #2d5a8a;
    color: #93c5fd;
}
[data-theme="dark"] .alert-success {
    background-color: #1e3a2f;
    border-color: #2d5a4a;
    color: #86efac;
}
[data-theme="dark"] .alert-warning {
    background-color: #3d3a1f;
    border-color: #5a5a2d;
    color: #fde68a;
}
[data-theme="dark"] .alert-danger {
    background-color: #3d1f1f;
    border-color: #5a2d2d;
    color: #fca5a5;
}

/* Inline form controls within cards */
[data-theme="dark"] .card .form-control,
[data-theme="dark"] .card .form-select,
[data-theme="dark"] .modal .form-control,
[data-theme="dark"] .modal .form-select {
    background-color: #374151;
    border-color: #4b5563;
    color: #e4e4e4;
}

/* Fix Bootstrap table striped */
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #2d3748;
    color: #e4e4e4;
}

/* Fix table hover */
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #374151;
    color: #e4e4e4;
}

/* ===========================================
   COMPREHENSIVE TABLE TEXT COLOR FIXES
   =========================================== */

/* Force all table cells to have light text in dark mode */
[data-theme="dark"] table td,
[data-theme="dark"] table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] table tbody td,
[data-theme="dark"] table tbody th,
[data-theme="dark"] .table tbody td,
[data-theme="dark"] .table tbody th {
    color: #e4e4e4 !important;
}

/* DataTables specific - all cells */
[data-theme="dark"] table.dataTable td,
[data-theme="dark"] table.dataTable th,
[data-theme="dark"] table.dataTable tbody td,
[data-theme="dark"] table.dataTable tbody th {
    color: #e4e4e4 !important;
}

/* Fix striped table rows - both odd and even */
[data-theme="dark"] .table-striped > tbody > tr > *,
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *,
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > * {
    color: #e4e4e4 !important;
}

/* DataTables striped - both odd and even */
[data-theme="dark"] table.dataTable.table-striped > tbody > tr > *,
[data-theme="dark"] table.dataTable.table-striped > tbody > tr.odd > *,
[data-theme="dark"] table.dataTable.table-striped > tbody > tr.even > * {
    color: #e4e4e4 !important;
}

/* Table hover rows */
[data-theme="dark"] .table-hover > tbody > tr:hover > *,
[data-theme="dark"] table.dataTable.table-hover > tbody > tr:hover > * {
    color: #e4e4e4 !important;
}

/* Bootstrap 5 table variables override */
[data-theme="dark"] .table {
    --bs-table-color: #e4e4e4;
    --bs-table-bg: #1f2937;
    --bs-table-border-color: #374151;
    --bs-table-striped-color: #e4e4e4;
    --bs-table-striped-bg: #2d3748;
    --bs-table-hover-color: #e4e4e4;
    --bs-table-hover-bg: #374151;
    color: #e4e4e4;
}

/* Form check labels (radio buttons, checkboxes) */
[data-theme="dark"] .form-check-label {
    color: #e4e4e4;
}

/* All paragraph and span text */
[data-theme="dark"] p,
[data-theme="dark"] span:not(.badge):not(.status-badge):not([class*="btn"]) {
    color: #e4e4e4;
}

/* Select option text */
[data-theme="dark"] select option {
    background-color: #374151;
    color: #e4e4e4;
}

/* Small text and help text */
[data-theme="dark"] small,
[data-theme="dark"] .small,
[data-theme="dark"] .form-text,
[data-theme="dark"] .help-block {
    color: #9ca3af !important;
}

/* ===========================================
   CRM PAGE SPECIFIC DARK MODE STYLES
   =========================================== */

/* Timeline cards */
[data-theme="dark"] .timeline-card {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
}
[data-theme="dark"] .timeline-card.cancelled {
    background-color: #3d1f1f !important;
}
[data-theme="dark"] .timeline-title {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .timeline-desc {
    color: #9ca3af !important;
}
[data-theme="dark"] .timeline-date {
    color: #9ca3af !important;
}
[data-theme="dark"] .timeline-wrapper::before {
    background: linear-gradient(to bottom, #374151, transparent);
}

/* Stat cards */
[data-theme="dark"] .stat-card {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .stat-value {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .stat-label {
    color: #9ca3af !important;
}

/* Filter pills */
[data-theme="dark"] .filter-pill {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .filter-pill:hover {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}
[data-theme="dark"] .filter-pill.active {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}
[data-theme="dark"] .filter-pill .count {
    background: rgba(255,255,255,0.1);
}

/* Quick actions */
[data-theme="dark"] .quick-action {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
[data-theme="dark"] .quick-action:hover {
    border-color: #3b82f6 !important;
}
[data-theme="dark"] .quick-action-text {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .quick-action-text small {
    color: #9ca3af !important;
}

/* Follow-up items */
[data-theme="dark"] .followup-item {
    background-color: #2d3748 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .followup-item:hover {
    background-color: #374151 !important;
}
[data-theme="dark"] .followup-date .day {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .followup-date .month {
    color: #9ca3af !important;
}
[data-theme="dark"] .followup-supplier {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .followup-note {
    color: #9ca3af !important;
}
[data-theme="dark"] .followup-today {
    background-color: #3d3a1f !important;
}

/* Tag suggestions */
[data-theme="dark"] .tag-suggestions {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}
[data-theme="dark"] .tag-suggestion {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .tag-suggestion:hover {
    background-color: #374151 !important;
}

/* Selection cards */
[data-theme="dark"] .selection-card {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .selection-card.active {
    background: linear-gradient(135deg, #1f2937 0%, #2d3748 100%) !important;
    border-color: #3b82f6 !important;
}
[data-theme="dark"] .selection-card h5,
[data-theme="dark"] .selection-card h6,
[data-theme="dark"] .selection-card .card-title {
    color: #e4e4e4 !important;
}
[data-theme="dark"] .selection-card p,
[data-theme="dark"] .selection-card .text-muted {
    color: #9ca3af !important;
}

/* Notes section */
[data-theme="dark"] .notes-list .note-item,
[data-theme="dark"] .note-card {
    background-color: #2d3748 !important;
    border-color: #374151 !important;
    color: #e4e4e4 !important;
}

/* Lead list items */
[data-theme="dark"] .lead-item,
[data-theme="dark"] .lead-card {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .lead-item:hover,
[data-theme="dark"] .lead-card:hover {
    background-color: #2d3748 !important;
}

/* Section headers */
[data-theme="dark"] .section-header,
[data-theme="dark"] .card-header h5,
[data-theme="dark"] .card-header h3 {
    color: #e4e4e4 !important;
}

/* Generic white buttons - convert to dark */
[data-theme="dark"] .btn-light {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .btn-light:hover {
    background-color: #4b5563 !important;
    border-color: #6b7280 !important;
    color: #fff !important;
}

/* Outline buttons */
[data-theme="dark"] .btn-outline-secondary {
    border-color: #4b5563 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #4b5563 !important;
    color: #fff !important;
}
[data-theme="dark"] .btn-outline-primary {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}
[data-theme="dark"] .btn-outline-primary:hover {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

/* White/default buttons */
[data-theme="dark"] .btn-white,
[data-theme="dark"] .btn-default {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    color: #e4e4e4 !important;
}
[data-theme="dark"] .btn-default:hover,
[data-theme="dark"] .btn-white:hover {
    background-color: #4b5563 !important;
    color: #fff !important;
}

/* CRM search section */
[data-theme="dark"] #crmSearch,
[data-theme="dark"] .crm-search-section {
    background-color: #1f2937 !important;
}

/* Dashboard widgets */
[data-theme="dark"] .dashboard-widget,
[data-theme="dark"] .widget-card {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}

/* Calendar events */
[data-theme="dark"] .fc-daygrid-event {
    color: #fff !important;
}

/* Links inside cards */
[data-theme="dark"] .card a:not(.btn) {
    color: #60a5fa !important;
}

/* Generic icon text */
[data-theme="dark"] .icon-text,
[data-theme="dark"] .info-text {
    color: #e4e4e4 !important;
}

/* Activity log items */
[data-theme="dark"] .activity-item,
[data-theme="dark"] .log-item {
    background-color: #2d3748 !important;
    color: #e4e4e4 !important;
    border-color: #374151 !important;
}

/* Contact cards */
[data-theme="dark"] .contact-card,
[data-theme="dark"] .contact-item {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}

/* Generic list items with white background */
[data-theme="dark"] .list-item,
[data-theme="dark"] .item-card {
    background-color: #1f2937 !important;
    color: #e4e4e4 !important;
}

/* Modals specific */
[data-theme="dark"] .modal-body p,
[data-theme="dark"] .modal-body span,
[data-theme="dark"] .modal-body label {
    color: #e4e4e4 !important;
}

/* Charts background */
[data-theme="dark"] .chart-container,
[data-theme="dark"] .chart-wrapper {
    background-color: #1f2937 !important;
}

/* Empty state messages */
[data-theme="dark"] .empty-message,
[data-theme="dark"] .no-results {
    color: #9ca3af !important;
}

/* Search result highlights */
[data-theme="dark"] .search-highlight {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

/* Card footer */
[data-theme="dark"] .card-footer {
    background-color: #111827 !important;
    border-top-color: #374151 !important;
    color: #e4e4e4 !important;
}

/* ===========================================
   DATATABLES RESPONSIVE CONTROL VISIBILITY
   =========================================== */

/* Hide the dtr-control column when no child rows exist */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:empty::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:empty::before {
    display: none !important;
}

/* Hide control when row has no hidden columns (no child data) */
table.dataTable.dtr-inline.collapsed > tbody > tr:not(.dtr-expanded):not(.parent) > td.dtr-control.no-expand::before {
    display: none !important;
}

/* Better approach: Hide entire first column when table is not collapsed */
table.dataTable:not(.collapsed) > tbody > tr > td.dtr-control::before,
table.dataTable:not(.collapsed) > thead > tr > th.dtr-control::before {
    display: none !important;
}

/* Hide the + icon completely when row has no expandable content */
table.dataTable.dtr-inline.collapsed > tbody > tr.no-child > td.dtr-control::before {
    display: none !important;
    content: none !important;
}

/* Alternative: Use visibility to keep spacing but hide icon */
table.dataTable > tbody > tr.no-child > td.dtr-control::before {
    visibility: hidden !important;
}
