:root {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.theme-toggle-fab {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1051;
}

html[data-theme="dark"] body {
    background-color: #0f172a;
    color: #e2e8f0;
}

html[data-theme="dark"] body.bg-gradient-primary {
    background: linear-gradient(180deg, #1e293b 10%, #0f172a 100%) !important;
}

html[data-theme="dark"] .bg-gradient-primary {
    background: linear-gradient(180deg, #1f2937 10%, #0f172a 100%) !important;
}

html[data-theme="dark"] #wrapper {
    background-color: transparent;
}

html[data-theme="dark"] #wrapper #content-wrapper {
    background-color: #0b1220 !important;
}

html[data-theme="dark"] #wrapper #content-wrapper #content {
    background-color: transparent !important;
}

html[data-theme="dark"] #wrapper #content-wrapper #content .container-fluid {
    background-color: transparent !important;
}

html[data-theme="dark"] #content,
html[data-theme="dark"] #content-wrapper,
html[data-theme="dark"] .container-fluid,
html[data-theme="dark"] .collapse {
    background-color: transparent !important;
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .bg-gray-100,
html[data-theme="dark"] .bg-gray-200,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .collapse-inner,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .table,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table-bordered {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .card-header.bg-light {
    background-color: #111827 !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .dropdown-divider,
html[data-theme="dark"] .sidebar-divider,
html[data-theme="dark"] hr {
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu {
    border-color: rgba(148, 163, 184, 0.2) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] .shadow,
html[data-theme="dark"] .shadow-sm {
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.55) !important;
}

html[data-theme="dark"] .border-left-primary,
html[data-theme="dark"] .border-left-success,
html[data-theme="dark"] .border-left-info,
html[data-theme="dark"] .border-left-warning,
html[data-theme="dark"] .border-left-danger {
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-theme="dark"] .navbar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .bg-white.topbar,
html[data-theme="dark"] nav.navbar {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .navbar .nav-link,
html[data-theme="dark"] .navbar .dropdown-item,
html[data-theme="dark"] .navbar .dropdown-item i,
html[data-theme="dark"] .navbar .btn-link,
html[data-theme="dark"] .navbar .btn-outline-secondary,
html[data-theme="dark"] .navbar .btn-light,
html[data-theme="dark"] .navbar .btn-white,
html[data-theme="dark"] .dropdown-item {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-white {
    background-color: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-light:focus,
html[data-theme="dark"] .btn-white:hover,
html[data-theme="dark"] .btn-white:focus {
    background-color: rgba(59, 130, 246, 0.2);
    color: #f8fafc;
}

html[data-theme="dark"] .btn-outline-secondary {
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.6);
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-secondary:focus {
    background-color: rgba(59, 130, 246, 0.2);
    color: #f8fafc;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="dark"] .badge-light,
html[data-theme="dark"] .badge.badge-light,
html[data-theme="dark"] .badge-secondary.bg-light {
    background-color: rgba(59, 130, 246, 0.15);
    color: #bfdbfe;
}

html[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0f172a, #020617) !important;
}

html[data-theme="dark"] .sidebar .nav-item .nav-link,
html[data-theme="dark"] .sidebar .nav-item .nav-link i,
html[data-theme="dark"] .sidebar .sidebar-brand {
    color: #e5e7eb !important;
}

html[data-theme="dark"] .sidebar .nav-item.active .nav-link,
html[data-theme="dark"] .sidebar .nav-item .nav-link:hover,
html[data-theme="dark"] .sidebar .nav-item .nav-link:focus {
    background-color: rgba(59, 130, 246, 0.25);
    color: #f8fafc !important;
}

html[data-theme="dark"] .collapse-inner {
    border: 1px solid rgba(148, 163, 184, 0.12);
    background-color: #0f172a !important;
}

html[data-theme="dark"] .collapse-inner .collapse-item {
    color: #cbd5f5 !important;
}

html[data-theme="dark"] .collapse-inner .collapse-item:hover,
html[data-theme="dark"] .collapse-inner .collapse-item:focus,
html[data-theme="dark"] .collapse-inner .collapse-item.active {
    color: #facc15 !important;
    background-color: rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] footer.sticky-footer,
html[data-theme="dark"] .footer {
    background-color: #111827 !important;
    color: #94a3b8 !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .custom-select:focus {
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

html[data-theme="dark"] .input-group-text {
    background-color: #1f2937;
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5f5;
}

html[data-theme="dark"] .list-group-item {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-theme="dark"] .table tbody tr {
    background-color: rgba(15, 23, 42, 0.35);
}

html[data-theme="dark"] .table tbody tr:nth-of-type(even) {
    background-color: rgba(30, 41, 59, 0.35);
}

html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: #18202f !important;
}

html[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="dark"] .modal-backdrop.show {
    background-color: rgba(15, 23, 42, 0.85);
}

html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800 {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .text-gray-700 {
    color: #cbd5f5 !important;
}

html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .text-gray-500 {
    color: #64748b !important;
}

html[data-theme="dark"] .text-gray-400 {
    color: #475569 !important;
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-body {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .text-black-50 {
    color: rgba(226, 232, 240, 0.65) !important;
}

html[data-theme="dark"] .text-primary {
    color: #93c5fd !important;
}

html[data-theme="dark"] .text-danger {
    color: #f87171 !important;
}

html[data-theme="dark"] a,
html[data-theme="dark"] .btn-link {
    color: #93c5fd;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] a:focus,
html[data-theme="dark"] .btn-link:hover,
html[data-theme="dark"] .btn-link:focus {
    color: #bfdbfe;
}

html[data-theme="dark"] .badge-primary,
html[data-theme="dark"] .btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
}

html[data-theme="dark"] .badge-secondary,
html[data-theme="dark"] .btn-secondary {
    background-color: #475569;
    border-color: #475569;
}

html[data-theme="dark"] .alert {
    background-color: rgba(37, 99, 235, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}

html[data-theme="dark"] .alert-danger {
    background-color: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

html[data-theme="dark"] .alert-success {
    background-color: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

html[data-theme="dark"] .progress,
html[data-theme="dark"] .progress-bar {
    background-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .progress-bar {
    background-color: #38bdf8 !important;
}

html[data-theme="dark"] .theme-toggle i {
    color: inherit;
}

@media (max-width: 768px) {
    .theme-toggle-fab {
        top: auto;
        bottom: 1rem;
    }
}
