/* =========================================================
   Care Navigator — Modern Enterprise-Grade CSS
   Version: 2.0
   Updated: January 2026
   
   Modern design system with:
   - Professional color palette
   - Enhanced typography scale
   - Advanced spacing system
   - Smooth animations and transitions
   - Glassmorphism effects
   - Modern card designs
   - Enterprise-grade components
   ========================================================= */

/* ---------- CSS Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Design Tokens ---------- */
:root {
  /* Color Palette - Modern Blue-Gray System */
  --color-primary-50: #f0f9ff;
  --color-primary-100: #e0f2fe;
  --color-primary-200: #bae6fd;
  --color-primary-300: #7dd3fc;
  --color-primary-400: #38bdf8;
  --color-primary-500: #0ea5e9;
  --color-primary-600: #0284c7;
  --color-primary-700: #0369a1;
  --color-primary-800: #075985;
  --color-primary-900: #0c4a6e;
  
  /* Neutral Colors */
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-400: #94a3b8;
  --color-gray-500: #64748b;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-800: #1e293b;
  --color-gray-900: #0f172a;
  
  /* Semantic Colors */
  --color-success-50: #f0fdf4;
  --color-success-500: #22c55e;
  --color-success-600: #16a34a;
  --color-warning-50: #fffbeb;
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;
  --color-danger-50: #fef2f2;
  --color-danger-500: #ef4444;
  --color-danger-600: #dc2626;
  --color-info-50: #eff6ff;
  --color-info-500: #3b82f6;
  --color-info-600: #2563eb;
  
  /* Surface Colors */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-card: #ffffff;
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Primary Brand Colors */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #bae6fd;
  --primary-dark: #0c4a6e;
  
  /* Borders & Dividers */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-dark: #cbd5e1;
  
  /* Shadows - Enhanced depth system */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-2xl: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
  
  /* Glow effects */
  --glow-primary: 0 0 20px rgba(2, 132, 199, 0.3);
  --glow-success: 0 0 20px rgba(34, 197, 94, 0.3);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  
  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Font Families */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Focus Ring */
  --ring: 0 0 0 3px rgba(2, 132, 199, 0.15);
  --ring-offset: 0 0 0 2px var(--surface);
  
  /* Header/Nav Colors */
  --header-bg: linear-gradient(135deg, var(--color-primary-50) 0%, var(--surface) 100%);
  --nav-pill-bg: rgba(2, 132, 199, 0.1);
  --nav-pill-border: rgba(2, 132, 199, 0.2);
}

/* ---------- Base Styles ---------- */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: var(--text-base);
  min-height: 100vh;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 var(--space) 0;
}

h1 {
  font-size: var(--text-4xl);
  color: var(--text-primary);
  font-weight: 800;
}

h2 {
  font-size: var(--text-3xl);
  color: var(--text-primary);
}

h3 {
  font-size: var(--text-2xl);
  color: var(--text-primary);
}

h4 {
  font-size: var(--text-xl);
  color: var(--text-secondary);
}

p {
  margin: 0 0 var(--space) 0;
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-tertiary);
}

.text-small {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

strong, b {
  font-weight: 600;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* ---------- Layout ---------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: 1024px;
}

.container-wide {
  max-width: 1536px;
}

/* ---------- Modern Card Designs ---------- */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Glassmorphism Card */
.card-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-md);
}

/* Elevated Card */
.card-elevated {
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
  border: none;
}

/* Feature Card with Icon */
.card-feature {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card-feature::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--color-primary-400) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.card-feature:hover::before {
  transform: scaleX(1);
}

.card-feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-light);
}

.card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-50) 0%, var(--color-primary-100) 100%);
  font-size: var(--text-2xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card-feature:hover .card-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-md);
}

/* Stats Card */
.card-stats {
  background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-700) 100%);
  color: var(--text-inverse);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: none;
  position: relative;
  overflow: hidden;
}

.card-stats::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.stats-value {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.stats-label {
  font-size: var(--text-sm);
  opacity: 0.9;
  font-weight: 500;
}

/* ---------- Modern Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--glow-primary);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-secondary {
  background: var(--color-gray-100);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--color-gray-200);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--text-inverse);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--color-gray-100);
  color: var(--text-primary);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--text-lg);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Modern Forms ---------- */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring), var(--shadow-sm);
}

.input:hover:not(:focus) {
  border-color: var(--border-dark);
}

.input::placeholder {
  color: var(--text-tertiary);
}

/* Input with icon */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-tertiary);
  pointer-events: none;
}

.input-group .input {
  padding-left: 2.75rem;
}

/* Form labels */
label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Form validation states */
.input-error,
.input.error {
  border-color: var(--color-danger-500);
}

.input-error:focus,
.input.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-success,
.input.success {
  border-color: var(--color-success-500);
}

.error-message {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-danger-600);
}

.success-message {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-success-600);
}

/* ---------- Modern Grid System ---------- */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Badges & Pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.25rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}

.badge-success {
  background: var(--color-success-50);
  color: var(--color-success-700);
}

.badge-warning {
  background: var(--color-warning-50);
  color: var(--color-warning-700);
}

.badge-danger {
  background: var(--color-danger-50);
  color: var(--color-danger-700);
}

/* ---------- Modern Alerts ---------- */
.alert {
  padding: var(--space);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space);
}

.alert-info {
  background: var(--color-info-50);
  border-color: var(--color-info-500);
  color: var(--color-info-900);
}

.alert-success {
  background: var(--color-success-50);
  border-color: var(--color-success-500);
  color: var(--color-success-900);
}

.alert-warning {
  background: var(--color-warning-50);
  border-color: var(--color-warning-500);
  color: var(--color-warning-900);
}

.alert-danger {
  background: var(--color-danger-50);
  border-color: var(--color-danger-500);
  color: var(--color-danger-900);
}

/* ---------- Loading States ---------- */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-gray-200) 25%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 75%
  );
  background-size: 200% 100%;
  animation: pulse 2s ease-in-out infinite;
  border-radius: var(--radius);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Smooth Animations ---------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out;
}

/* Stagger children animations */
.stagger-animation > * {
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* ---------- Utility Classes ---------- */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.rounded { border-radius: var(--radius); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap { gap: var(--space); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb { margin-bottom: var(--space); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt { margin-top: var(--space); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

/* ---------- Responsive Design ---------- */
@media (max-width: 1024px) {
  :root {
    --text-4xl: 2rem;
    --text-3xl: 1.75rem;
    --space-3xl: 4rem;
  }
  
  .container {
    padding: 0 var(--space);
  }
}

@media (max-width: 768px) {
  :root {
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
    --space-2xl: 2rem;
  }
  
  .card-feature {
    padding: var(--space-lg);
  }
}

@media (max-width: 640px) {
  :root {
    --text-4xl: 1.5rem;
    --space-xl: 2rem;
  }
}

/* ---------- Print Styles ---------- */
@media print {
  .no-print {
    display: none !important;
  }
}

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
