/* ============================================================
   LABCARE ELITE — DARK MODE THEME (theme-dark.css)
   Activated when <html> has class "dark-mode"
   Toggle is handled by toggleHtmlDarkMode() in MainLayout.razor
   ============================================================ */

/* ── CSS Variable Overrides ──────────────────────────────── */
html.dark-mode {
    --lc-primary: #818cf8;
    --lc-primary-dark: #6366f1;
    --lc-primary-light: #1e1b4b;
    --lc-secondary: #60a5fa;
    --lc-success: #34d399;
    --lc-danger: #f87171;
    --lc-warning: #fbbf24;
    --lc-slate-50: #0f172a;
    --lc-slate-100: #1e293b;
    --lc-slate-200: #334155;
    --lc-slate-400: #94a3b8;
    --lc-slate-600: #cbd5e1;
    --lc-slate-800: #f1f5f9;
    --lc-border: #334155;
    --lc-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

/* ── Base / Body ─────────────────────────────────────────── */
html.dark-mode,
html.dark-mode body {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

/* ── App Root & content backgrounds ────────────────────── */
html.dark-mode #lc-app-root {
    background-color: #0f172a !important;
}

html.dark-mode main#main-content,
html.dark-mode .flex-1.p-0 {
    background-color: #0f172a !important;
}

/* ── Sidebar / Nav ───────────────────────────────────────── */
html.dark-mode .sidebar-wrapper {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    color: #e2e8f0 !important;
    border-right-color: #334155 !important;
    box-shadow: 4px 0 24px -4px rgba(0, 0, 0, 0.4) !important;
}

html.dark-mode .sidebar-branding {
    background: #1e293b !important;
    border-bottom-color: #334155 !important;
}

html.dark-mode .main-title {
    color: #f1f5f9 !important;
}

html.dark-mode .group-label {
    color: #64748b !important;
}

/* Nav Links */
html.dark-mode .v-nav-link {
    color: #cbd5e1 !important;
}

html.dark-mode .v-nav-link:hover {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #a5b4fc !important;
}

html.dark-mode .v-nav-link.active,
html.dark-mode .v-nav-link.active-link {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #818cf8 !important;
}

html.dark-mode .nav-submenu-btn {
    color: #cbd5e1 !important;
    background: transparent !important;
}

html.dark-mode .nav-submenu-btn:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #a5b4fc !important;
}

html.dark-mode .nav-submenu-items {
    background: transparent !important;
}

/* Sidebar toggle button */
html.dark-mode .sidebar-toggle-btn {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}

/* Sidebar search */
html.dark-mode .sidebar-search-container,
html.dark-mode .sidebar-search-wrapper {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: #334155 !important;
}

html.dark-mode .sidebar-search-input {
    background: transparent !important;
    color: #e2e8f0 !important;
}

html.dark-mode .sidebar-search-input::placeholder {
    color: #64748b !important;
}

html.dark-mode .search-icon {
    color: #64748b !important;
}

html.dark-mode .clear-search-btn {
    color: #64748b !important;
}

/* Sidebar footer / profile card */
html.dark-mode .sidebar-footer {
    background: #1e293b !important;
    border-top-color: #334155 !important;
}

html.dark-mode .user-profile-card,
html.dark-mode .profile-card-inner {
    background: #1e293b !important;
}

html.dark-mode .profile-info .profile-name {
    color: #f1f5f9 !important;
}

html.dark-mode .profile-role-pill {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #a5b4fc !important;
}

html.dark-mode .profile-divider {
    background: #334155 !important;
}

html.dark-mode .profile-logout-btn {
    color: #94a3b8 !important;
    background: transparent !important;
}

html.dark-mode .profile-logout-btn:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #f87171 !important;
}

html.dark-mode .profile-version-badge {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #818cf8 !important;
}

/* ── Workspace Tab Bar ───────────────────────────────────── */
html.dark-mode .workspace-tabs-bar {
    background: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}

html.dark-mode .workspace-tab {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

html.dark-mode .workspace-tab:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #c7d2fe !important;
}

html.dark-mode .workspace-tab.active {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #a5b4fc !important;
    border-bottom-color: #818cf8 !important;
}

html.dark-mode .workspace-tab-close {
    color: #64748b !important;
}

html.dark-mode .workspace-tab-close:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
}

html.dark-mode .workspace-tab-title {
    color: inherit !important;
}

/* Theme toggle button */
html.dark-mode .theme-toggle-btn {
    color: #fbbf24 !important;
}

html.dark-mode .mobile-hamburger-btn {
    color: #e2e8f0 !important;
}

/* ── Cards & Panels ──────────────────────────────────────── */
html.dark-mode .lc-card,
html.dark-mode .lc-section-card,
html.dark-mode .lc-panel,
html.dark-mode .lc-master-header,
html.dark-mode .page-header-card,
html.dark-mode .lc-page-header,
html.dark-mode .lc-filter-row {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .card-header {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}

html.dark-mode .card-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
}

html.dark-mode .lc-section-title,
html.dark-mode .section-title {
    color: #a5b4fc !important;
}

/* ── Headings ────────────────────────────────────────────── */
html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3,
html.dark-mode h4,
html.dark-mode h5,
html.dark-mode h6 {
    color: #f1f5f9 !important;
}

/* ── Tables ──────────────────────────────────────────────── */
html.dark-mode table,
html.dark-mode .table {
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html.dark-mode thead,
html.dark-mode .table thead,
html.dark-mode th {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

html.dark-mode td {
    background: transparent !important;
    border-color: #1e293b !important;
    color: #e2e8f0 !important;
}

html.dark-mode tbody tr {
    background: #0f172a !important;
}

html.dark-mode tbody tr:nth-child(even) {
    background: #111827 !important;
}

html.dark-mode tbody tr:hover,
html.dark-mode tbody tr:hover td {
    background: #1e293b !important;
}

/* ── Forms & Inputs ──────────────────────────────────────── */
html.dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.dark-mode select,
html.dark-mode textarea,
html.dark-mode .form-control,
html.dark-mode .form-select {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder {
    color: #64748b !important;
}

html.dark-mode input:focus,
html.dark-mode select:focus,
html.dark-mode textarea:focus,
html.dark-mode .form-control:focus,
html.dark-mode .form-select:focus {
    background-color: #1e293b !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
    color: #f1f5f9 !important;
}

html.dark-mode input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

html.dark-mode label,
html.dark-mode .form-label,
html.dark-mode .col-form-label {
    color: #cbd5e1 !important;
}

html.dark-mode .input-group-text {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}

html.dark-mode .form-check-label {
    color: #cbd5e1 !important;
}

/* ── Buttons ─────────────────────────────────────────────── */
html.dark-mode .btn-primary,
html.dark-mode .lc-btn-primary {
    background: #4f46e5 !important;
    border-color: #4338ca !important;
    color: #ffffff !important;
}

html.dark-mode .btn-secondary,
html.dark-mode .lc-btn-secondary {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .btn-light {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .btn-outline-primary {
    border-color: #818cf8 !important;
    color: #818cf8 !important;
    background: transparent !important;
}

html.dark-mode .btn-outline-primary:hover {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #a5b4fc !important;
}

html.dark-mode .btn-outline-secondary {
    border-color: #475569 !important;
    color: #94a3b8 !important;
    background: transparent !important;
}

html.dark-mode .btn-outline-danger {
    border-color: #f87171 !important;
    color: #f87171 !important;
    background: transparent !important;
}

html.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ── Modals & Dialogs ────────────────────────────────────── */
html.dark-mode .modal-content {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .modal-header {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}

html.dark-mode .modal-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
}

html.dark-mode .modal-title {
    color: #f1f5f9 !important;
}

/* ── Dropdowns ───────────────────────────────────────────── */
html.dark-mode .dropdown-menu,
html.dark-mode .lc-dropdown {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

html.dark-mode .dropdown-item {
    color: #cbd5e1 !important;
}

html.dark-mode .dropdown-item:hover,
html.dark-mode .dropdown-item:focus {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #a5b4fc !important;
}

html.dark-mode .dropdown-divider {
    border-color: #334155 !important;
}

/* ── Pagination ──────────────────────────────────────────── */
html.dark-mode .page-item .page-link {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

html.dark-mode .page-item.active .page-link {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #fff !important;
}

html.dark-mode .page-item:not(.active) .page-link:hover {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .page-item.disabled .page-link {
    background: #0f172a !important;
    color: #475569 !important;
}

/* ── Alerts ──────────────────────────────────────────────── */
html.dark-mode .alert {
    border-width: 1px !important;
}

html.dark-mode .alert-primary {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    color: #a5b4fc !important;
}

html.dark-mode .alert-success {
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
    color: #6ee7b7 !important;
}

html.dark-mode .alert-danger {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #fca5a5 !important;
}

html.dark-mode .alert-warning {
    background: rgba(251, 191, 36, 0.12) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
    color: #fde68a !important;
}

html.dark-mode .alert-info {
    background: rgba(96, 165, 250, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: #93c5fd !important;
}

/* ── Accordion ───────────────────────────────────────────── */
html.dark-mode .accordion-item {
    background: #1e293b !important;
    border-color: #334155 !important;
}

html.dark-mode .accordion-button {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

html.dark-mode .accordion-button:not(.collapsed) {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #818cf8 !important;
    box-shadow: inset 0 -1px 0 #334155 !important;
}

html.dark-mode .accordion-button::after {
    filter: invert(1);
}

html.dark-mode .accordion-body {
    background: #0f172a !important;
    color: #cbd5e1 !important;
}

/* ── List Groups ─────────────────────────────────────────── */
html.dark-mode .list-group-item {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .list-group-item.active {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #fff !important;
}

html.dark-mode .list-group-item:hover {
    background: #334155 !important;
}

/* ── Nav Tabs / Pills ────────────────────────────────────── */
html.dark-mode .nav-tabs {
    border-bottom-color: #334155 !important;
}

html.dark-mode .nav-tabs .nav-link {
    color: #94a3b8 !important;
}

html.dark-mode .nav-tabs .nav-link:hover {
    border-color: #334155 #334155 transparent !important;
    color: #e2e8f0 !important;
}

html.dark-mode .nav-tabs .nav-link.active {
    background: #1e293b !important;
    border-color: #334155 #334155 #1e293b !important;
    color: #818cf8 !important;
}

html.dark-mode .nav-pills .nav-link {
    color: #94a3b8 !important;
}

html.dark-mode .nav-pills .nav-link.active {
    background: #4f46e5 !important;
    color: #fff !important;
}

/* ── Access denied / loading ─────────────────────────────── */
html.dark-mode .access-denied-container,
html.dark-mode .access-loading-container {
    background: #0f172a !important;
}

html.dark-mode .access-denied-card {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html.dark-mode .denied-title {
    color: #f1f5f9 !important;
}

html.dark-mode .denied-message {
    color: #94a3b8 !important;
}

/* ── Tooltip ─────────────────────────────────────────────── */
html.dark-mode .tooltip-inner {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* ── Text utilities ──────────────────────────────────────── */
html.dark-mode .text-muted {
    color: #64748b !important;
}

html.dark-mode .text-dark {
    color: #f1f5f9 !important;
}

html.dark-mode .text-secondary {
    color: #94a3b8 !important;
}

html.dark-mode .text-body {
    color: #e2e8f0 !important;
}

/* ── Background utilities ────────────────────────────────── */
html.dark-mode .bg-white {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

html.dark-mode .bg-light {
    background: #0f172a !important;
}

/* ── Border utilities ────────────────────────────────────── */
html.dark-mode .border,
html.dark-mode .border-top,
html.dark-mode .border-bottom,
html.dark-mode .border-start,
html.dark-mode .border-end {
    border-color: #334155 !important;
}

html.dark-mode hr {
    border-color: #334155 !important;
    opacity: 0.4;
}

/* ── Scrollbars ──────────────────────────────────────────── */
html.dark-mode ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

html.dark-mode ::-webkit-scrollbar-track {
    background: #1e293b;
}

html.dark-mode ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

html.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ── Smooth transition on theme switch ───────────────────── */
html.dark-mode,
html.dark-mode body,
html.dark-mode .sidebar-wrapper,
html.dark-mode .workspace-tabs-bar,
html.dark-mode main#main-content,
html.dark-mode .card,
html.dark-mode .lc-card,
html.dark-mode .modal-content,
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
    transition: background-color 0.25s ease, border-color 0.2s ease, color 0.15s ease !important;
}