/* Custom polish & print rules */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.65);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 0.6rem;
  color: #cbd5e1;
  font-weight: 500;
  transition: all 0.15s ease;
  text-align: left;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.nav-item.active {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-weight: 700;
  margin-top: 0.75rem;
  margin-bottom: 0.4rem;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.markdown-body ul { list-style-type: disc; }
.markdown-body ol { list-style-type: decimal; }
.markdown-body p { margin-bottom: 0.5rem; }
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.875rem;
}
.markdown-body th, .markdown-body td {
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.6rem;
}
.markdown-body th { background: #f8fafc; }

/* ==================== GLOBAL DARK MODE ==================== */
html.dark {
  color-scheme: dark;
}
html.dark body {
  background-color: #0b1120 !important;
  color: #e2e8f0 !important;
}
html.dark header {
  background-color: rgba(15, 23, 42, 0.92) !important;
  border-color: #1e293b !important;
}
html.dark aside#sidebar {
  background-color: #070b14 !important;
  border-right: 1px solid #1e293b;
}

/* Surfaces & Cards */
html.dark .bg-white,
html.dark .bg-white\/90,
html.dark .bg-white\/80,
html.dark .bg-white\/60 {
  background-color: #111827 !important;
}
html.dark .bg-slate-50,
html.dark .bg-slate-50\/80,
html.dark .bg-slate-50\/70,
html.dark .bg-slate-50\/60 {
  background-color: #1e293b !important;
}
html.dark .bg-slate-100,
html.dark .bg-slate-100\/70 {
  background-color: #0f172a !important;
}
html.dark .hover\:bg-slate-50:hover,
html.dark .hover\:bg-slate-50\/70:hover,
html.dark .hover\:bg-slate-100:hover {
  background-color: #1e293b !important;
}

/* Borders & Dividers */
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300 {
  border-color: #334155 !important;
}
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
  border-color: #1e293b !important;
}

/* Typography */
html.dark .text-slate-900,
html.dark .text-slate-800 {
  color: #f1f5f9 !important;
}
html.dark .text-slate-700 {
  color: #e2e8f0 !important;
}
html.dark .text-slate-600 {
  color: #cbd5e1 !important;
}
html.dark .text-slate-500 {
  color: #94a3b8 !important;
}
html.dark .text-slate-400 {
  color: #94a3b8 !important;
}

/* Form Inputs */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

/* Colored Tinted Cards & Badges in Dark Mode */
html.dark .bg-indigo-50,
html.dark .bg-indigo-50\/70,
html.dark .bg-indigo-50\/60,
html.dark .bg-indigo-50\/50,
html.dark .bg-indigo-50\/40 {
  background-color: rgba(99, 102, 241, 0.16) !important;
}
html.dark .border-indigo-100,
html.dark .border-indigo-200,
html.dark .border-indigo-300 {
  border-color: rgba(99, 102, 241, 0.38) !important;
}
html.dark .text-indigo-600,
html.dark .text-indigo-600\/90,
html.dark .text-indigo-700,
html.dark .text-indigo-800,
html.dark .text-indigo-900 {
  color: #a5b4fc !important;
}

html.dark .bg-sky-50,
html.dark .bg-sky-50\/70,
html.dark .bg-sky-100 {
  background-color: rgba(14, 165, 233, 0.16) !important;
}
html.dark .border-sky-200 {
  border-color: rgba(56, 189, 248, 0.35) !important;
}
html.dark .text-sky-600,
html.dark .text-sky-700,
html.dark .text-sky-800 {
  color: #7dd3fc !important;
}

html.dark .bg-emerald-50,
html.dark .bg-emerald-50\/70,
html.dark .bg-emerald-50\/60,
html.dark .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.16) !important;
}
html.dark .border-emerald-200 {
  border-color: rgba(52, 211, 153, 0.35) !important;
}
html.dark .text-emerald-600,
html.dark .text-emerald-700,
html.dark .text-emerald-800 {
  color: #6ee7b7 !important;
}

html.dark .bg-amber-50,
html.dark .bg-amber-50\/70,
html.dark .bg-amber-50\/60,
html.dark .bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.16) !important;
}
html.dark .border-amber-200 {
  border-color: rgba(251, 191, 36, 0.35) !important;
}
html.dark .text-amber-700,
html.dark .text-amber-800,
html.dark .text-amber-900 {
  color: #fcd34d !important;
}

html.dark .bg-rose-50,
html.dark .bg-rose-50\/70,
html.dark .bg-rose-50\/50,
html.dark .bg-rose-100 {
  background-color: rgba(244, 63, 94, 0.16) !important;
}
html.dark .border-rose-100,
html.dark .border-rose-200 {
  border-color: rgba(251, 113, 133, 0.38) !important;
}
html.dark .text-rose-600,
html.dark .text-rose-700,
html.dark .text-rose-800 {
  color: #fda4af !important;
}

html.dark .bg-violet-50,
html.dark .bg-violet-50\/70,
html.dark .bg-violet-100 {
  background-color: rgba(139, 92, 246, 0.16) !important;
}
html.dark .border-violet-200 {
  border-color: rgba(167, 139, 250, 0.38) !important;
}
html.dark .text-violet-600,
html.dark .text-violet-700,
html.dark .text-violet-800 {
  color: #c4b5fd !important;
}

html.dark .from-rose-50 {
  --tw-gradient-from: rgba(244, 63, 94, 0.18) !important;
}
html.dark .to-amber-50 {
  --tw-gradient-to: rgba(245, 158, 11, 0.14) !important;
}
html.dark .markdown-body th {
  background: #1e293b;
}
html.dark .markdown-body th,
html.dark .markdown-body td {
  border-color: #334155;
}

@media print {
  html.dark, html.dark body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  body { background: #ffffff !important; }
  .print\:hidden { display: none !important; }
  #prescriptionPrintArea {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}
