/* ====================================================
   Global Dark Mode Overrides
==================================================== */
body.dark {
    background-color: #212121 !important;
    color: #ffffff !important;
}

/* Secondary & Primary Surface Backgrounds */
body.dark .bg-surface-secondary {
    background-color: #212121 !important;
}
body.dark .bg-surface-primary {
    background-color: #212121 !important;
}

/* Force .bg-white Elements to use dark background */
body.dark .bg-white {
    background-color: #212121 !important;
}

/* ====================================================
   Navbar & Page Title Overrides
==================================================== */
/* Navbar Header and Navbar Containers */
body.dark #navHeaderContainer,
body.dark #navbarContainer {
    background: #212121 !important;
}

/* Page Title */
body.dark #pageTitle {
    color: #ffffff !important;
}

/* Navbar Icons & Links */
body.dark .navbar i,
body.dark .navbar svg,
body.dark .navbar-vertical i,
body.dark .navbar-vertical svg {
    color: #ffffff !important;
}
body.dark .navbar .nav-link,
body.dark .navbar-vertical .nav-link {
    color: #ffffff !important;
}

/* Navbar Toggler Icon */
body.dark .navbar-toggler-icon {
    filter: invert(1);
}

/* ====================================================
   Navbar & Nav-tabs Active/Hover Overrides
==================================================== */
/* Navbar Links Hover/Focus */
body.dark .navbar .nav-link:hover,
body.dark .navbar .nav-link:focus,
body.dark .navbar-vertical .nav-link:hover,
body.dark .navbar-vertical .nav-link:focus {
    color: #ee1300 !important;
    background-color: #2a2a2a !important; /* Keep as is if desired */
}

/* Nav-tabs Default State (Non-selected) */
body.dark .nav-tabs .nav-link {
    color: #ffffff !important;
    border-color: #000 !important;
}

/* Modal Tabs Overrides */
body.dark .modal .nav-tabs .nav-link {
    color: #ffffff !important;
}
body.dark .modal .nav-tabs .nav-link.active,
body.dark .modal .nav-tabs .nav-link:hover,
body.dark .modal .nav-tabs .nav-link:focus {
    color: #ee1300 !important;
    border-color: transparent transparent #ee1300 !important;
}

/* ====================================================
   Modal Header, Body, & Close Button Overrides
==================================================== */
body.dark .modal-header {
    background-color: #212121 !important;
    color: #ffffff !important;
    border-bottom: 1px solid #000 !important;
}
body.dark .modal-body {
    background-color: #212121 !important;
    color: #ffffff !important;
    border-bottom-left-radius: calc(0.75rem - 1px);
    border-bottom-right-radius: calc(0.75rem - 1px);
}
body.dark .btn-close {
    filter: invert(1) brightness(2) !important;
}

/* ====================================================
   Form Labels
==================================================== */
body.dark label {
    color: #ffffff !important;
}

/* ====================================================
   Universal Border & HR Overrides
==================================================== */
body.dark * {
    border-color: #000 !important;
}
body.dark hr {
    background-color: #000 !important;
}

/* ====================================================
   Card Overrides
==================================================== */
body.dark .card-header {
    background-color: #1c1c1c !important;
    color: #FFFFFF !important;
    border-bottom: 1px solid #000;
    border-radius: calc(0.75rem - 3px) calc(0.75rem - 3px) 0 0;
    overflow: hidden; /* Prevents bleed-through */
}
body.dark .card-body {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border-radius: 0 0 calc(0.75rem - 3px) calc(0.75rem - 3px);
    overflow: hidden; /* Prevents bleed-through */
}
body.dark .card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-clip: border-box;
    border: 1px solid #000 !important;
    border-radius: .75rem;
}
body.dark h6,
body.dark .h3 {
    color: #ffffff !important;
}

body.dark h3 {
    color: #ffffff !important;
}

body.dark h5 {
    color: #ffffff !important;
}

/* ====================================================
   Modal Content Overrides
==================================================== */
body.dark .modal-content {
    background-color: #282c34 !important;
    color: #ffffff !important;
    border-color: #4e555c;
}

body.dark .modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #e7eaf0;
    background-color: #212121 !important;
    border-bottom-right-radius: calc(0.75rem - 1px);
    border-bottom-left-radius: calc(0.75rem - 1px);
}

/* ====================================================
   List Group Items
==================================================== */
body.dark .list-group-item {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border-color: #4e555c !important;
}

/* Nav-tabs Active State */
body.dark .nav-tabs .nav-link.active,
body.dark .nav-tabs .nav-item.show .nav-link {
    color: #ee1300 !important;
    border-color: transparent transparent #ee1300 !important;
}

body.dark .alert-warning {
    color: #000000;               /* softer red for dark bg */
    background-color: #d76363;    /* deep muted red background */
    border-color: #d33333;        /* darker red border */
}

/* ====================================================
   Toggle Switch Overrides (Preserve Existing Styles)
==================================================== */
#switch .checkbox {
    opacity: 0;
    position: absolute;
}
#switch .bi {
    font-size: 8px;
}
#switch .label {
    background-color: #e8eaf0;
    border-radius: 20px;
    outline: #d7d7d7 1px solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    height: 15px;
    width: 30px;
    transform: scale(1.5);
}
#switch .label .ball {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 11px;
    width: 11px;
    transform: translateX(0px);
    transition: transform 0.2s linear;
}
#switch .checkbox:checked + .label .ball {
    transform: translateX(15px);
}
#switch .bi-moon-fill {
    color: #ee1300;
}
#switch .bi-brightness-high-fill {
    color: #ee1300;
}

/* Notification Dropdown Overrides */
body.dark #notificationDropdown {
    background-color: #212121 !important;
    border-color: #000 !important;
    color: #ffffff !important;
}
body.dark #notificationDropdown i {
    color: #ffffff !important;
}
body.dark .dropdown-menu {
    background-color: #212121 !important;
    border-color: #000 !important;
    color: #ffffff !important;
}
body.dark .dropdown-menu li,
body.dark .dropdown-menu a {
    color: #ffffff !important;
}
body.dark #switch .label {
    background-color: #1c1c1c !important;
    outline: 0.5px solid #000 !important;
    border-radius: 20px;
}
body.dark #switch .label .ball {
    background-color: #fff;
}
#switch .bi-moon-fill,
#switch .bi-brightness-high-fill {
    color: #ee1300;
}

/* ====================================================
   Form Controls Overrides
==================================================== */
body.dark input[type="text"],
body.dark input[type="email"],
body.dark input[type="password"],
body.dark input[type="number"],
body.dark textarea{
    background-color: #212121 !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;}

body.dark select {
    background-color: #212121 !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='2' viewBox='0 0 10 7'%3E%3Cpath fill='%23ffffff' d='M5 7L0 0h10L5 7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2em center;
}
body.dark .form-control {
    background-color: #212121 !important;
    color: #ffffff !important;
}

/* Dark Mode Override for the "Add New Note" Textarea */
body.dark #profileNewNoteText {
    color: #ffffff !important;
}
body.dark textarea#profileNewNoteText::placeholder {
    color: #888888 !important;
}
/* ====================================================
   Grid.js Dark Mode Overrides
==================================================== */
body.dark .gridjs-container {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
}
body.dark .gridjs-head {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
}
body.dark .gridjs-search {
    background-color: #282c34 !important;
    color: #ffffff !important;
}
body.dark .gridjs-input {
    background-color: #212121 !important;
    color: #ffffff !important;
}
body.dark .gridjs-wrapper {
    background-color: #282c34 !important;
}
body.dark .gridjs-table {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border-collapse: collapse;
}
body.dark .gridjs-thead {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
}
body.dark .gridjs-th {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
}
body.dark .gridjs-td {
    background-color: #212121 !important;
    color: #ffffff !important;
}
body.dark .gridjs-footer {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
}
body.dark .gridjs-pagination {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
}
body.dark .gridjs-summary {
    color: #ffffff !important;
}
body.dark .gridjs-pages button {
    background-color: #212121 !important;
    color: #ffffff !important;
}
body.dark .gridjs-currentPage {
    background-color: #212121 !important;
    color: #ee1300 !important;
    border: 1px solid #000 !important;
}

/* ====================================================
   SweetAlert2 Dark Mode Overrides
==================================================== */
body.dark .swal2-popup {
    background-color: #282c34 !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
}
body.dark .swal2-title,
body.dark .swal2-html-container {
    color: #ffffff !important;
}
body.dark .swal2-close {
    filter: invert(1) brightness(2) !important;
    color: #ffffff !important;
}
body.dark .swal2-input {
    background-color: #282c34 !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
}
body.dark .swal2-confirm,
body.dark .swal2-cancel {
    background-color: #212121 !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
}

body.dark #contractModal .table-sm tbody td,
body.dark #contractModal .table-striped tbody td {
    color: #fff !important;
}

#sourceRevenueTableBody td { color:#000; }

/* dark-mode override */
body.dark #sourceRevenueTableBody td { color:#fff; }

body.dark #client-create-dealStatus .form-check-label {
    color: #ffffff;
}

body.dark #ccpDealStatus .form-check-label {
    color: #ffffff ;
}

/* ===============================================
   Credits Lookup – Dark Mode Additions
================================================ */

/* Details placeholder card */
body.dark #detailsPlaceholder {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
}

body.dark #detailsCard .card-footer,
body.dark .card-footer.d-flex.justify-content-between {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border-top: 1px solid #000 !important;
}

/* “Light” badges (source chips) need dark skin */
body.dark .badge.bg-light.text-dark.border {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
    border-color: #000 !important;
}

/* Confidence pill readability */
body.dark #confidenceBadge.badge {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
    border: 1px solid #000 !important;
}

/* Table striping/hover (vanilla fallback renderer) */
body.dark #creditsResultsGrid table.table {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border-color: #000 !important;
}
body.dark #creditsResultsGrid table.table tbody tr:hover {
    background-color: #2a2a2a !important;
}

body.dark #detailsCard,
body.dark #creditsLookupContainer .card,
body.dark #creditsLookupContainer .modal-content {
    background-color: #1c1c1c !important;
    border: 1px solid #000 !important;
    border-radius: 0.75rem;
    overflow: hidden; /* trims white corners */
    background-clip: border-box !important;
}

/* Advances card only */
body.dark #client-create-gridjs-table-advances,
body.dark #client-create-gridjs-table-advances .gridjs,
body.dark #client-create-gridjs-table-advances .gridjs-container,
body.dark #client-create-gridjs-table-advances .gridjs-wrapper,
body.dark #client-create-gridjs-table-advances .gridjs-table,
body.dark #client-create-gridjs-table-advances .gridjs-head,
body.dark #client-create-gridjs-table-advances .gridjs-footer,
body.dark #client-create-gridjs-table-advances .gridjs-pagination,
body.dark #client-create-gridjs-table-advances .gridjs-summary,
body.dark #client-create-gridjs-table-advances .gridjs-pages {
    background-color: #1c1c1c !important;
    border-color: #000 !important;
}

/* Remove any accidental bottom margins that can expose the parent bg */
body.dark #client-create-gridjs-table-advances .gridjs-footer,
body.dark #client-create-gridjs-table-advances .gridjs-wrapper,
body.dark #client-create-gridjs-table-advances .gridjs-table {
    margin-bottom: 0 !important;
}

/* Make sure no hr/border lines show light colors down there */
body.dark #client-create-gridjs-table-advances hr,
body.dark #client-create-gridjs-table-advances * {
    border-color: #000 !important;
}

/* Optional: if Grid.js injects any pseudo separators, nuke them */
body.dark #client-create-gridjs-table-advances .gridjs-footer::before,
body.dark #client-create-gridjs-table-advances .gridjs-wrapper::after {
    content: none !important;
}

 body.dark #client-create-gridjs-table-costs,
 body.dark #client-create-gridjs-table-costs .gridjs,
 body.dark #client-create-gridjs-table-costs .gridjs-container,
 body.dark #client-create-gridjs-table-costs .gridjs-wrapper,
 body.dark #client-create-gridjs-table-costs .gridjs-table,
 body.dark #client-create-gridjs-table-costs .gridjs-head,
 body.dark #client-create-gridjs-table-costs .gridjs-footer,
 body.dark #client-create-gridjs-table-costs .gridjs-pagination,
 body.dark #client-create-gridjs-table-costs .gridjs-summary,
 body.dark #client-create-gridjs-table-costs .gridjs-pages {
     background-color: #1c1c1c !important;
     border-color: #000 !important;
 }

/* Remove any accidental bottom margins that can expose the parent bg */
body.dark #client-create-gridjs-table-costs .gridjs-footer,
body.dark #client-create-gridjs-table-costs .gridjs-wrapper,
body.dark #client-create-gridjs-table-costs .gridjs-table {
    margin-bottom: 0 !important;
}

/* Make sure no hr/border lines show light colors down there */
body.dark #client-create-gridjs-table-costs hr,
body.dark #client-create-gridjs-table-costs * {
    border-color: #000 !important;
}

/* Optional: if Grid.js injects any pseudo separators, nuke them */
body.dark #client-create-gridjs-table-costs .gridjs-footer::before,
body.dark #client-create-gridjs-table-costs .gridjs-wrapper::after {
    content: none !important;
}