/* ==========================================================================
   Medicare Pulse - Modern Medical CRM & Hospital Automation System
   Design System & Global Styles
   ========================================================================== */

@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 {
  /* Brand Color Palette */
  --primary-50: #ecfeff;
  --primary-100: #cffaff;
  --primary-200: #a5f3fc;
  --primary-400: #22d3ee;
  --primary-500: #06b6d4;
  --primary-600: #0891b2;
  --primary-700: #0e7490;
  --primary-800: #155e75;
  --primary-900: #164e63;

  /* Secondary & Accents */
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --amber-500: #f59e0b;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --purple-500: #8b5cf6;

  /* Dark Theme Surfaces */
  --bg-main: #0b132b;
  --bg-sidebar: #1c2541;
  --bg-card: rgba(28, 37, 65, 0.7);
  --bg-card-hover: rgba(30, 42, 74, 0.9);
  --bg-input: #0e1726;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(6, 182, 212, 0.3);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  /* Layout & Geometry */
  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Shadows & Effects */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.25);
  --glass-bg: rgba(28, 37, 65, 0.65);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --backdrop-blur: blur(16px);
}

/* Light Mode Overrides */
body.light-mode {
  --bg-main: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(6, 182, 212, 0.4);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: 1px solid rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(149, 157, 165, 0.15);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Structure */
#app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s ease;
  backdrop-filter: var(--backdrop-blur);
}

.brand-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: var(--glass-border);
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-500), var(--emerald-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 30%, var(--primary-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

body.light-mode .brand-title {
  background: linear-gradient(135deg, var(--primary-900), var(--primary-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 10px;
  color: var(--primary-400);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-top: -2px;
}

.nav-menu {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-weight: 700;
  margin: 16px 12px 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(6, 182, 212, 0.08);
  transform: translateX(4px);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.9), rgba(16, 185, 129, 0.8));
  box-shadow: var(--shadow-glow);
  font-weight: 600;
}

body.light-mode .nav-item.active {
  color: #ffffff;
}

.nav-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.nav-item .badge-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

/* Sidebar Footer Profile / Quick Actions */
.sidebar-footer {
  padding: 16px;
  border-top: var(--glass-border);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: var(--glass-border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo-500), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

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

.header-search {
  position: relative;
  width: 320px;
}

.header-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.header-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-input);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.header-search input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

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

.role-switcher-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  padding: 4px 8px;
  border-radius: var(--radius-lg);
  border: var(--glass-border);
}

.role-switcher-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  padding-left: 6px;
}

.role-select {
  background: transparent;
  border: none;
  color: var(--primary-400);
  font-weight: 600;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  padding: 4px 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-input);
  border: var(--glass-border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--primary-500);
  background: rgba(6, 182, 212, 0.1);
}

.icon-btn .notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--rose-500);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--rose-500);
}

/* Main Content Views */
.content-body {
  padding: 32px;
  flex: 1;
}

.view-panel {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .top-header {
    padding: 0 16px;
  }
  .content-body {
    padding: 20px 16px;
  }
}
