@import url('/site/fonts.css');
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent-color: #0d9488;
  --matab-blue: #7296e1;
  --font-vazir: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
}

html, body {
  font-family: var(--font-vazir);
  direction: rtl;
  text-align: right;
  background-color: #f8fafc;
  color: #1e293b;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.15s ease;
  font-feature-settings: "ss01" 1, "tnum" 1;
  -webkit-font-feature-settings: "ss01" 1, "tnum" 1;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* All form elements inherit Vazirmatn font & Persian numbers */
button, input, select, textarea {
  font-family: inherit;
  font-feature-settings: "ss01" 1, "tnum" 1;
  -webkit-font-feature-settings: "ss01" 1, "tnum" 1;
  font-variant-numeric: tabular-nums;
}

/* Transform .font-mono from typewriter monospace into elegant tabular Persian digits */
.font-mono,
.font-num,
.tabular-nums,
[dir="ltr"].font-mono,
table th,
table td,
.stats-num,
.badge,
.pill,
.pagination-btn,
input[type="number"],
input[type="tel"] {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif !important;
  font-feature-settings: "ss01" 1, "tnum" 1 !important;
  -webkit-font-feature-settings: "ss01" 1, "tnum" 1 !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: 0 !important;
}

/* Stat card counters & KPI indicators: high contrast, balanced weight and clean spacing */
.stat-card-num,
[id^="statTotal"],
[id^="admStatTotal"],
[id^="statWaiting"],
[id^="statToday"],
[id^="admStatPending"],
[id^="giKpi"],
[id^="kpi"] {
  font-family: 'Vazirmatn', sans-serif !important;
  font-feature-settings: "ss01" 1, "tnum" 1 !important;
  -webkit-font-feature-settings: "ss01" 1, "tnum" 1 !important;
  font-variant-numeric: tabular-nums !important;
  font-weight: 800 !important;
  letter-spacing: -0.015em;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

@media (max-width: 640px) {
  #statTotalIncome,
  #admStatTotalIncome,
  #admStatTotalCommission,
  #admStatTotalCosts {
    font-size: 0.92rem !important;
    line-height: 1.3 !important;
  }
}

/* Genuine English monospace preserved only for code, passwords, and server technical tokens */
.font-latin,
.font-code,
input[type="password"],
code, kbd, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  font-feature-settings: normal !important;
  -webkit-font-feature-settings: normal !important;
  font-variant-numeric: normal !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.25s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Backdrop */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

/* Badges */
.badge-waiting,
.badge-admitted,
.badge-done,
.badge-rejected {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1.3 !important;
  flex-shrink: 0 !important;
  min-width: 78px !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: 9999px !important;
  text-align: center !important;
}
.badge-waiting {
  background-color: #fef3c7;
  color: #b45309;
}
.badge-admitted {
  background-color: #dbeafe;
  color: #1d4ed8;
}
.badge-done {
  background-color: #d1fae5;
  color: #047857;
}
.badge-rejected {
  background-color: #fee2e2;
  color: #b91c1c;
}

/* Ensure table rows and cells do not break text across multiple lines */
#dashTurnsTableBody td,
#dashTurnsTableBody th,
#turnsTableBody td,
#turnsTableBody th,
#patientsTableBody td,
#patientsTableBody th,
#visitsTableBody td,
#visitsTableBody th,
#allVisitsTableBody td,
#allVisitsTableBody th,
#costsTableBody td,
#costsTableBody th,
#repCommissionsTableBody td,
#repCommissionsTableBody th {
  white-space: nowrap;
}

/* Tab Active Styles */
.nav-link.active,
.nav-link.active:hover {
  background-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.nav-link.active:hover {
  background-color: #1d4ed8 !important;
}

/* Prescription Box */
.rx-paper {
  background: #ffffff;
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px dashed #cbd5e1;
}

/* ==========================================================================
   DARK MODE STYLING (طراحی پیشرفته و هارمونیک تم تاریک طبگر)
   ========================================================================== */
html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #090e17; /* Slate 950 Deep Midnight */
  color: #e2e8f0;            /* Slate 200 */
}

/* Scrollbars in dark mode */
html.dark ::-webkit-scrollbar-track {
  background: #090e17;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #26354d;
  border-radius: 4px;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #3b4e6d;
}

/* Surfaces and Cards (Including all Tailwind opacity variants) */
html.dark .bg-white,
html.dark [class*="bg-white/"]:not([class*="hover:"]):not([class*="focus:"]) {
  background-color: #121a29 !important; /* Slate 850 */
}
html.dark .bg-slate-50,
html.dark [class^="bg-slate-50/"],
html.dark [class*=" bg-slate-50/"] {
  background-color: #0c121e !important; /* Slate 900 */
}
html.dark .bg-slate-100,
html.dark [class^="bg-slate-100/"],
html.dark [class*=" bg-slate-100/"] {
  background-color: #1a2538 !important; /* Slate 800 */
}
html.dark .bg-slate-200,
html.dark [class^="bg-slate-200/"],
html.dark [class*=" bg-slate-200/"] {
  background-color: #27374f !important; /* Slate 700 */
}
html.dark .hover\:bg-slate-50:hover {
  background-color: #172235 !important;
}
html.dark .hover\:bg-slate-100:hover {
  background-color: #223249 !important;
}
html.dark .hover\:bg-slate-200:hover {
  background-color: #2e415e !important;
}

/* Text Hierarchy & Readability */
html.dark .text-slate-900 {
  color: #ffffff !important;
}
html.dark .text-slate-800 {
  color: #f1f5f9 !important;
}
html.dark .text-slate-700 {
  color: #e2e8f0 !important;
}
html.dark .text-slate-600 {
  color: #e2e8f0 !important;
}
html.dark .text-slate-500 {
  color: #cbd5e1 !important;
}
html.dark .text-slate-400 {
  color: #94a3b8 !important;
}

/* Borders and Separators */
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300,
html.dark [class*="border-slate-"][class*="/"] {
  border-color: #23344d !important;
}
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-200 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-300 > :not([hidden]) ~ :not([hidden]) {
  border-color: #23344d !important;
}

/* Form Inputs, Selects, and Textareas */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  background-color: #080d16 !important;
  color: #f8fafc !important;
  border-color: #26354d !important;
}
html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28) !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}
html.dark select option {
  background-color: #121a29;
  color: #f8fafc;
}

/* Buttons in Dark Mode */
html.dark button.bg-slate-100,
html.dark a.bg-slate-100,
html.dark .bg-slate-100.hover\:bg-slate-200 {
  background-color: #1b263b !important;
  border: 1px solid #2d3e58 !important;
  color: #f1f5f9 !important;
}
html.dark button.bg-slate-100:hover,
html.dark a.bg-slate-100:hover,
html.dark .bg-slate-100.hover\:bg-slate-200:hover {
  background-color: #263652 !important;
  border-color: #3b5278 !important;
  color: #ffffff !important;
}

/* Shadows in Dark Mode */
html.dark .shadow-sm {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5) !important;
}
html.dark .shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.6) !important;
}
html.dark .shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.7) !important;
}
html.dark .shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.8) !important;
}

/* Header & Navigation */
html.dark header {
  background-color: #111a2a !important;
  border-color: #202e45 !important;
}
html.dark #themeToggleBtn {
  color: #cbd5e1;
}
html.dark #themeToggleBtn:hover {
  background-color: #1e2c44;
  color: #f8fafc;
}
html.dark #btnQuickChat:hover {
  background-color: #1e2c44;
}
html.dark .nav-link:not(.active) {
  color: #94a3b8 !important;
}
html.dark .nav-link:not(.active):hover {
  background-color: #1e2c44 !important;
  color: #ffffff !important;
}

/* Tables & Reporting Headers (High Contrast & Readability in Light & Dark Mode) */
table thead th,
#reportTableHead th {
  background-color: #f1f5f9;
  color: #1e293b !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}
table thead th:hover,
#reportTableHead th:hover {
  background-color: #e2e8f0;
}

html.dark table thead th,
html.dark #reportTableHead th {
  background-color: #0c121e !important;
  color: #e2e8f0 !important;
  border-color: #23344d !important;
}
html.dark table thead th:hover,
html.dark #reportTableHead th:hover {
  background-color: #1a2538 !important;
  color: #ffffff !important;
}
html.dark table tbody td {
  border-color: #23344d !important;
  color: #e2e8f0;
}
html.dark table tbody tr:hover {
  background-color: rgba(30, 44, 68, 0.5) !important;
}
html.dark table tbody tr:nth-child(even) {
  background-color: rgba(12, 18, 30, 0.4);
}

/* Colored Highlights & Stat Badges in Dark Mode */
html.dark .bg-blue-50,
html.dark [class*="bg-blue-50/"] {
  background-color: rgba(37, 99, 235, 0.18) !important;
}
html.dark .bg-emerald-50,
html.dark [class*="bg-emerald-50/"] {
  background-color: rgba(16, 185, 129, 0.18) !important;
}
html.dark .bg-amber-50,
html.dark [class*="bg-amber-50/"] {
  background-color: rgba(245, 158, 11, 0.18) !important;
}
html.dark .bg-purple-50,
html.dark [class*="bg-purple-50/"] {
  background-color: rgba(168, 85, 247, 0.18) !important;
}
html.dark .bg-indigo-50,
html.dark [class*="bg-indigo-50/"] {
  background-color: rgba(99, 102, 241, 0.18) !important;
}
html.dark .bg-rose-50,
html.dark .bg-red-50,
html.dark [class*="bg-rose-50/"],
html.dark [class*="bg-red-50/"] {
  background-color: rgba(239, 68, 68, 0.18) !important;
}
html.dark .bg-teal-50,
html.dark [class*="bg-teal-50/"] {
  background-color: rgba(20, 184, 166, 0.18) !important;
}

/* Light Gradient Banners & Cards in Dark Mode */
html.dark .from-amber-50:not([class*="dark:from-"]),
html.dark [class*="from-amber-50/"]:not([class*="dark:from-"]),
html.dark .from-orange-50:not([class*="dark:from-"]) {
  --tw-gradient-from: rgba(245, 158, 11, 0.16) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(234, 88, 12, 0.12) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
html.dark .from-blue-50:not([class*="dark:from-"]),
html.dark [class*="from-blue-50/"]:not([class*="dark:from-"]),
html.dark .from-indigo-50:not([class*="dark:from-"]),
html.dark [class*="from-indigo-50/"]:not([class*="dark:from-"]) {
  --tw-gradient-from: rgba(37, 99, 235, 0.16) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(79, 70, 229, 0.12) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
html.dark .from-emerald-50:not([class*="dark:from-"]),
html.dark [class*="from-emerald-50/"]:not([class*="dark:from-"]),
html.dark .from-teal-50:not([class*="dark:from-"]) {
  --tw-gradient-from: rgba(16, 185, 129, 0.16) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(20, 184, 166, 0.12) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
html.dark .from-purple-50:not([class*="dark:from-"]),
html.dark .from-pink-50:not([class*="dark:from-"]),
html.dark .from-rose-50:not([class*="dark:from-"]),
html.dark .from-red-50:not([class*="dark:from-"]) {
  --tw-gradient-from: rgba(168, 85, 247, 0.16) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(239, 68, 68, 0.12) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
html.dark .from-slate-50:not([class*="dark:from-"]),
html.dark [class*="from-slate-50/"]:not([class*="dark:from-"]) {
  --tw-gradient-from: rgba(30, 41, 59, 0.85) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(15, 23, 42, 0.9) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .border-blue-100,
html.dark .border-blue-200 {
  border-color: rgba(59, 130, 246, 0.35) !important;
}
html.dark .border-emerald-100,
html.dark .border-emerald-200,
html.dark [class*="border-emerald-"][class*="/"] {
  border-color: rgba(16, 185, 129, 0.35) !important;
}
html.dark .border-amber-100,
html.dark .border-amber-200,
html.dark [class*="border-amber-"][class*="/"] {
  border-color: rgba(245, 158, 11, 0.35) !important;
}
html.dark .border-purple-100,
html.dark .border-purple-200 {
  border-color: rgba(168, 85, 247, 0.35) !important;
}
html.dark .border-indigo-100,
html.dark .border-indigo-200 {
  border-color: rgba(99, 102, 241, 0.35) !important;
}
html.dark .border-rose-100,
html.dark .border-rose-200,
html.dark .border-red-100,
html.dark .border-red-200 {
  border-color: rgba(239, 68, 68, 0.35) !important;
}

/* Vibrant KPI & Stat Card Text Colors in Dark Mode */
html.dark .text-blue-900,
html.dark .text-blue-800,
html.dark .text-blue-700 {
  color: #60a5fa !important;
}
html.dark .text-blue-600 {
  color: #38bdf8 !important;
}
html.dark .text-emerald-900,
html.dark .text-emerald-800,
html.dark .text-emerald-700 {
  color: #34d399 !important;
}
html.dark .text-emerald-600 {
  color: #10b981 !important;
}
html.dark .text-amber-950 {
  color: #fef3c7 !important; /* Amber 100 - bright high contrast */
}
html.dark .text-amber-900,
html.dark .text-amber-800,
html.dark .text-amber-700 {
  color: #fbbf24 !important;
}
html.dark .text-amber-600 {
  color: #f59e0b !important;
}
html.dark .text-emerald-950 {
  color: #ecfdf5 !important;
}
html.dark .text-indigo-950 {
  color: #eef2ff !important;
}
html.dark .text-indigo-900,
html.dark .text-indigo-800,
html.dark .text-indigo-700 {
  color: #a5b4fc !important;
}
html.dark .text-indigo-600 {
  color: #818cf8 !important;
}
html.dark .text-purple-900,
html.dark .text-purple-800,
html.dark .text-purple-700 {
  color: #d8b4fe !important;
}
html.dark .text-purple-600 {
  color: #c084fc !important;
}
html.dark .text-rose-950,
html.dark .text-red-950 {
  color: #ffffff !important; /* White for strong prominence */
}
html.dark .text-rose-900,
html.dark .text-rose-800,
html.dark .text-rose-700,
html.dark .text-red-900,
html.dark .text-red-800,
html.dark .text-red-700 {
  color: #fecdd3 !important; /* Rose 200 - crystal clear */
}
html.dark .text-rose-600,
html.dark .text-red-600 {
  color: #fb7185 !important;
}
html.dark .text-blue-950 {
  color: #eff6ff !important;
}
html.dark .text-slate-950 {
  color: #ffffff !important;
}

/* ================= CASCADE DELETE DOCTOR MODAL (DARK MODE CONTRAST) ================= */
html.dark #deleteDoctorModal .bg-white {
  background-color: #0d1524 !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 40px rgba(225, 29, 72, 0.15) !important;
}
html.dark #deleteDoctorModal .bg-rose-50,
html.dark #deleteDoctorModal [class*="bg-rose-50"] {
  background-color: rgba(225, 29, 72, 0.16) !important;
  border-color: rgba(244, 63, 94, 0.45) !important;
}
html.dark #deleteDoctorModal .bg-rose-100 {
  background-color: rgba(225, 29, 72, 0.3) !important;
}
html.dark #deleteDoctorModal .text-rose-900 {
  color: #ffe4e6 !important;
}
html.dark #deleteDoctorModal .text-rose-800 {
  color: #fecdd3 !important;
}
html.dark #deleteDoctorModal .text-rose-700 {
  color: #fda4af !important;
}
html.dark #deleteDoctorModal #ddmDoctorName {
  color: #ffffff !important;
  background-color: rgba(225, 29, 72, 0.6) !important;
  border: 1px solid rgba(251, 113, 133, 0.6) !important;
  padding: 2px 8px !important;
  border-radius: 6px !important;
  display: inline-block !important;
  font-weight: 900 !important;
}
html.dark #deleteDoctorModal .bg-slate-50 {
  background-color: #151f32 !important;
  border-color: #263852 !important;
}
html.dark #deleteDoctorModal .text-slate-500 {
  color: #cbd5e1 !important; /* High contrast label */
}
html.dark #deleteDoctorModal .text-slate-900 {
  color: #ffffff !important;
}
html.dark #deleteDoctorModal #ddmConfirmLabel {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border: 2px solid rgba(245, 158, 11, 0.6) !important;
}
html.dark #deleteDoctorModal #ddmConfirmLabel:hover {
  background-color: rgba(245, 158, 11, 0.22) !important;
  border-color: rgba(245, 158, 11, 0.8) !important;
}
html.dark #deleteDoctorModal #ddmConfirmLabel span {
  color: #fef3c7 !important; /* Luminous amber-100 */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
html.dark #deleteDoctorModal #ddmConfirmCheck {
  accent-color: #e11d48 !important;
  filter: drop-shadow(0 0 2px rgba(225, 29, 72, 0.5));
}

/* Status Badges */
html.dark .badge-waiting {
  background-color: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
html.dark .badge-admitted {
  background-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
html.dark .badge-done {
  background-color: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
html.dark .badge-rejected {
  background-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Badge pills in tables */
html.dark .bg-blue-100 {
  background-color: rgba(30, 58, 138, 0.45) !important;
  color: #93c5fd !important;
  border: 1px solid rgba(59, 130, 246, 0.35) !important;
}
html.dark .bg-emerald-100 {
  background-color: rgba(6, 78, 59, 0.45) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}
html.dark .bg-amber-100 {
  background-color: rgba(120, 53, 15, 0.45) !important;
  color: #fcd34d !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}
html.dark .bg-indigo-100 {
  background-color: rgba(49, 46, 129, 0.45) !important;
  color: #c7d2fe !important;
  border: 1px solid rgba(99, 102, 241, 0.35) !important;
}
html.dark .bg-rose-100,
html.dark .bg-red-100 {
  background-color: rgba(136, 19, 55, 0.45) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

/* ==========================================================================
   VISIT & CLINICAL CONSULTATION ENHANCEMENTS (طراحی بخش ویزیت بالینی)
   ========================================================================== */

/* 1. Patient Banner at Top of Visit */
html.dark #visitPatientBanner {
  background: linear-gradient(135deg, #101c33 0%, #0d1526 100%) !important;
  border: 1px solid #233654 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}
html.dark #visitPatientBanner #vPatName {
  color: #ffffff !important;
}
html.dark #visitPatientBanner .text-slate-700 {
  color: #f1f5f9 !important;
}
html.dark #visitPatientBanner .text-slate-500 {
  color: #94a3b8 !important;
}
html.dark #visitPatientBanner .bg-white {
  background-color: #090f1d !important;
  border-color: #233654 !important;
}
html.dark #visitPatientBanner #vPatAvatar {
  border-color: #3b82f6 !important;
  background-color: #1e293b !important;
}
html.dark #vDateInput,
html.dark #vTimeInput {
  color: #60a5fa !important;
  font-weight: 700 !important;
}

/* 2. Vitals & Clinical Examination Cards */
html.dark .vital-field-card,
html.dark #dynamicExamFieldsContainer > div {
  background-color: #141f33 !important;
  border-color: #263852 !important;
  transition: all 0.15s ease;
}
html.dark .vital-field-card:hover,
html.dark #dynamicExamFieldsContainer > div:hover {
  border-color: #3b82f6 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}
html.dark .vital-field-card label,
html.dark #dynamicExamFieldsContainer label {
  color: #cbd5e1 !important;
}
html.dark .vital-field-card span.text-slate-400,
html.dark #dynamicExamFieldsContainer span.text-slate-400 {
  color: #38bdf8 !important;
  opacity: 0.85;
}
html.dark .vital-field-card input,
html.dark #dynamicExamFieldsContainer input {
  background-color: #080d16 !important;
  border-color: #253750 !important;
  color: #38bdf8 !important;
  font-weight: 700 !important;
}
html.dark .vital-field-card input:focus,
html.dark #dynamicExamFieldsContainer input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.28) !important;
}

/* 3. Prescription Box (Rx Paper) */
html.dark .rx-paper {
  background: #0f1728 !important;
  background-image: radial-gradient(#273954 1.5px, transparent 1.5px) !important;
  background-size: 20px 20px;
  border: 1px dashed #3a4f70 !important;
}
html.dark .rx-paper .text-blue-600 {
  color: #60a5fa !important;
}
html.dark #vRxInput {
  color: #e2e8f0 !important;
}
html.dark #vRxInput::placeholder {
  color: #64748b !important;
}

/* 4. Common Rx Protocols & Templates (Never blinding white!) */
html.dark #specialtyRxTemplatesContainer {
  background-color: #10192a !important;
  border: 1px solid #23344d !important;
}
html.dark #specialtyRxTemplatesContainer span {
  color: #cbd5e1 !important;
}
html.dark .rx-proto-btn,
html.dark #specialtyRxTemplatesContainer button {
  background-color: #182337 !important;
  border-color: #2e415e !important;
  color: #f1f5f9 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45) !important;
}
html.dark .rx-proto-btn:hover,
html.dark #specialtyRxTemplatesContainer button:hover {
  background-color: #23344e !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
}

/* 5. GI Specialty Tools in Visit Tab */
html.dark #giSpecialtyToolsBox {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.35) 0%, rgba(15, 23, 42, 0.8) 100%) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
html.dark #giSpecialtyToolsBox button {
  background-color: #141f33 !important;
  border-color: #263852 !important;
}
html.dark #giSpecialtyToolsBox button:hover {
  background-color: #1e2e47 !important;
  border-color: #10b981 !important;
}
html.dark #giSpecialtyToolsBox button .text-slate-900 {
  color: #f1f5f9 !important;
}

/* Modals */
html.dark .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.82) !important;
  backdrop-filter: blur(6px);
}
html.dark .modal-backdrop > div {
  border-color: #273954 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85) !important;
}

/* Chat Messages */
html.dark .chat-msg-other {
  background-color: #202e45 !important;
  color: #f8fafc !important;
  border: 1px solid #2e415f;
}

/* Header Shamsi Date in Dark Mode */
html.dark #headerDateWrapper {
  background-color: rgba(18, 26, 41, 0.8) !important;
  border-color: #23344d !important;
}
html.dark #currentShamsiDate {
  color: #93c5fd !important;
}

/* ==========================================================================
   SPECIALTY ANALYTICS CHARTS (DARK MODE ENHANCEMENTS)
   ========================================================================== */
html.dark #repViewCharts .bg-white {
  background-color: #121a29 !important;
  border-color: #23344d !important;
}
html.dark #repViewCharts h4 {
  color: #f8fafc !important;
}
html.dark #repViewCharts .text-slate-900 {
  color: #f8fafc !important;
}
html.dark #repViewCharts .text-slate-500 {
  color: #94a3b8 !important;
}
html.dark #repViewCharts button[title*="دانلود"] {
  border-color: #2e415e !important;
  color: #94a3b8 !important;
}
html.dark #repViewCharts button[title*="دانلود"]:hover {
  background-color: #1a2538 !important;
  color: #f8fafc !important;
  border-color: #3b82f6 !important;
}

/* ==========================================================================
   GLOBAL NAVIGATION & REPORT LOADING STYLES
   ========================================================================== */
#globalProgressBar {
  transition: opacity 0.25s ease-in-out;
}
#globalProgressBarInner {
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.7), 0 0 5px rgba(59, 130, 246, 0.5);
}
html.dark #globalProgressBarInner {
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.9), 0 0 6px rgba(56, 189, 248, 0.7);
}

/* Shimmer Loading Skeleton */
@keyframes tebgarShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.6) 25%, rgba(241, 245, 249, 0.95) 50%, rgba(226, 232, 240, 0.6) 75%);
  background-size: 200% 100%;
  animation: tebgarShimmer 1.5s infinite;
  border-radius: 0.5rem;
}
html.dark .skeleton-shimmer {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.6) 25%, rgba(51, 65, 85, 0.85) 50%, rgba(30, 41, 59, 0.6) 75%);
  background-size: 200% 100%;
  animation: tebgarShimmer 1.5s infinite;
}

/* ==========================================================================
   PRINT STYLING (همیشه کاغذ سفید با بالاترین وضوح پرینت)
   ========================================================================== */
@media print {
  html, body {
    background-color: #ffffff !important;
    color: #000000 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  body * {
    visibility: hidden;
  }
  body.printing-prescription > *:not(#printablePrescription) {
    display: none !important;
  }
  #printablePrescription, #printablePrescription * {
    visibility: visible;
  }
  #printablePrescription {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 24px;
    background: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
  }
  body.printing-prescription #printablePrescription {
    position: static;
  }
  #printablePrescription .bg-slate-50,
  #printablePrescription .bg-slate-100 {
    background-color: #f8fafc !important;
  }
  .no-print {
    display: none !important;
  }
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & FOOTER THEME STYLES
   ========================================================================== */
#mobileBottomNav {
  background-color: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #e2e8f0;
}
.bottom-nav-btn {
  color: #334155 !important; /* slate-700 in light mode */
  transition: all 0.2s ease;
}
.bottom-nav-btn:hover {
  color: #0f172a !important; /* slate-950 in light mode */
}
.bottom-nav-btn.active {
  color: #2563eb !important; /* blue-600 */
  background-color: rgba(37, 99, 235, 0.1) !important;
}

/* Dark Mode: Mobile Bottom Navigation & Footers */
html.dark #mobileBottomNav {
  background-color: rgba(15, 23, 42, 0.95) !important; /* slate-900 */
  border-top-color: #1e293b !important; /* slate-800 */
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45) !important;
}
html.dark .bottom-nav-btn {
  color: #e2e8f0 !important; /* slate-200: light buttons on dark background */
}
html.dark .bottom-nav-btn:hover {
  color: #ffffff !important; /* pure white in dark mode */
}
html.dark .bottom-nav-btn.active {
  color: #60a5fa !important; /* blue-400 */
  background-color: rgba(30, 58, 138, 0.45) !important;
}

/* Workspace Footer */
#panelWorkspaceFooter {
  background-color: rgba(255, 255, 255, 0.85);
  border-top-color: #e2e8f0;
  color: #475569;
}
html.dark #panelWorkspaceFooter {
  background-color: rgba(15, 23, 42, 0.85) !important;
  border-top-color: #1e293b !important;
  color: #94a3b8 !important;
}

/* ==========================================================================
   Collapsible Sidebar (Desktop)
   ========================================================================== */
#sidebarMenu {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

#sidebarInner {
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mainContainer,
#headerContainer {
  transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state adjustments */
body.sidebar-collapsed #sidebarMenu {
  width: 4.5rem !important; /* 72px width */
}

body.sidebar-collapsed #sidebarInner {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

body.sidebar-collapsed #sidebarMenu .nav-link,
body.sidebar-collapsed #sidebarMenu a[href],
body.sidebar-collapsed #sidebarMenu button {
  justify-content: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

body.sidebar-collapsed #sidebarMenu .nav-link span,
body.sidebar-collapsed #sidebarMenu a[href] span,
body.sidebar-collapsed #sidebarMenu button span,
body.sidebar-collapsed #sidebarMenu .sidebar-heading,
body.sidebar-collapsed #sidebarMenu [id$="Count"],
body.sidebar-collapsed #sidebarMenu [id$="Badge"] {
  display: none !important;
}

body.sidebar-collapsed #sidebarMenu .nav-link i,
body.sidebar-collapsed #sidebarMenu button i,
body.sidebar-collapsed #sidebarMenu a i {
  margin: 0 !important;
}

/* Expand main content container when sidebar is collapsed */
body.sidebar-collapsed #mainContainer {
  max-width: 98% !important;
}

body.sidebar-collapsed #headerContainer {
  max-width: 98% !important;
}

