/* Custom styles to ensure dark mode toggle works properly with the sidebar */

/* When dark mode is active, change the sidebar from light to dark */
body.dark-mode .main-sidebar.sidebar-light-primary {
    background-color: #343a40 !important;
    color: #fff !important;
}

body.dark-mode .main-sidebar.sidebar-light-primary .nav-sidebar .nav-item .nav-link {
    color: #c2c7d0 !important;
}

body.dark-mode .main-sidebar.sidebar-light-primary .nav-sidebar .nav-item .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

body.dark-mode .main-sidebar.sidebar-light-primary .nav-sidebar .nav-item .nav-link.active {
    color: #fff !important;
    background-color: #007bff !important;
}

body.dark-mode .main-sidebar.sidebar-light-primary .nav-header {
    color: #a9a9a9 !important;
    background-color: transparent !important;
}

/* Logo styles - ensure visibility in all modes */
.brand-link .brand-image,
.login-logo img,
img[src*="app-logo.png"],
img[alt*="Logo"] {
    border-radius: 50% !important;
    padding: 3px !important;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2) !important;
}

/* Ensure logo visibility in dark mode */
body.dark-mode .brand-link .brand-image,
body.dark-mode .login-logo img,
body.dark-mode img[src*="app-logo.png"],
body.dark-mode img[alt*="Logo"] {
    background-color: #ffffff !important;
}

/* Ensure logo visibility in light mode - fix for "invisible" logo */
body:not(.dark-mode) .brand-link .brand-image,
body:not(.dark-mode) .login-logo img,
body:not(.dark-mode) img[src*="app-logo.png"],
body:not(.dark-mode) img[alt*="Logo"] {
    background-color: transparent !important;
}

/* Additional specific fix for main app logo */
.main-sidebar .brand-link .brand-image {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.dark-mode .main-sidebar.sidebar-light-primary .brand-link {
    color: #fff !important;
    background-color: #343a40 !important;
    border-bottom: 1px solid #4b545c !important;
}

body.dark-mode .main-sidebar.sidebar-light-primary .sidebar-search-results,
body.dark-mode .main-sidebar.sidebar-light-primary .sidebar .nav-treeview {
    background-color: #2c3136 !important;
}

/* When dark mode is deactivated, ensure sidebar stays in light mode */
body:not(.dark-mode) .main-sidebar.sidebar-light-primary {
    background-color: #fff !important;
    color: #343a40 !important;
}

/* Force dark mode styles when dark-mode class is present */
body.dark-mode .main-sidebar.sidebar-light-primary .nav-flat.nav-sidebar > .nav-item .nav-treeview,
body.dark-mode .main-sidebar.sidebar-light-primary .nav-flat.nav-sidebar > .nav-item > .nav-treeview {
    background-color: #2c3136 !important;
}

/* Card styling for dark mode */
body.dark-mode .card {
    background-color: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #454d55 !important;
}

body.dark-mode .card-header,
body.dark-mode .card-footer {
    background-color: #2c3136 !important;
    border-color: #454d55 !important;
}

body.dark-mode .card-title {
    color: #f8f9fa !important;
}

body.dark-mode .card-outline {
    border-top: 3px solid #007bff !important;
}

/* Text colors for dark mode */
body.dark-mode .text-dark {
    color: #f8f9fa !important;
}

body.dark-mode .text-muted {
    color: #adb5bd !important;
}

body.dark-mode .text-secondary {
    color: #cfd5db !important;
}

/* Form controls in dark mode */
body.dark-mode .form-control {
    background-color: #454d55 !important;
    color: #f8f9fa !important;
    border-color: #6c757d !important;
}

body.dark-mode .input-group-text {
    background-color: #3f474e !important;
    color: #f8f9fa !important;
    border-color: #6c757d !important;
}

/* Badges and labels in dark mode */
body.dark-mode .badge-light {
    background-color: #4b545c !important;
    color: #f8f9fa !important;
}

/* Alert styling in dark mode */
body.dark-mode .alert {
    color: #d6d8db !important;
}

body.dark-mode .alert-success {
    background-color: #285b2a !important;
    border-color: #1e4620 !important;
}

body.dark-mode .alert-danger {
    background-color: #73231d !important;
    border-color: #5f1d19 !important;
}

body.dark-mode .alert-warning {
    background-color: #7d5a1c !important;
    border-color: #674a17 !important;
    color: #fff !important;
}

body.dark-mode .alert-info {
    background-color: #24587b !important;
    border-color: #1c4561 !important;
}

/* Table styling for dark mode */
body.dark-mode .table {
    color: #f8f9fa !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-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.075) !important;
}

body.dark-mode .table th,
body.dark-mode .table td {
    border-color: #454d55 !important;
}

body.dark-mode .table-bordered {
    border-color: #454d55 !important;
}

/* Select2 Dark Mode Styling */
body.dark-mode .select2-container--bootstrap4 .select2-selection {
    background-color: #343a40 !important;
    color: #fff !important;
    border-color: #6c757d !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    color: #fff !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-dropdown {
    background-color: #343a40 !important;
    border-color: #6c757d !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
    background-color: #454d55 !important;
    color: #fff !important;
    border-color: #6c757d !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-results__option {
    color: #fff !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-results__option--highlighted,
body.dark-mode .select2-container--bootstrap4 .select2-results__option[aria-selected=true] {
    background-color: #007bff !important;
    color: #fff !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-results__option[aria-disabled=true] {
    color: #6c757d !important;
}

body.dark-mode .select2-container--bootstrap4.select2-container--focus .select2-selection,
body.dark-mode .select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Select2 multiple selection pills */
body.dark-mode .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
    background-color: #007bff !important;
    color: #fff !important;
    border-color: #0069d9 !important;
}

body.dark-mode .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff !important;
}

/* Select2 placeholder */
body.dark-mode .select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder {
    color: #a9a9a9 !important;
} 