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

:root {
  /* Hospital Core Colors */
  --primary: #0A6EBD;
  --primary-dark: #064F8C;
  --primary-light: #E8F4FD;
  --secondary: #00B4A6;
  --secondary-dark: #007A6E;
  --accent: #FF6B35;
  --accent-soft: #FFF0EB;

  /* Neutrals */
  --white: #FFFFFF;
  --bg: #F4F8FB;
  --bg-alt: #EEF3F8;
  --border: #D0DFE9;
  --text: #1A2B3C;
  --text-muted: #5A7080;
  --text-light: #8BA0AF;

  /* Status Colors */
  --danger: #E53E3E;
  --danger-soft: #FFF5F5;
  --warning: #F6AD55;
  --warning-soft: #FFFAF0;
  --success: #48BB78;
  --success-soft: #F0FFF4;
  --info: #4299E1;

  /* Disease Alert Colors */
  --communicable: #E53E3E;
  --airborne: #F6AD55;
  --non-communicable: #48BB78;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(10,110,189,0.08);
  --shadow-md: 0 4px 16px rgba(10,110,189,0.12);
  --shadow-lg: 0 8px 32px rgba(10,110,189,0.16);
  --shadow-xl: 0 16px 48px rgba(10,110,189,0.20);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Fonts */
  --font-display: 'Playfair Display', serif;
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* TYPOGRAPHY */
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }
h4, h5, h6 { font-family: var(--font-body); font-weight: 600; line-height: 1.3; }

.display-text { font-family: var(--font-display); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border: none; border-radius: var(--radius-full);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-decoration: none;
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.12); }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(10,110,189,0.35); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 20px rgba(10,110,189,0.45); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: #fff; box-shadow: 0 4px 14px rgba(0,180,166,0.3); }
.btn-secondary:hover { background: var(--secondary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(229,62,62,0.3); }
.btn-danger:hover { background: #c53030; transform: translateY(-1px); }
.btn-ghost { background: var(--bg-alt); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { padding: 10px; border-radius: var(--radius-md); }

/* CARDS */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 24px; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg-alt); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* FORMS */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; letter-spacing: 0.02em; }
.form-control {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); font-family: var(--font-body); font-size: 14px;
  color: var(--text); background: var(--white); transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,110,189,0.1); }
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-soft); color: #276749; }
.badge-danger { background: var(--danger-soft); color: #c53030; }
.badge-warning { background: var(--warning-soft); color: #c05621; }
.badge-info { background: #EBF8FF; color: #2b6cb0; }

/* ALERTS */
.alert {
  padding: 14px 18px; border-radius: var(--radius-md);
  font-size: 14px; border-left: 4px solid; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-info { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.alert-success { background: var(--success-soft); border-color: var(--success); color: #276749; }
.alert-danger { background: var(--danger-soft); border-color: var(--danger); color: #c53030; }
.alert-warning { background: var(--warning-soft); border-color: var(--warning); color: #c05621; }

/* LAYOUT HELPERS */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* SIDEBAR LAYOUT */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; min-height: 100vh; background: var(--white);
  border-right: 1px solid var(--border); position: fixed; top: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column; box-shadow: var(--shadow-md);
}
.main-content { margin-left: 260px; flex: 1; min-height: 100vh; }
.topbar {
  height: 64px; background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm);
}
.page-content { padding: 32px; }

/* SIDEBAR STYLES */
.sidebar-brand {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px; background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; flex-shrink: 0;
}
.sidebar-brand .brand-name { font-family: var(--font-heading); font-weight: 800; font-size: 16px; color: var(--text); }
.sidebar-brand .brand-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-light); padding: 8px 12px 6px; margin-top: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition);
  color: var(--text-muted); font-size: 14px; font-weight: 500; margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(10,110,189,0.3); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--accent); color: #fff;
  border-radius: var(--radius-full); font-size: 11px; font-weight: 700; padding: 2px 7px;
}
.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* STAT CARDS */
.stat-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 24px;
  border: 1px solid var(--border); position: relative; overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 4px; background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.stat-value { font-family: var(--font-heading); font-size: 28px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-change { font-size: 12px; margin-top: 8px; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* PAGE HEADER */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }

/* TABLE */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg-alt); padding: 12px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border); }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,27,50,0.55);
  backdrop-filter: blur(4px); z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--white); border-radius: var(--radius-xl); max-width: 560px;
  width: 100%; box-shadow: var(--shadow-xl); animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 24px 28px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px 28px 24px; }
.modal-footer { padding: 0 28px 24px; display: flex; gap: 12px; justify-content: flex-end; }
.modal-close { background: var(--bg-alt); border: none; width: 32px; height: 32px; border-radius: var(--radius-full); cursor: pointer; font-size: 16px; transition: var(--transition); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.modal-close:hover { background: var(--border); color: var(--text); }

/* TOASTS */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--white); border-radius: var(--radius-md); padding: 14px 18px;
  box-shadow: var(--shadow-lg); border-left: 4px solid; min-width: 300px;
  display: flex; align-items: flex-start; gap: 12px; animation: slideInRight 0.35s ease;
  font-size: 14px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--primary); }
.toast.warning { border-color: var(--warning); }
.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.toast-msg { color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.toast-close { margin-left: auto; cursor: pointer; color: var(--text-light); font-size: 16px; padding: 0 4px; background: none; border: none; }

/* STEPS / PROGRESS */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 32px; }
.step { flex: 1; display: flex; align-items: center; position: relative; }
.step-circle {
  width: 36px; height: 36px; border-radius: var(--radius-full); border: 2px solid var(--border);
  background: var(--white); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted); z-index: 1; flex-shrink: 0;
  transition: var(--transition);
}
.step.active .step-circle { border-color: var(--primary); background: var(--primary); color: #fff; }
.step.done .step-circle { border-color: var(--success); background: var(--success); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); transition: var(--transition); }
.step.done .step-line { background: var(--success); }
.step-label { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step.active .step-label { color: var(--primary); }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 24px; text-align: center; cursor: pointer; transition: var(--transition);
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary); background: var(--primary-light);
}
.upload-zone .upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; margin-bottom: 4px; }
.upload-zone strong { color: var(--primary); }

/* AI THINKING ANIMATION */
.ai-thinking { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--primary-light); border-radius: var(--radius-md); margin-bottom: 16px; }
.ai-dots { display: flex; gap: 6px; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: bounce 1.4s infinite ease-in-out; }
.ai-dot:nth-child(1) { animation-delay: 0s; }
.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* DISEASE TYPE BUTTONS */
.disease-btn {
  padding: 14px 20px; border-radius: var(--radius-md); border: 2px solid transparent;
  cursor: pointer; font-weight: 700; font-size: 14px; transition: var(--transition);
  display: flex; align-items: center; gap: 10px; width: 100%; background: var(--bg-alt);
}
.disease-btn.communicable { color: var(--communicable); border-color: var(--communicable); }
.disease-btn.communicable:hover, .disease-btn.communicable.selected { background: var(--communicable); color: #fff; }
.disease-btn.airborne { color: var(--airborne); border-color: var(--airborne); }
.disease-btn.airborne:hover, .disease-btn.airborne.selected { background: var(--airborne); color: #fff; }
.disease-btn.non-communicable { color: var(--non-communicable); border-color: var(--non-communicable); }
.disease-btn.non-communicable:hover, .disease-btn.non-communicable.selected { background: var(--non-communicable); color: #fff; }

/* NOTIFICATION PILL */
.notif-pill {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px;
  background: var(--white); border-radius: var(--radius-md); border: 1px solid var(--border);
  margin-bottom: 10px; transition: var(--transition);
}
.notif-pill:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-light); }
.notif-pill.unread { border-left: 3px solid var(--primary); background: var(--primary-light); }
.notif-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }

/* CHAT / QA */
.qa-bubble { padding: 14px 18px; border-radius: var(--radius-lg); margin-bottom: 12px; max-width: 80%; font-size: 14px; line-height: 1.5; }
.qa-bubble.ai { background: var(--primary-light); color: var(--primary-dark); border-bottom-left-radius: 4px; margin-right: auto; }
.qa-bubble.user { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; margin-left: auto; }
.qa-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; color: var(--text-muted); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner { animation: spin 1s linear infinite; display: inline-block; }
.pulse { animation: pulse 2s ease-in-out infinite; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 20px 16px; }
}
