/* Shared dark mode overrides for homepage and homepage settings. */

/* Homepage core surfaces */
body.theme-dark.homepage-page,
html.theme-dark body.homepage-page {
    background-color: #0f172a;
    color: #e2e8f0;
}

body.theme-dark.homepage-page header,
body.theme-dark.homepage-page .sidebar,
body.theme-dark.homepage-page .card,
body.theme-dark.homepage-page .notification-dialog,
body.theme-dark.homepage-page .recent-activity,
body.theme-dark.homepage-page .tat-periodization,
body.theme-dark.homepage-page .stat-card,
body.theme-dark.homepage-page .welcome-banner {
    background-color: #111827;
    color: #e2e8f0;
    border-color: #334155;
}

body.theme-dark.homepage-page .main-content,
body.theme-dark.homepage-page .notification-body {
    background-color: #0b1221;
    color: #e2e8f0;
}

body.theme-dark.homepage-page .sidebar-menu a {
    color: #cbd5e1;
}

body.theme-dark.homepage-page .sidebar-menu a:hover {
    background-color: #1f2937;
    color: #f8fafc;
}

body.theme-dark.homepage-page #searchResultsNav {
    background-color: #111827;
    border-color: #334155;
}

body.theme-dark.homepage-page #searchResultsNav .list-group-item {
    color: #e2e8f0;
    background-color: #111827;
    border-color: #334155;
}

body.theme-dark.homepage-page #searchResultsNav .list-group-item:hover {
    background-color: #1f2937;
}

body.theme-dark.homepage-page #searchResultsNav .list-group-item.search-keyboard-active,
body.theme-dark.homepage-page .patient-order-item.search-keyboard-active {
    background: #1e3a8a !important;
    color: #f8fafc !important;
    border-color: #60a5fa !important;
}

body.theme-dark.homepage-page .patient-order-item {
    background: #0f172a;
    border-color: #334155;
}

body.theme-dark.homepage-page .patient-order-title {
    color: #f8fafc;
}

body.theme-dark.homepage-page .patient-order-sub,
body.theme-dark.homepage-page .patient-search-meta,
body.theme-dark.homepage-page .text-muted {
    color: #94a3b8 !important;
}

body.theme-dark.homepage-page .sidebar-sync-panel {
    border-top-color: #334155;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.85) 0%, rgba(17, 24, 39, 1) 40%);
    color: #cbd5e1;
}

body.theme-dark.homepage-page .sidebar-sync-label,
body.theme-dark.homepage-page .sidebar-sync-value {
    color: #e2e8f0;
}

body.theme-dark.homepage-page .sidebar-sync-btn {
    border-color: #334155;
    background: #1f2937;
    color: #93c5fd;
}

body.theme-dark.homepage-page .menu-icon,
body.theme-dark.homepage-page .menu-badge,
body.theme-dark.homepage-page .branch-badge {
    background: #1f2937 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark.homepage-page .notification-badge {
    background: #2563eb !important;
    color: #e2e8f0 !important;
}

/* Bootstrap utility cleanup in dark mode */
body.theme-dark.homepage-page .text-dark {
    color: #e2e8f0 !important;
}

body.theme-dark.homepage-page .bg-white,
body.theme-dark.homepage-page .bg-light,
body.theme-dark.homepage-page .table-light {
    background-color: #1f2937 !important;
    color: #e2e8f0 !important;
}

body.theme-dark.homepage-page .table,
body.theme-dark.homepage-page .table th,
body.theme-dark.homepage-page .table td {
    color: #e2e8f0;
    border-color: #334155;
}

body.theme-dark.homepage-page .table-hover tbody tr:hover {
    background-color: #1f2937;
}

body.theme-dark.homepage-page .form-control,
body.theme-dark.homepage-page .form-select,
body.theme-dark.homepage-page .input-group-text {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}

body.theme-dark.homepage-page .form-control::placeholder {
    color: #94a3b8;
}

body.theme-dark.homepage-page .notification-overlay {
    background: rgba(2, 6, 23, 0.75);
}

/* Dynamic homepage modules */
body.theme-dark.homepage-page #dmsChatAIBtn,
body.theme-dark.homepage-page #dmsChatAIBtn i {
    color: #e2e8f0 !important;
}

body.theme-dark.homepage-page #paymentsHbTodayStaticContainer .card,
body.theme-dark.homepage-page #paymentsHbTodayStaticContainer .card-body,
body.theme-dark.homepage-page #paymentsHbTodayStaticContainer .table,
body.theme-dark.homepage-page #paymentsHbTodayStaticContainer .table td,
body.theme-dark.homepage-page #paymentsHbTodayStaticContainer .table th {
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark.homepage-page #branchesShiftsModal .notification-dialog,
body.theme-dark.homepage-page #branchesShiftsModal .notification-body,
body.theme-dark.homepage-page #branchesShiftsModal .card,
body.theme-dark.homepage-page #branchesShiftsModal .table,
body.theme-dark.homepage-page #branchesShiftsModal .table td,
body.theme-dark.homepage-page #branchesShiftsModal .table th {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark.homepage-page #waitingPatientsWrapper {
    background: linear-gradient(135deg, #111827 0%, #0b1221 100%) !important;
    border-bottom-color: #334155 !important;
}

body.theme-dark.homepage-page #waitingPatientsWrapper #currentBranchInfo,
body.theme-dark.homepage-page #waitingPatientsWrapper .counter-item {
    background: #0f172a !important;
    border-color: #334155 !important;
    box-shadow: none !important;
}

body.theme-dark.homepage-page #waitingPatientsWrapper .waiting-btn.btn-enhanced {
    background: #0f172a;
    border-color: #475569;
    color: #cbd5e1;
}

body.theme-dark.homepage-page #waitingPatientsWrapper .waiting-btn.btn-enhanced:hover:not(:disabled) {
    background: #1f2937 !important;
}

body.theme-dark.homepage-page #waitingPatientsWrapper .waiting-btn.btn-enhanced:disabled {
    background: #1f2937 !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}

body.theme-dark.homepage-page #waitingPatientsWrapper #currentBranchLabel,
body.theme-dark.homepage-page #waitingPatientsWrapper .counter-item span:not(.counter-value) {
    color: #cbd5e1 !important;
}

body.theme-dark.homepage-page .flag-management-table,
body.theme-dark.homepage-page .flag-management-table th,
body.theme-dark.homepage-page .flag-management-table td,
body.theme-dark.homepage-page #flagManagementContainer .card-footer {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.theme-dark.homepage-page .flag-management-table tr:hover {
    background-color: #1f2937 !important;
}

/* Recent TAT table dark mode */
/* Department section table dark mode */
body.theme-dark.homepage-page .department-count-table,
body.theme-dark.homepage-page .department-count-table th,
body.theme-dark.homepage-page .department-count-table td {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
body.theme-dark.homepage-page .department-count-table tr:hover {
    background-color: #1f2937 !important;
}
body.theme-dark.homepage-page .department-count-table .text-dark {
    color: #e2e8f0 !important;
}
body.theme-dark.homepage-page .tat-table-enhanced,
body.theme-dark.homepage-page .tat-table-enhanced th,
body.theme-dark.homepage-page .tat-table-enhanced td {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
body.theme-dark.homepage-page .tat-table-enhanced tr:hover {
    background-color: #1f2937 !important;
}
body.theme-dark.homepage-page .tat-status-badge {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-radius: 0.4em;
    font-weight: 600;
    padding: 0.3em 0.7em;
    font-size: 0.95em;
    display: inline-block;
}
body.theme-dark.homepage-page .tat-on-time {
    background: #2563eb !important;
    color: #e2e8f0 !important;
}
body.theme-dark.homepage-page .tat-exceeded {
    background: #dc3545 !important;
    color: #fff !important;
}
body.theme-dark.homepage-page .tat-faster {
    background: #28a745 !important;
    color: #fff !important;
}
body.theme-dark.homepage-page .tat-table-enhanced .text-dark {
    color: #e2e8f0 !important;
}

body.theme-dark.homepage-page #aiInsightsModal > div {
    background: #111827 !important;
    color: #e2e8f0 !important;
}

body.theme-dark.homepage-page #aiInsightsModal #aiInsightsContent,
body.theme-dark.homepage-page #aiInsightsModal h3 {
    color: #e2e8f0 !important;
}

/* Inline-style hardcoded white/light background overrides */
body.theme-dark.homepage-page [style*="background:#fff"],
body.theme-dark.homepage-page [style*="background: #fff"],
body.theme-dark.homepage-page [style*="background:white"],
body.theme-dark.homepage-page [style*="background: white"],
body.theme-dark.homepage-page [style*="background-color:#fff"],
body.theme-dark.homepage-page [style*="background-color: #fff"],
body.theme-dark.homepage-page [style*="#f8f9fa"],
body.theme-dark.homepage-page [style*="#ffffff"],
body.theme-dark.homepage-page [style*="#e9ecef"] {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

/* Settings page dark mode */
body.theme-dark.settings-page,
html.theme-dark body.settings-page {
    --bg: #0c1424;
    --card: #111c33;
    --text: #e6edf8;
    --muted: #9db0cc;
    --accent: #64a8ff;
    --accent-soft: #182747;
    --border: #293c63;
    background: radial-gradient(circle at 0% 0%, #101c31 0%, #0b1221 55%, #0a1020 100%);
}

body.theme-dark.settings-page .glass-card {
    box-shadow: 0 10px 30px rgba(1, 6, 18, 0.55);
}

body.theme-dark.settings-page .hero {
    box-shadow: 0 12px 30px rgba(7, 34, 87, 0.45);
}

body.theme-dark.settings-page .form-control,
body.theme-dark.settings-page .form-select {
    background: #0f172a;
    color: #e6edf8;
    border-color: #334155;
}

body.theme-dark.settings-page .form-control:focus,
body.theme-dark.settings-page .form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.2);
}

body.theme-dark.settings-page .mode-toggle {
    border-color: #334155;
}

body.theme-dark.settings-page .mode-btn:not(.active) {
    color: #cbd5e1;
}

body.theme-dark.settings-page .mini-chip {
    background: #17243e;
    color: #cbd5e1;
    border-color: #334155;
}
