/* ===============================================================================================
   DARK MODE OVERRIDES
   =============================================================================================== */

/* --- Base Body & Layout --- */
body.dark-layout {
    background-color: #161d31 !important;
    color: #b4b7bd !important;
}

body.dark-layout .content-wrapper,
body.dark-layout .app-content {
    background-color: transparent !important;
}

/* --- Date Picker Icons --- */
body.dark-layout input[type="date"]::-webkit-calendar-picker-indicator,
body.dark-layout input[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.dark-layout input[type="month"]::-webkit-calendar-picker-indicator,
body.dark-layout input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* --- Cards --- */
body.dark-layout .card {
    background-color: #283046 !important;
    box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.24);
}

body.dark-layout .card .card-header,
body.dark-layout .card .card-footer {
    background-color: transparent !important;
    border-bottom: 1px solid #3b4253;
    border-top: 1px solid #3b4253;
}

body.dark-layout .card-title,
body.dark-layout h1,
body.dark-layout h2,
body.dark-layout h3,
body.dark-layout h4,
body.dark-layout h5,
body.dark-layout h6 {
    color: #d0d2d6 !important;
}

/* --- Tables (Aggressive Overrides) --- */
body.dark-layout .table,
body.dark-layout table {
    background-color: #283046 !important;
    color: #b4b7bd !important;
}

body.dark-layout .table th,
body.dark-layout .table td,
body.dark-layout table th,
body.dark-layout table td {
    border-color: #3b4253 !important;
    background-color: #283046 !important;
    /* Force cell backgrounds */
    color: #b4b7bd !important;
}

body.dark-layout .table thead th,
body.dark-layout table thead th {
    border-bottom: 2px solid #3b4253 !important;
    background-color: #343d55 !important;
    /* Slightly lighter header */
    color: #d0d2d6 !important;
}

/* Striped Tables */
body.dark-layout .table-striped tbody tr:nth-of-type(odd),
body.dark-layout table.table-striped tbody tr:nth-of-type(odd) {
    background-color: #242b3d !important;
}

body.dark-layout .table-striped tbody tr:nth-of-type(odd) td {
    background-color: #242b3d !important;
}

/* Hover Tables */
body.dark-layout .table-hover tbody tr:hover,
body.dark-layout .table-hover tbody tr:hover td {
    background-color: #343d55 !important;
}

/* DataTables and other complex tables */
body.dark-layout .dataTables_wrapper .dataTables_length,
body.dark-layout .dataTables_wrapper .dataTables_filter,
body.dark-layout .dataTables_wrapper .dataTables_info,
body.dark-layout .dataTables_wrapper .dataTables_processing,
body.dark-layout .dataTables_wrapper .dataTables_paginate {
    color: #b4b7bd !important;
}

/* --- Forms & Inputs --- */
body.dark-layout .form-control {
    background-color: #283046 !important;
    border: 1px solid #404656 !important;
    color: #d0d2d6 !important;
}

body.dark-layout .form-control:focus {
    background-color: #283046 !important;
    border-color: #5e6bf9 !important;
    color: #d0d2d6 !important;
    box-shadow: 0 3px 10px 0 rgba(34, 41, 47, 0.1);
}

body.dark-layout .input-group-text,
body.dark-layout .input-group-addon {
    background-color: #3b4253 !important;
    border-color: #404656 !important;
    color: #d0d2d6 !important;
}

body.dark-layout select.form-control {
    background-color: #283046 !important;
    color: #d0d2d6 !important;
}

body.dark-layout select option {
    background-color: #283046;
    color: #d0d2d6;
}

body.dark-layout label,
body.dark-layout .col-form-label,
body.dark-layout .form-group label {
    color: #d0d2d6 !important;
}

/* --- Navbar & Sidebar --- */
body.dark-layout .header-navbar {
    background-color: #283046 !important;
}

body.dark-layout .header-navbar .navbar-container {
    background-color: #283046 !important;
}

body.dark-layout .main-menu {
    background-color: #283046 !important;
    color: #d0d2d6;
}

body.dark-layout .main-menu .navigation li a {
    color: #d0d2d6;
}

body.dark-layout .main-menu .navigation>li.active>a {
    background: #5e6bf9 !important;
    box-shadow: 0 0 10px 1px rgba(94, 107, 249, 0.7);
    color: #fff !important;
}

body.dark-layout .main-menu .navigation>li ul .active>a {
    color: #fff !important;
}

/* --- Footer --- */
body.dark-layout footer.footer {
    background-color: #283046 !important;
    color: #b4b7bd !important;
    border-top: 1px solid #3b4253;
    /* Ensure border is visible */
}

body.dark-layout footer.footer a {
    color: #d0d2d6 !important;
}

/* --- Dropdowns --- */
body.dark-layout .dropdown-menu {
    background-color: #283046 !important;
    border-color: #3b4253 !important;
}

body.dark-layout .dropdown-item {
    color: #d0d2d6 !important;
}

body.dark-layout .dropdown-item:hover,
body.dark-layout .dropdown-item:focus {
    background-color: #404656 !important;
    color: #fff !important;
}

body.dark-layout .dropdown-header {
    color: #b4b7bd !important;
}

/* --- Buttons --- */
/* Target generic buttons and standard bootstrap types */
body.dark-layout .btn,
body.dark-layout .btn-default,
body.dark-layout button {
    color: #ffffff !important;
}

body.dark-layout .btn-secondary {
    background-color: #3b4253 !important;
    border-color: #3b4253 !important;
    color: #d0d2d6 !important;
}

body.dark-layout .btn-light {
    background-color: #3b4253 !important;
    border-color: #3b4253 !important;
    color: #d0d2d6 !important;
}

/* Button hover states for better visibility */
body.dark-layout .btn-secondary:hover,
body.dark-layout .btn-light:hover {
    background-color: #485166 !important;
    color: #fff !important;
}

/* --- Modals --- */
body.dark-layout .modal-content {
    background-color: #283046 !important;
    color: #d0d2d6 !important;
}

body.dark-layout .modal-header,
body.dark-layout .modal-footer {
    border-color: #3b4253 !important;
}

body.dark-layout .close {
    text-shadow: none;
    color: #d0d2d6 !important;
}

/* --- Utilities & Text --- */
body.dark-layout .text-muted {
    color: #676d7d !important;
}

body.dark-layout .line-on-side span {
    background-color: #283046 !important;
    color: #c2c6dc !important;
}

body.dark-layout hr {
    border-top-color: #3b4253 !important;
}

body.dark-layout .bg-white {
    background-color: #283046 !important;
}

body.dark-layout .bg-light {
    background-color: #283046 !important;
}

/* Fix specific black text classes */
body.dark-layout .text-dark,
body.dark-layout .text-body,
body.dark-layout .text-black {
    color: #d0d2d6 !important;
}

/* --- Weather Card (Preserve Themes but fix base) --- */
body.dark-layout .weather-card.card-default {
    background: #283046;
}

body.dark-layout .weather-card.card-default .card-body,
body.dark-layout .weather-card.card-default .date-info {
    background-color: #283046 !important;
}

body.dark-layout .weather-card i.grey,
body.dark-layout .weather-card span.grey {
    color: #fff !important;
}

/* Ensure themed weather cards still standout */
body.dark-layout .weather-card.theme-amber .card-body {
    color: #FF6F00 !important;
}

body.dark-layout .weather-card.theme-blue .card-body {
    color: #0D47A1 !important;
}

/* --- Alerts --- */
body.dark-layout .alert {
    border: none !important;
}

body.dark-layout .alert-warning {
    background-color: rgba(255, 159, 67, 0.12) !important;
    color: #ff9f43 !important;
}

body.dark-layout .alert-warning .alert-heading {
    color: #ff9f43 !important;
}

body.dark-layout .alert-success {
    background-color: rgba(40, 199, 111, 0.12) !important;
    color: #28c76f !important;
}

body.dark-layout .alert-success .alert-heading {
    color: #28c76f !important;
}

body.dark-layout .alert-danger {
    background-color: rgba(234, 84, 85, 0.12) !important;
    color: #ea5455 !important;
}

body.dark-layout .alert-danger .alert-heading {
    color: #ea5455 !important;
}

body.dark-layout .alert-info {
    background-color: rgba(0, 207, 221, 0.12) !important;
    color: #00cfdd !important;
}

body.dark-layout .alert-info .alert-heading {
    color: #00cfdd !important;
}

/* --- DataTables --- */
body.dark-layout .page-item.disabled .page-link {
    background-color: #161d31 !important;
    border-color: #3b4253 !important;
    color: #676d7d !important;
}

body.dark-layout .page-item .page-link {
    background-color: #283046 !important;
    border-color: #3b4253 !important;
    color: #b4b7bd !important;
}

body.dark-layout .page-item.active .page-link {
    background-color: #7367f0 !important;
    border-color: #7367f0 !important;
    color: #fff !important;
}

body.dark-layout div.dataTables_wrapper .dataTables_paginate ul.pagination {
    margin: 2px 0;
    white-space: nowrap;
    justify-content: flex-end;
}