/* Runtime theme overrides injected last to ensure priority */
html[ data-color-theme="dark" ] body,
html.theme-dark body,
html[data-color-theme="dark"] .page-container,
html.theme-dark .page-container,
html[data-color-theme="dark"] .content-wrapper,
html.theme-dark .content-wrapper,
html[data-color-theme="dark"] .content,
html.theme-dark .content,
html[data-color-theme="dark"] .main_content,
html.theme-dark .main_content {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
}

html[data-color-theme="dark"] .panel,
html.theme-dark .panel,
html[data-color-theme="dark"] .panel-heading,
html.theme-dark .panel-heading,
html[data-color-theme="dark"] .panel-body,
html.theme-dark .panel-body,
html[data-color-theme="dark"] .panel-footer,
html.theme-dark .panel-footer,
html[data-color-theme="dark"] .well,
html.theme-dark .well,
html[data-color-theme="dark"] .card,
html.theme-dark .card,
html[data-color-theme="dark"] .card-header,
html.theme-dark .card-header,
html[data-color-theme="dark"] .card-body,
html.theme-dark .card-body,
html[data-color-theme="dark"] .card-footer,
html.theme-dark .card-footer {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .panel-title,
html.theme-dark .panel-title,
html[data-color-theme="dark"] .panel-title a,
html.theme-dark .panel-title a,
html[data-color-theme="dark"] h1,
html.theme-dark h1,
html[data-color-theme="dark"] h2,
html.theme-dark h2,
html[data-color-theme="dark"] h3,
html.theme-dark h3,
html[data-color-theme="dark"] h4,
html.theme-dark h4,
html[data-color-theme="dark"] h5,
html.theme-dark h5,
html[data-color-theme="dark"] h6,
html.theme-dark h6 {
    color: #f3f4f6 !important;
}

html[data-color-theme="dark"] .sidebar,
html.theme-dark .sidebar,
html[data-color-theme="dark"] .sidebar-main,
html.theme-dark .sidebar-main,
html[data-color-theme="dark"] .sidebar-main .navigation > li > a,
html.theme-dark .sidebar-main .navigation > li > a {
    background-color: #0f172a !important;
    color: #cbd5f5 !important;
}

html[data-color-theme="dark"] .sidebar-main .navigation > li.active > a,
html.theme-dark .sidebar-main .navigation > li.active > a,
html[data-color-theme="dark"] .sidebar-main .navigation > li > a:hover,
html.theme-dark .sidebar-main .navigation > li > a:hover {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #f3f4f6 !important;
}

html[data-color-theme="dark"] .nav-tabs,
html.theme-dark .nav-tabs,
html[data-color-theme="dark"] .nav-tabs > li > a,
html.theme-dark .nav-tabs > li > a {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .nav-tabs > li.active > a,
html.theme-dark .nav-tabs > li.active > a,
html[data-color-theme="dark"] .nav-tabs > li.active > a:focus,
html.theme-dark .nav-tabs > li.active > a:focus,
html[data-color-theme="dark"] .nav-tabs > li.active > a:hover,
html.theme-dark .nav-tabs > li.active > a:hover,
html[data-color-theme="dark"] .nav-tabs > li > a:hover,
html.theme-dark .nav-tabs > li > a:hover {
    background-color: rgba(59, 130, 246, 0.18) !important;
    color: #f8fafc !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}

html[data-color-theme="dark"] .tab-content,
html.theme-dark .tab-content,
html[data-color-theme="dark"] .tab-pane,
html.theme-dark .tab-pane {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .modal-content,
html.theme-dark .modal-content,
html[data-color-theme="dark"] .modal-header,
html.theme-dark .modal-header,
html[data-color-theme="dark"] .modal-body,
html.theme-dark .modal-body,
html[data-color-theme="dark"] .modal-footer,
html.theme-dark .modal-footer {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .modal-header .close,
html.theme-dark .modal-header .close {
    color: #e2e8f0 !important;
    opacity: 0.75;
}

html[data-color-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button {
    background-color: #1f2937 !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
}

html[data-color-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #f8fafc !important;
}

html[data-color-theme="dark"] .dataTables_wrapper .dataTables_filter input,
html.theme-dark .dataTables_wrapper .dataTables_filter input,
html[data-color-theme="dark"] .dataTables_wrapper .dataTables_length select,
html.theme-dark .dataTables_wrapper .dataTables_length select {
    background-color: #1f2937 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
}

html[data-color-theme="dark"] footer,
html.theme-dark footer {
    background-color: #0f172a !important;
    color: #cbd5f5 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

/* Additional elements for dark theme */
html[data-color-theme="dark"] .account-info-panel,
html.theme-dark .account-info-panel,
html[data-color-theme="dark"] .breadcrumb-line,
html.theme-dark .breadcrumb-line,
html[data-color-theme="dark"] .panel.bg-white,
html.theme-dark .panel.bg-white,
html[data-color-theme="dark"] .panel.panel-default,
html.theme-dark .panel.panel-default {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .sidebar-main .navigation > li > ul,
html.theme-dark .sidebar-main .navigation > li > ul {
    background-color: #0f172a !important;
}

html[data-color-theme="dark"] .sidebar-main .navigation > li > ul > li > a,
html.theme-dark .sidebar-main .navigation > li > ul > li > a {
    background-color: #0f172a !important;
    color: #cbd5f5 !important;
}

html[data-color-theme="dark"] .sidebar-main .navigation > li > ul > li > a:hover,
html.theme-dark .sidebar-main .navigation > li > ul > li > a:hover,
html[data-color-theme="dark"] .sidebar-main .navigation > li > ul > li.active > a,
html.theme-dark .sidebar-main .navigation > li > ul > li.active > a {
    background-color: rgba(59,130,246,0.2) !important;
    color: #f3f4f6 !important;
}

html[data-color-theme="dark"] [class*="bg-white"],
html.theme-dark [class*="bg-white"],
html[data-color-theme="dark"] .bg-white,
html.theme-dark .bg-white {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
}

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

html[data-color-theme="dark"] .sidebar-category,
html.theme-dark .sidebar-category,
html[data-color-theme="dark"] .sidebar-category .category-title,
html.theme-dark .sidebar-category .category-title,
html[data-color-theme="dark"] .sidebar-category .category-content,
html.theme-dark .sidebar-category .category-content,
html[data-color-theme="dark"] .sidebar-user,
html.theme-dark .sidebar-user {
    background-color: #0f172a !important;
    color: #cbd5f5 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .sidebar-category .category-title span,
html.theme-dark .sidebar-category .category-title span,
html[data-color-theme="dark"] .sidebar-category .category-title i,
html.theme-dark .sidebar-category .category-title i {
    color: #f3f4f6 !important;
}

html[data-color-theme="dark"] .sidebar-category .category-content a,
html.theme-dark .sidebar-category .category-content a {
    color: #cbd5f5 !important;
}

html[data-color-theme="dark"] .sidebar-category .category-content a:hover,
html.theme-dark .sidebar-category .category-content a:hover {
    color: #f8fafc !important;
}

html[data-color-theme="dark"] .footer,
html.theme-dark .footer,
html[data-color-theme="dark"] footer.footer,
html.theme-dark footer.footer,
html[data-color-theme="dark"] .navbar-fixed-bottom.footer,
html.theme-dark .navbar-fixed-bottom.footer {
    background-color: #0f172a !important;
    color: #cbd5f5 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

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

html[data-color-theme="dark"] .footer a:hover,
html.theme-dark .footer a:hover {
    color: #bfdbfe !important;
}

html[data-color-theme="dark"] .panel .panel-heading,
html.theme-dark .panel .panel-heading {
    background-color: #0f172a !important;
    color: #f3f4f6 !important;
}

html[data-color-theme="dark"] .panel .panel-heading .heading-elements,
html.theme-dark .panel .panel-heading .heading-elements {
    color: #cbd5f5 !important;
}

html[data-color-theme="dark"] .panel .panel-heading .heading-elements a,
html.theme-dark .panel .panel-heading .heading-elements a {
    color: #93c5fd !important;
}

html[data-color-theme="dark"] .panel .panel-heading .heading-elements a:hover,
html.theme-dark .panel .panel-heading .heading-elements a:hover {
    color: #bfdbfe !important;
}

html[data-color-theme="dark"] .dropdown-menu,
html.theme-dark .dropdown-menu,
html[data-color-theme="dark"] .dropdown-menu > li > a,
html.theme-dark .dropdown-menu > li > a,
html[data-color-theme="dark"] .dropdown-item,
html.theme-dark .dropdown-item {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .dropdown-menu > li > a:hover,
html.theme-dark .dropdown-menu > li > a:hover,
html[data-color-theme="dark"] .dropdown-menu > li > a:focus,
html.theme-dark .dropdown-menu > li > a:focus,
html[data-color-theme="dark"] .dropdown-item:hover,
html.theme-dark .dropdown-item:hover,
html[data-color-theme="dark"] .dropdown-item:focus,
html.theme-dark .dropdown-item:focus {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #f8fafc !important;
}

html[data-color-theme="dark"] .modal-content,
html.theme-dark .modal-content,
html[data-color-theme="dark"] .modal-dialog .modal-content,
html.theme-dark .modal-dialog .modal-content {
    border: 1px solid rgba(148, 163, 184, 0.55) !important;
    box-shadow: 0 12px 40px rgba(8, 47, 73, 0.55), 0 0 0 1px rgba(59, 130, 246, 0.2) !important;
}

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

html[data-color-theme="dark"] .breadcrumb-line,
html.theme-dark .breadcrumb-line,
html[data-color-theme="dark"] .breadcrumb,
html.theme-dark .breadcrumb {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-color-theme="dark"] .breadcrumb > li,
html.theme-dark .breadcrumb > li,
html[data-color-theme="dark"] .breadcrumb > li > a,
html.theme-dark .breadcrumb > li > a {
    color: #e2e8f0 !important;
}

html[data-color-theme="dark"] .breadcrumb > li > a:hover,
html.theme-dark .breadcrumb > li > a:hover,
html[data-color-theme="dark"] .breadcrumb > li > a:focus,
html.theme-dark .breadcrumb > li > a:focus {
    color: #bfdbfe !important;
}

html[data-color-theme="dark"] .breadcrumb > .active,
html.theme-dark .breadcrumb > .active {
    color: #f8fafc !important;
    font-weight: 600;
}

/* Alert close alignment */
.alert.alert-dismissable,
.alert.alert-dismissible {
    position: relative;
    padding-right: 45px !important;
}

.alert.alert-dismissable .close,
.alert.alert-dismissible .close {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 15px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.alert.alert-dismissable .close span,
.alert.alert-dismissible .close span {
    line-height: 1 !important;
    display: block;
}

.support-modal-link {
    color: #d9534f !important;
    font-weight: 600;
    animation: support-modal-blink 1.1s linear infinite;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.support-modal-link .icon-comment-discussion,
.support-modal-link .icon-bubbles4 {
    color: inherit !important;
}

@keyframes support-modal-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.25;
    }
}
