/* Dark Mode Overrides */
body.dark-mode {
    background-color: #111827 !important;
    color: #f3f4f6 !important;
}

body.dark-mode .tw-bg-gray-100,
body.dark-mode .tw-bg-gray-50 {
    background-color: #111827 !important;
}

body.dark-mode .tw-bg-white {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
}

body.dark-mode .tw-text-gray-900,
body.dark-mode .tw-text-gray-800,
body.dark-mode .tw-text-gray-700,
body.dark-mode .tw-text-gray-600 {
    color: #d1d5db !important;
}

/* Sidebar */
body.dark-mode .side-bar,
body.dark-mode .main-sidebar {
    background-color: #1f2937 !important;
    border-right-color: #374151 !important;
}

body.dark-mode .side-bar-heading {
    color: #f3f4f6 !important;
}

/* Content wrapper */
body.dark-mode .content-wrapper,
body.dark-mode .right-side,
body.dark-mode main {
    background-color: #111827 !important;
}

/* Boxes/Cards */
body.dark-mode .box {
    background-color: #1f2937 !important;
    border-top-color: #3b82f6 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .box-header {
    color: #f3f4f6 !important;
    border-bottom-color: #374151 !important;
}

body.dark-mode .box-body,
body.dark-mode .box-footer {
    color: #e5e7eb !important;
    background-color: #1f2937 !important;
    border-top-color: #374151 !important;
}

/* Headers & text */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #f3f4f6 !important;
}

/* Tables */
body.dark-mode table,
body.dark-mode .table,
body.dark-mode .table>tbody>tr>td,
body.dark-mode .table>tbody>tr>th {
    color: #e5e7eb !important;
    background-color: transparent !important;
    border-color: #374151 !important;
}

body.dark-mode .table-striped>tbody>tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-mode .table-bordered,
body.dark-mode .table-bordered>thead>tr>th,
body.dark-mode .table-bordered>tbody>tr>th,
body.dark-mode .table-bordered>tfoot>tr>th,
body.dark-mode .table-bordered>thead>tr>td,
body.dark-mode .table-bordered>tbody>tr>td,
body.dark-mode .table-bordered>tfoot>tr>td {
    border-color: #374151 !important;
}

body.dark-mode table.dataTable tbody tr {
    background-color: #1f2937 !important;
}

body.dark-mode table.dataTable tbody tr:hover,
body.dark-mode .table-hover>tbody>tr:hover {
    background-color: #374151 !important;
}

/* Tabs */
body.dark-mode .nav-tabs-custom>.nav-tabs>li.active>a,
body.dark-mode .nav-tabs-custom>.nav-tabs>li.active:hover>a {
    background-color: #1f2937 !important;
    color: #f3f4f6 !important;
    border-color: transparent !important;
    border-left-color: #374151 !important;
    border-right-color: #374151 !important;
}

body.dark-mode .nav-tabs-custom>.nav-tabs {
    border-bottom-color: #374151 !important;
}

body.dark-mode .nav-tabs-custom>.tab-content {
    background: #1f2937 !important;
}

/* Modals */
body.dark-mode .modal-content {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
}

body.dark-mode .modal-header {
    border-bottom-color: #374151 !important;
}

body.dark-mode .modal-footer {
    border-top-color: #374151 !important;
}

body.dark-mode .close {
    color: #f3f4f6 !important;
    text-shadow: none !important;
    opacity: 0.8 !important;
}

body.dark-mode .close:hover {
    opacity: 1 !important;
}

/* Forms */
body.dark-mode .form-control {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
}

body.dark-mode .form-control:focus {
    background-color: #4b5563 !important;
    border-color: #60a5fa !important;
}

body.dark-mode select.form-control {
    background-color: #374151 !important;
}

body.dark-mode .input-group-addon {
    background-color: #4b5563 !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
}

body.dark-mode .select2-container--default .select2-selection--single,
body.dark-mode .select2-container--default .select2-selection--multiple {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered,
body.dark-mode .select2-container--default .select2-selection--multiple .select2-selection__choice {
    color: #f3f4f6 !important;
}

body.dark-mode .select2-dropdown {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}

body.dark-mode .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #4b5563 !important;
}

body.dark-mode .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6 !important;
}

/* Dropdowns / Menus */
body.dark-mode .dropdown-menu {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

body.dark-mode .dropdown-menu>li>a {
    color: #d1d5db !important;
}

body.dark-mode .dropdown-menu>li>a:hover {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
}

/* Tailwind specific overrides */
body.dark-mode .tw-bg-gray-200 {
    background-color: #374151 !important;
}

body.dark-mode .tw-ring-gray-200 {
    --tw-ring-color: #374151 !important;
}

/* PDF Tables / Special POS styles */
body.dark-mode .table-pdf thead tr {
    background-color: #1f2937 !important;
}

body.dark-mode .table-pdf .odd {
    background-color: #374151 !important;
}

body.dark-mode .pos-tab-content {
    background-color: #1f2937 !important;
}

body.dark-mode .pos-tab-container {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

/* Info boxes */
body.dark-mode .info-box {
    background-color: #1f2937 !important;
    border: 1px solid #374151;
}

body.dark-mode .info-box-text,
body.dark-mode .info-box-number {
    color: #e5e7eb !important;
}

/* Fix pagination */
body.dark-mode .pagination>li>a,
body.dark-mode .pagination>li>span {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    color: #a5b4fc !important;
}

body.dark-mode .pagination>li>a:hover,
body.dark-mode .pagination>li>span:hover {
    background-color: #374151 !important;
    color: #eff6ff !important;
}

body.dark-mode .pagination>.active>a,
body.dark-mode .pagination>.active>span {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

body.dark-mode .pagination>.disabled>a,
body.dark-mode .pagination>.disabled>span {
    color: #6b7280 !important;
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

/* Dashboard specific */
body.dark-mode .box.box-solid[class*="bg"] {
    color: #fff !important;
}

/* Dynamic Tailwind Classes for 'dark' theme */
.tw-bg-dark-800,
body.dark-mode .tw-bg-dark-800 {
    background-color: #1f2937 !important;
}

body.dark-mode [class*="tw-from-"],
body.dark-mode [class*="tw-to-"] {
    background-image: none !important;
    background-color: #1f2937 !important;
}

.tw-border-dark-500\/30,
body.dark-mode .tw-border-dark-500\/30 {
    border-color: #374151 !important;
}