/* Dark Mode Fixes - Remove all white backgrounds and force dark theme */

/* Force dark backgrounds for all major sections */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .main,
[data-bs-theme="dark"] .container,
[data-bs-theme="dark"] .container-fluid {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
}

/* Fix all Bootstrap components that might have white backgrounds */
[data-bs-theme="dark"] .card {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .card-body {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .card-title {
    color: #f0f6fc !important;
}

[data-bs-theme="dark"] .card-text {
    color: #7d8590 !important;
}

/* Fix forms */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0d1117 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #0d1117 !important;
    border-color: #0b4b8a !important;
    color: #e6edf3 !important;
    box-shadow: 0 0 0 0.25rem rgba(11, 75, 138, 0.25) !important;
}

/* Fix dropdowns */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #212529 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #76c2ff !important;
}

/* Fix modals */
[data-bs-theme="dark"] .modal-content {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .modal-header {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .modal-body {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .modal-footer {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* Fix navbars */
[data-bs-theme="dark"] .navbar {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .navbar-brand {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .navbar-nav .nav-link {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .navbar-nav .nav-link:hover,
[data-bs-theme="dark"] .navbar-nav .nav-link:focus {
    color: #76c2ff !important;
}

/* Fix breadcrumbs */
[data-bs-theme="dark"] .breadcrumb {
    background-color: transparent !important;
}

[data-bs-theme="dark"] .breadcrumb-item {
    color: #7d8590 !important;
}

[data-bs-theme="dark"] .breadcrumb-item a {
    color: #76c2ff !important;
}

[data-bs-theme="dark"] .breadcrumb-item.active {
    color: #e6edf3 !important;
}

/* Fix pagination */
[data-bs-theme="dark"] .pagination .page-link {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .pagination .page-link:hover {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #76c2ff !important;
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #0b4b8a !important;
    border-color: #0b4b8a !important;
    color: #ffffff !important;
}

/* Fix alerts */
[data-bs-theme="dark"] .alert {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* Fix badges */
[data-bs-theme="dark"] .badge {
    color: #e6edf3 !important;
}

/* Fix buttons - ensure they maintain proper colors */
[data-bs-theme="dark"] .btn-outline-primary {
    color: #0b4b8a !important;
    border-color: #0b4b8a !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    color: #ffffff !important;
    background-color: #0b4b8a !important;
    border-color: #0b4b8a !important;
}

[data-bs-theme="dark"] .btn-primary {
    background-color: #0b4b8a !important;
    border-color: #0b4b8a !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-primary:hover {
    background-color: #093d73 !important;
    border-color: #093d73 !important;
    color: #ffffff !important;
}

/* Fix tables */
[data-bs-theme="dark"] .table {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .table th {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .table td {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* Fix list groups */
[data-bs-theme="dark"] .list-group-item {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #21262d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .list-group-item.active {
    background-color: #0b4b8a !important;
    border-color: #0b4b8a !important;
    color: #ffffff !important;
}

/* Fix progress bars */
[data-bs-theme="dark"] .progress {
    background-color: #21262d !important;
}

[data-bs-theme="dark"] .progress-bar {
    background-color: #0b4b8a !important;
}

/* Fix offcanvas */
[data-bs-theme="dark"] .offcanvas {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .offcanvas-header {
    background-color: #21262d !important;
    border-color: #30363d !important;
}

/* Fix tooltips */
[data-bs-theme="dark"] .tooltip .tooltip-inner {
    background-color: #212529 !important;
    color: #e6edf3 !important;
}

/* Fix popovers */
[data-bs-theme="dark"] .popover {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .popover-header {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .popover-body {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

/* Fix any remaining white backgrounds */
[data-bs-theme="dark"] * {
    background-color: inherit !important;
}

/* Specific overrides for elements that should have dark backgrounds */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-body,
[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #161b22 !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #7d8590 !important;
}

/* Force dark theme for any missed elements */
[data-bs-theme="dark"] section,
[data-bs-theme="dark"] div,
[data-bs-theme="dark"] article,
[data-bs-theme="dark"] aside,
[data-bs-theme="dark"] header,
[data-bs-theme="dark"] footer,
[data-bs-theme="dark"] main {
    background-color: transparent !important;
}

/* Ensure text is visible in dark mode */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #f0f6fc !important;
}

[data-bs-theme="dark"] p {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] a {
    color: #76c2ff !important;
}

[data-bs-theme="dark"] a:hover {
    color: #9dd6ff !important;
}

/* Fix any Bootstrap utility classes that might cause white backgrounds */
[data-bs-theme="dark"] .text-bg-light {
    background-color: #21262d !important;
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .text-bg-white {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

/* Auto theme support - applies dark mode when system prefers dark */
@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] {
        --bs-body-bg: #0d1117;
        --bs-body-color: #e6edf3;
        --bs-emphasis-color: #f0f6fc;
        --bs-secondary-color: #7d8590;
        --bs-tertiary-color: #484f58;
        --bs-border-color: #30363d;
        --bs-border-color-translucent: rgba(240, 246, 252, 0.15);
        
        /* Force dark backgrounds */
        --bs-light: #161b22;
        --bs-white: #161b22;
        --bs-gray-100: #21262d;
        --bs-gray-200: #30363d;
        --bs-gray-300: #484f58;
    }
    
    /* Apply all dark mode styles to auto theme when system prefers dark */
    [data-bs-theme="auto"] body,
    [data-bs-theme="auto"] .main,
    [data-bs-theme="auto"] .container,
    [data-bs-theme="auto"] .container-fluid {
        background-color: #0d1117 !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .card {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .form-control,
    [data-bs-theme="auto"] .form-select {
        background-color: #0d1117 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .dropdown-menu {
        background-color: #212529 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .modal-content {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .navbar {
        background-color: #0d1117 !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .pagination .page-link {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .pagination .page-item.active .page-link {
        background-color: #0b4b8a !important;
        border-color: #0b4b8a !important;
        color: #ffffff !important;
    }
    
    [data-bs-theme="auto"] .alert {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .btn-outline-primary {
        color: #0b4b8a !important;
        border-color: #0b4b8a !important;
        background-color: transparent !important;
    }
    
    [data-bs-theme="auto"] .btn-outline-primary:hover {
        color: #ffffff !important;
        background-color: #0b4b8a !important;
        border-color: #0b4b8a !important;
    }
    
    [data-bs-theme="auto"] .btn-primary {
        background-color: #0b4b8a !important;
        border-color: #0b4b8a !important;
        color: #ffffff !important;
    }
    
    [data-bs-theme="auto"] .table {
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .table th {
        background-color: #21262d !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .table td {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .list-group-item {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .list-group-item:hover {
        background-color: #21262d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .list-group-item.active {
        background-color: #0b4b8a !important;
        border-color: #0b4b8a !important;
        color: #ffffff !important;
    }
    
    [data-bs-theme="auto"] .offcanvas {
        background-color: #161b22 !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .tooltip .tooltip-inner {
        background-color: #212529 !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .popover {
        background-color: #161b22 !important;
        border-color: #30363d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .bg-white,
    [data-bs-theme="auto"] .bg-light,
    [data-bs-theme="auto"] .bg-body,
    [data-bs-theme="auto"] .bg-body-tertiary {
        background-color: #161b22 !important;
    }
    
    [data-bs-theme="auto"] .text-dark {
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .text-muted {
        color: #7d8590 !important;
    }
    
    [data-bs-theme="auto"] h1,
    [data-bs-theme="auto"] h2,
    [data-bs-theme="auto"] h3,
    [data-bs-theme="auto"] h4,
    [data-bs-theme="auto"] h5,
    [data-bs-theme="auto"] h6 {
        color: #f0f6fc !important;
    }
    
    [data-bs-theme="auto"] p {
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] a {
        color: #76c2ff !important;
    }
    
    [data-bs-theme="auto"] a:hover {
        color: #9dd6ff !important;
    }
    
    [data-bs-theme="auto"] .text-bg-light {
        background-color: #21262d !important;
        color: #e6edf3 !important;
    }
    
    [data-bs-theme="auto"] .text-bg-white {
        background-color: #161b22 !important;
        color: #e6edf3 !important;
    }
}
