/* ==========================================================================
   DSCH HEALTH SYSTEM — DESIGN SYSTEM & STYLING (PHASE 1 MVP)
   Health-Related Color Hierarchy | Glassmorphism | Responsive Layouts
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* --- Health-Related Color Hierarchy --- */
  --primary-50: #e6f7f7;
  --primary-100: #c2eded;
  --primary-200: #9adede;
  --primary-300: #6dcece;
  --primary-400: #42bebd;
  --primary-500: #008f8c; /* Medical Teal - Trust, Healing, Clinical Precision */
  --primary-600: #007a78;
  --primary-700: #006361;
  --primary-800: #004d4c;
  --primary-900: #003635;

  --secondary-500: #0284c7; /* Ocean Blue - Reliability, Technology */
  --secondary-600: #0369a1;

  --success-500: #10b981; /* Vitality Emerald - Health, Recovery, Active */
  --success-600: #059669;
  --success-bg: rgba(16, 185, 129, 0.1);

  --warning-500: #f59e0b; /* Amber - Urgent, Waiting Queue */
  --warning-bg: rgba(245, 158, 11, 0.1);

  --danger-500: #ef4444; /* Coral Red - Emergency, Critical Care */
  --danger-bg: rgba(239, 68, 68, 0.1);

  /* --- Neutral Slate & Surface Colors (Light Mode) --- */
  --bg-main: #f4f8fa;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
  --bg-sidebar-active: rgba(0, 143, 140, 0.25);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --text-sidebar: #94a3b8;

  --border-color: #e2e8f0;
  --border-focus: #008f8c;

  /* --- Elevation & Glassmorphism --- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 54, 53, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 20px rgba(0, 143, 140, 0.25);
  
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --backdrop-blur: blur(12px);

  /* --- Transitions & Dimensions --- */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --sidebar-width: 235px;
  --header-height: 64px;
}

/* Sidebar Collapsed Mode for Extra Main Content Width */
body.sidebar-collapsed {
  --sidebar-width: 72px;
}
body.sidebar-collapsed .logo-text-wrap,
body.sidebar-collapsed .logo-sub,
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .menu-label,
body.sidebar-collapsed .nav-link span,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .sidebar-footer .fa-chevron-right {
  display: none !important;
}
body.sidebar-collapsed .sidebar-header {
  justify-content: center !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 12px 6px !important;
}
body.sidebar-collapsed .sidebar-header .sidebar-toggle-wrap {
  position: static !important;
  margin: 0 auto 4px auto !important;
}
body.sidebar-collapsed .sidebar-header .logo-icon {
  width: 36px !important;
  height: 36px !important;
  margin: 0 auto !important;
}
body.sidebar-collapsed .sidebar-header .sidebar-toggle-btn {
  margin: 0 auto;
}
body.sidebar-collapsed .nav-link {
  justify-content: center !important;
  padding: 12px !important;
  border-radius: 10px;
}
body.sidebar-collapsed .nav-icon {
  margin: 0 !important;
  font-size: 18px !important;
}
body.sidebar-collapsed .sidebar-footer {
  padding: 12px 6px !important;
  display: flex;
  justify-content: center;
}


/* --- Dark Mode Theme Override --- */
[data-theme="dark"] {
  --bg-main: #0a0f1d;
  --bg-card: #111827;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1e293b;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.6);
  --glass-bg: rgba(17, 24, 39, 0.85);
  --glass-border: rgba(30, 41, 59, 0.8);
}

/* --- Reset & Base Styles --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
}

ul {
  list-style: none;
}

/* --- Layout Structure --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar Navigation (Ultra-Professional Clean Decent UI/UX) --- */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0b1329 0%, #0f172a 100%);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-header {
  padding: 20px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.15);
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  overflow: hidden;
}

.logo-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-header:hover .logo-icon {
  transform: scale(1.05);
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #ffffff;
  line-height: 1.25;
}

.logo-sub {
  font-size: 10px;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-top: 2px;
  display: block;
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.sidebar-menu {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

/* Custom Scrollbar for Sidebar */
.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

.menu-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
  margin: 16px 12px 6px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #94a3b8;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid transparent;
}

.nav-link .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
  border-color: rgba(255, 255, 255, 0.05);
}

.nav-link:hover .nav-icon {
  transform: scale(1.1);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.18) 0%, rgba(14, 165, 233, 0.04) 100%);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid rgba(14, 165, 233, 0.25);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.12);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3.5px;
  background: #0ea5e9;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px #0ea5e9;
}

.nav-badge {
  margin-left: auto;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 9px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.nav-badge.badge-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
}

.nav-badge.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.25);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.18);
  margin-top: auto;
}

.user-profile-sm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.user-profile-sm:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.status-indicator-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  border: 1.5px solid #0b1329;
  box-shadow: 0 0 6px #10b981;
}

.user-name-text {
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
}

.user-role-text {
  color: #fbbf24;
  font-size: 10.5px;
  font-weight: 600;
  margin-top: 1px;
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

.top-header {
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  width: 340px;
  transition: var(--transition);
}

.header-search:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(0, 143, 140, 0.15);
  width: 380px;
}

.header-search i {
  color: var(--text-muted);
  font-size: 16px;
  margin-right: 10px;
}

.header-search input {
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 16px;
  position: relative;
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--primary-50);
  color: var(--primary-600);
  border-color: var(--primary-300);
  transform: translateY(-2px);
}

[data-theme="dark"] .action-btn:hover {
  background: rgba(0, 143, 140, 0.2);
}

.notif-pulse {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  background: var(--danger-500);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.emergency-ticker {
  background: linear-gradient(90deg, #ef4444, #f97316);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
  animation: slideIn 0.5s ease;
}

/* --- View Port & Sections --- */
.content-body {
  padding: 20px;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Section Headers --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title h2 {
  font-size: 26px;
  margin-bottom: 4px;
}

.section-title p {
  color: var(--text-muted);
  font-size: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 143, 140, 0.3);
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 143, 140, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-main);
  border-color: var(--primary-400);
}

/* --- KPI Metric Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-500);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.kpi-card.blue::before { background: var(--secondary-500); }
.kpi-card.emerald::before { background: var(--success-500); }
.kpi-card.amber::before { background: var(--warning-500); }

.kpi-info h4 {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.kpi-info h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.kpi-trend.up { color: var(--success-500); }
.kpi-trend.down { color: var(--danger-500); }

.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--primary-50);
  color: var(--primary-600);
}

[data-theme="dark"] .kpi-icon {
  background: rgba(0, 143, 140, 0.15);
}

.kpi-card.blue .kpi-icon { background: rgba(2, 132, 199, 0.1); color: var(--secondary-500); }
.kpi-card.emerald .kpi-icon { background: rgba(16, 185, 129, 0.1); color: var(--success-500); }
.kpi-card.amber .kpi-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning-500); }

/* --- Tables & Data Grids --- */
.card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.data-table-container, .table-responsive {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.data-table, table.table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, table.table th {
  padding: 8px 10px;
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border-color);
  white-space: normal;
  line-height: 1.25;
}

.data-table td, table.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
  vertical-align: middle;
  word-break: break-word;
}

.data-table tbody tr, table.table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover, table.table tbody tr:hover {
  background: var(--primary-50);
}

[data-theme="dark"] .data-table tbody tr:hover, 
[data-theme="dark"] table.table tbody tr:hover {
  background: rgba(0, 143, 140, 0.08);
}

/* --- Badges & Status Tags --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success-600); }
.badge-warning { background: var(--warning-bg); color: var(--warning-500); }
.badge-danger { background: var(--danger-bg); color: var(--danger-500); }
.badge-primary { background: rgba(0, 143, 140, 0.1); color: var(--primary-600); }
.badge-secondary { background: rgba(2, 132, 199, 0.1); color: var(--secondary-500); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Doctor Roster Cards --- */
.doctors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.doctor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
  position: relative;
}

.doctor-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-400);
}

.doctor-avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 16px;
}

.doctor-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-100);
}

.status-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--success-500);
  border-radius: 50%;
  border: 3px solid var(--bg-card);
}

.doctor-card h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.specialty-tag {
  color: var(--primary-600);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  display: block;
}

.doctor-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  font-size: 13px;
}

.stat-item strong {
  display: block;
  font-size: 15px;
  color: var(--text-main);
}

.stat-item span { color: var(--text-muted); font-size: 11px; }

/* --- Token Queue Live Display --- */
.queue-board {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

.token-highlight {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.token-highlight h4 {
  color: var(--primary-200);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.current-token-num {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 16px;
  color: #ffffff;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.token-doctor-info {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin-bottom: 20px;
}

/* --- Modals & Forms --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  box-sizing: border-box;
}

.modal-overlay.active,
.modal-overlay.show {
  display: flex !important;
}

.modal-content {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 16px;
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  animation: modalPopIn 0.2s ease-out;
  position: relative;
  z-index: 100000;
}

@keyframes modalPopIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  font-size: 24px;
  color: var(--text-muted);
  transition: var(--transition);
}

.close-btn:hover { color: var(--danger-500); transform: rotate(90deg); }

.modal-body {
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-main);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(0, 143, 140, 0.15);
  outline: none;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-500);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Comprehensive Multi-Device Responsive Media Queries --- */
@media (max-width: 1024px) {
  #mobile-menu-toggle {
    display: inline-flex !important;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .queue-board {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .top-header {
    padding: 0 14px;
    gap: 10px;
  }
  .content-body {
    padding: 14px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .card-box {
    padding: 16px !important;
  }
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 576px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.full-width {
    grid-column: span 1;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .top-header {
    padding: 0 12px;
  }
  .content-body {
    padding: 12px;
  }
  .header-search {
    width: 140px;
  }
  .header-search input {
    font-size: 11px;
    padding-left: 30px;
  }
  .toast-container {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    width: auto !important;
  }
  .toast {
    min-width: auto !important;
    width: 100% !important;
  }
}

/* --- Premium Healthcare UI/UX & Color Theory System --- */
:root {
  --bs-primary: #0284c7;
  --bs-primary-rgb: 2, 132, 199;
  --bs-secondary-color: #64748b;
  --bs-body-font-family: 'Plus Jakarta Sans', sans-serif;
  --bs-headings-font-family: 'Outfit', sans-serif;
}

.font-heading {
  font-family: 'Outfit', sans-serif !important;
}

.text-gradient-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hover-lift {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -10px rgba(2, 132, 199, 0.12), 0 8px 16px -6px rgba(0, 0, 0, 0.04) !important;
}

/* Premium Buttons */
.btn-medical-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%);
  color: #ffffff !important;
  border: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}
.btn-medical-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0f766e 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(2, 132, 199, 0.45);
}

.btn-medical-outline {
  background: rgba(2, 132, 199, 0.06);
  color: #0284c7 !important;
  border: 1px solid rgba(2, 132, 199, 0.3);
  font-weight: 700;
  transition: all 0.25s ease;
}
.btn-medical-outline:hover {
  background: #0284c7;
  color: #ffffff !important;
  border-color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.3);
}

.bg-medical-light {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 40%, #f8fafc 100%);
}

.bg-medical-dark {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

.icon-box-lg {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.icon-box-md {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Form Polish */
.form-control, .form-select {
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  transition: all 0.2s ease;
}
.form-control:focus, .form-select:focus {
  background-color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

/* Badge Polish */
.badge-soft-primary {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
.badge-soft-success {
  background: #d1fae5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.badge-soft-warning {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}
.badge-soft-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
.badge-soft-teal {
  background: #ccfbf1;
  color: #0d9488;
  border: 1px solid #99f6e4;
}

/* Glassmorphism Effect */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* --- WordPress Medical Theme Signature Styles --- */
.wp-card-shadow {
  box-shadow: 0 20px 45px -12px rgba(2, 132, 199, 0.14), 0 8px 16px -6px rgba(0, 0, 0, 0.03) !important;
}

.wp-section-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.2);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 1.6s infinite;
}
@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* --- Desktop Compact / Collapsed Sidebar Mode --- */
@media (min-width: 1025px) {
  body.sidebar-collapsed .sidebar {
    width: 72px;
  }
  
  body.sidebar-collapsed .sidebar .logo-text,
  body.sidebar-collapsed .sidebar .logo-sub,
  body.sidebar-collapsed .sidebar .menu-label,
  body.sidebar-collapsed .sidebar .nav-link span,
  body.sidebar-collapsed .sidebar .nav-badge,
  body.sidebar-collapsed .sidebar .user-info,
  body.sidebar-collapsed .sidebar .user-profile-sm i.fa-angle-right,
  body.sidebar-collapsed .sidebar #sidebar-oncard-toggle,
  body.sidebar-collapsed .sidebar .sidebar-footer-toggle span span {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 16px 8px;
  }

  body.sidebar-collapsed .sidebar-menu {
    padding: 12px 6px;
  }

  body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 11px 0;
    gap: 0;
  }

  body.sidebar-collapsed .nav-link .nav-icon {
    font-size: 18px;
    width: auto;
  }

  body.sidebar-collapsed .user-profile-sm {
    justify-content: center;
    padding: 6px 0;
  }

  body.sidebar-collapsed .sidebar-footer-toggle {
    padding: 8px 0;
    justify-content: center;
  }

  body.sidebar-collapsed .main-content {
    margin-left: 72px !important;
    width: calc(100% - 72px) !important;
    max-width: calc(100% - 72px) !important;
  }
}

/* Enhanced Modal Dialog Scrolling on All Screen Heights & Zoom Levels */
.modal-dialog-scrollable .modal-content {
  max-height: 92vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  max-height: calc(92vh - 140px) !important;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-dialog-scrollable .modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* =========================================================================
   REAL-TIME NOTIFICATION BAR & DROPDOWN STYLING
   ========================================================================= */
#notif-dropdown-menu {
  animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#notif-badge-count {
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: translate(50%, -50%) scale(1); }
  50% { transform: translate(50%, -50%) scale(1.18); box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); }
  100% { transform: translate(50%, -50%) scale(1); }
}

#notif-items-list::-webkit-scrollbar {
  width: 5px;
}
#notif-items-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
}

/* =========================================================================
   RESPONSIVE SIDEBAR & COMPREHENSIVE MOBILE/TABLET BREAKPOINTS
   ========================================================================= */

/* Sidebar overlay backdrop for mobile / tablet */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  cursor: pointer;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Base Mobile Toggle Button (hidden on large screens) */
#mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}
#mobile-menu-toggle:hover {
  background: var(--primary-50);
  color: var(--primary-600);
}

/* -------------------------------------------------------------
   BREAKPOINT 1: TABLET / SMALL LAPTOP (<= 1024px)
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
  /* Default hidden off-screen */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px !important;
    height: 100vh !important;
    z-index: 1050 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  }

  /* When opened / expanded */
  body.sidebar-expanded .sidebar {
    transform: translateX(0) !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #mobile-menu-toggle {
    display: flex !important;
  }

  /* Keep sidebar header toggle button visible so user can close from inside */
  #sidebar-main-toggle {
    display: flex !important;
  }
}

/* -------------------------------------------------------------
   BREAKPOINT 2: MOBILE SCREENS (<= 768px)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .content-body {
    padding: 12px !important;
  }

  .top-header {
    padding: 0 12px !important;
    height: 60px !important;
  }

  /* Search input fluid size */
  .header-search input {
    width: 140px !important;
    font-size: 12px !important;
  }

  /* Section Header mobile stacking */
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .section-title h2 {
    font-size: 20px !important;
  }

  .section-title p {
    font-size: 12px !important;
  }

  /* KPI Cards Grid responsive 2-column on mobile */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .kpi-card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  .kpi-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    border-radius: 10px !important;
  }

  .kpi-info h2 {
    font-size: 20px !important;
  }

  /* Dashboard Major Tabs smooth horizontal scroll */
  .dash-tab-content {
    animation: fadeIn 0.25s ease;
  }

  /* Form Grids on Mobile: single column */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Card Box padding */
  .card-box {
    padding: 14px !important;
    border-radius: 14px !important;
    margin-bottom: 14px !important;
  }

  /* Table container responsive scrolling */
  .data-table-container, .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .data-table th, .data-table td {
    padding: 10px 12px !important;
    font-size: 12.5px !important;
  }

  /* Modal size on mobile */
  .modal-content {
    margin: 10px !important;
    max-height: 90vh !important;
    width: calc(100% - 20px) !important;
  }
}

/* -------------------------------------------------------------
   BREAKPOINT 3: EXTRA SMALL MOBILE SCREENS (<= 480px)
   ------------------------------------------------------------- */
@media (max-width: 480px) {
  .top-header {
    padding: 0 8px !important;
  }

  .header-search {
    display: none !important;
  }

  .header-actions {
    gap: 6px !important;
  }

  /* 1-column KPI grid on tiny screens */
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  /* Notification dropdown centered full width */
  #notif-dropdown-menu {
    width: calc(100vw - 16px) !important;
    right: -50px !important;
    left: auto !important;
  }

  /* Top welcome bar buttons on mobile */
  .card-box .btn {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }
}
