/* ==========================================================================
   HIS STATS - Global Design System & Common Styles
   Clinical Healthcare Analytics & Statistical Intelligence Portal
   ========================================================================== */

/* Google Fonts: IBM Plex Sans & IBM Plex Mono for Clinical Typography */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Core Clinical Palette */
  --his-navy-950: #060d17;
  --his-navy-900: #0b1524;
  --his-navy-800: #102038;
  --his-navy-700: #1a3254;
  
  --his-cyan-600: #0284c7;
  --his-cyan-500: #0ea5e9;
  --his-cyan-400: #38bdf8;
  --his-cyan-soft: #f0f9ff;

  --his-teal-700: #0f766e;
  --his-teal-600: #0d9488;
  --his-teal-500: #14b8a6;
  --his-teal-soft: #f0fdfa;

  --his-emerald: #10b981;
  --his-amber: #f59e0b;
  --his-rose: #f43f5e;
  --his-indigo: #6366f1;
  --his-purple: #8b5cf6;

  /* Neutrals & Surfaces */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #ffffff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.18);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Custom Smooth Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Base Body */
body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  padding: 0;
  margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Monospace Class */
.mono, .font-mono {
  font-family: 'IBM Plex Mono', monospace !important;
}

/* Return to Home / Portal Badge */
.btn-home-portal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(14, 165, 233, 0.1);
  color: var(--his-cyan-600);
  border: 1px solid rgba(14, 165, 233, 0.28);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-home-portal:hover {
  background: var(--his-cyan-600);
  color: #ffffff;
  border-color: var(--his-cyan-600);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ==========================================================================
   HIS STATS - Unified Top Clinical Navbar (Shared Across All Pages)
   ========================================================================== */
.his-navbar {
  background: var(--his-navy-900);
  color: var(--text-light);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 1050;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 100%;
}

.his-nav-container {
  max-width: 1640px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.his-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition-fast);
}

.his-brand:hover {
  opacity: 0.94;
  color: inherit;
}

.brand-symbol {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  flex-shrink: 0;
  animation: pulseGlow 3s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35); }
  50% { box-shadow: 0 4px 22px rgba(14, 165, 233, 0.65); }
}

.brand-details {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.brand-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.his-nav-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Dashboard Navigation Link in Navbar */
.btn-nav-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-nav-home:hover {
  background: var(--his-cyan-600);
  color: #ffffff;
  border-color: var(--his-cyan-600);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

/* User Profile & Auth Nav Controls */
.user-profile-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: #f1f5f9;
}

.user-profile-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--his-cyan-500), var(--his-teal-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.user-profile-name {
  font-weight: 600;
  color: #ffffff;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-dept {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.12);
  color: var(--his-cyan-400);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-nav-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-nav-logout:hover {
  background: #e11d48;
  color: #ffffff;
  border-color: #e11d48;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.35);
  transform: translateY(-1px);
}

.btn-nav-login {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--his-cyan-600), var(--his-teal-600));
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
  transition: all var(--transition-fast);
}

.btn-nav-login:hover {
  background: linear-gradient(135deg, var(--his-cyan-500), var(--his-teal-500));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

.live-clock-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.clock-icon {
  color: #38bdf8;
}

.clock-time {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: #ffffff;
}

.clock-date {
  color: #94a3b8;
  font-size: 0.74rem;
}

.his-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

/* Responsive Navigation */
@media (max-width: 992px) {
  .his-nav-container {
    padding: 8px 16px;
    gap: 10px;
  }
  .brand-sub {
    display: none;
  }
}

@media (max-width: 640px) {
  .his-nav-container {
    padding: 8px 12px;
  }
  .brand-symbol {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }
  .brand-title {
    font-size: 0.98rem;
  }
  .brand-badge {
    display: none;
  }
  .his-nav-meta {
    gap: 8px;
  }
  .live-clock-card .clock-date {
    display: none;
  }
  .his-status-badge span:last-child {
    display: none;
  }
  .btn-nav-home span {
    display: none;
  }
  .btn-nav-home {
    padding: 5px 10px;
  }
}


/* Pulsing Live Dot */
.his-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--his-emerald);
  display: inline-block;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  animation: hisPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes hisPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.15); }
}

/* Smooth Table Design - Single Screen Responsive Scroll */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: auto;
  max-height: 480px;
  position: relative;
  margin-bottom: 20px;
}

.table-wrapper table {
  margin-bottom: 0;
  width: 100%;
  border-collapse: collapse;
}

.table-wrapper thead th,
.scroll-table thead th,
.table-responsive thead th,
.table-standard thead th,
.death-audit-table thead th {
  background: #f8fafc;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.table-wrapper .table-responsive {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
}

/* Scroll Table Container Utility */
.scroll-table {
  max-height: 380px;
  overflow-y: auto;
  overflow-x: auto;
}

/* Single Screen Report Viewport Container */
.report-screen-viewport {
  max-height: calc(100vh - 145px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

/* Sleek Scrollbar for all table containers */
.table-wrapper::-webkit-scrollbar,
.scroll-table::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.report-screen-viewport::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.table-wrapper::-webkit-scrollbar-track,
.scroll-table::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.report-screen-viewport::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb,
.scroll-table::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.report-screen-viewport::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.scroll-table::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover,
.report-screen-viewport::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table-wrapper tbody td {
  padding: 9px 14px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table-wrapper tbody tr:hover {
  background-color: #f8fafc;
}

/* Chart Container Cards */
.chart-card-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 24px;
  position: relative;
  transition: box-shadow var(--transition-smooth);
}

.chart-card-wrapper:hover {
  box-shadow: var(--shadow-md);
}

/* Modern Empty State Prompt */
.empty-prompt-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  margin: 20px 0;
  box-shadow: var(--shadow-xs);
}

.empty-prompt-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.empty-prompt-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-prompt-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
}

/* Global Loading Overlay */
.loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(11, 21, 36, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 22px 32px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity var(--transition-fast);
}

.loader img {
  width: 40px;
  height: 40px;
}
