/* ============================================
   CSS VARIABLES - CASCADE OF HOPE HMS
   Design System with Dark Mode Support
   ============================================ */

:root {
  /* ============================================
     COLOR PALETTE - LIGHT MODE (DEFAULT)
     ============================================ */
  
  /* Primary Colors - Hospital Blue Theme */
  --primary-50: #e6f2ff;
  --primary-100: #b3d9ff;
  --primary-200: #80c0ff;
  --primary-300: #4da6ff;
  --primary-400: #1a8cff;
  --primary-500: #0066cc; /* Main Primary */
  --primary-600: #0052a3;
  --primary-700: #003d7a;
  --primary-800: #002952;
  --primary-900: #001429;
  
  /* Secondary Colors - Medical Green */
  --secondary-50: #e6f7f0;
  --secondary-100: #b3e7d1;
  --secondary-200: #80d7b3;
  --secondary-300: #4dc794;
  --secondary-400: #1ab776;
  --secondary-500: #00a86b; /* Main Secondary */
  --secondary-600: #008656;
  --secondary-700: #006441;
  --secondary-800: #00422b;
  --secondary-900: #002116;
  
  /* Semantic Colors */
  --success-light: #d4edda;
  --success: #28a745;
  --success-dark: #1e7e34;
  
  --danger-light: #f8d7da;
  --danger: #dc3545;
  --danger-dark: #bd2130;
  
  --warning-light: #fff3cd;
  --warning: #ffc107;
  --warning-dark: #d39e00;
  
  --info-light: #d1ecf1;
  --info: #17a2b8;
  --info-dark: #117a8b;
  
  /* Neutral Colors - Gray Scale */
  --neutral-50: #f8f9fa;
  --neutral-100: #f1f3f5;
  --neutral-200: #e9ecef;
  --neutral-300: #dee2e6;
  --neutral-400: #ced4da;
  --neutral-500: #adb5bd;
  --neutral-600: #6c757d;
  --neutral-700: #495057;
  --neutral-800: #343a40;
  --neutral-900: #212529;
  
  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --text-disabled: #cccccc;
  --text-inverse: #ffffff;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  /* Border Colors */
  --border-light: #e9ecef;
  --border-medium: #dee2e6;
  --border-dark: #ced4da;
  
  /* ============================================
     SPACING SCALE (8px base)
     ============================================ */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  
  /* ============================================
     TYPOGRAPHY
     ============================================ */
  
  /* Font Families */
  --font-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-secondary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */
  
  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
  
  /* ============================================
     BORDER RADIUS
     ============================================ */
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-base: 0.375rem; /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;
  
  /* ============================================
     SHADOWS
     ============================================ */
  --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 0 rgba(0, 0, 0, 0.06);
  --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-2xl: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  
  /* ============================================
     Z-INDEX LAYERS
     ============================================ */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-popover: 1100;
  --z-tooltip: 1200;
  --z-notification: 1300;
  
  /* ============================================
     TRANSITIONS
     ============================================ */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;
  --transition-slower: 500ms ease-in-out;
  
  /* Easing Functions */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* ============================================
     BREAKPOINTS (for reference in JS)
     ============================================ */
  --breakpoint-xs: 320px;
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
  
  /* ============================================
     CONTAINER WIDTHS
     ============================================ */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
  
  /* ============================================
     COMPONENT SPECIFIC
     ============================================ */
  
  /* Input Heights */
  --input-height-sm: 2rem;    /* 32px */
  --input-height-base: 2.5rem; /* 40px */
  --input-height-lg: 3rem;    /* 48px */
  
  /* Button Heights */
  --button-height-sm: 2rem;    /* 32px */
  --button-height-base: 2.5rem; /* 40px */
  --button-height-lg: 3rem;    /* 48px */
  
  /* Header Height */
  --header-height: 4rem; /* 64px */
  --header-height-mobile: 3.5rem; /* 56px */
  
  /* Sidebar Width */
  --sidebar-width: 16rem; /* 256px */
  --sidebar-width-collapsed: 4rem; /* 64px */
  
  /* Table Row Height */
  --table-row-height: 3rem; /* 48px */
  
  /* ============================================
     EFFECTS
     ============================================ */
  --blur-sm: 4px;
  --blur-base: 8px;
  --blur-md: 12px;
  --blur-lg: 16px;
  --blur-xl: 24px;
  
  /* ============================================
     MEDICAL SPECIFIC COLORS
     ============================================ */
  --blood-red: #c41e3a;
  --heart-rate-red: #ff4444;
  --oxygen-blue: #4a90e2;
  --temperature-orange: #ff8c42;
  --vital-green: #2ecc71;
  
  /* Status Colors */
  --status-pending: #ffc107;
  --status-in-progress: #17a2b8;
  --status-completed: #28a745;
  --status-cancelled: #6c757d;
  --status-critical: #dc3545;
  
  /* Priority Colors */
  --priority-low: #28a745;
  --priority-medium: #ffc107;
  --priority-high: #ff6b6b;
  --priority-urgent: #dc3545;
  --priority-emergency: #c41e3a;
}

/* ============================================
   DARK MODE COLORS
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    /* Primary Colors - Adjusted for Dark Mode */
    --primary-50: #001429;
    --primary-100: #002952;
    --primary-200: #003d7a;
    --primary-300: #0052a3;
    --primary-400: #0066cc;
    --primary-500: #1a8cff; /* Main Primary (brighter) */
    --primary-600: #4da6ff;
    --primary-700: #80c0ff;
    --primary-800: #b3d9ff;
    --primary-900: #e6f2ff;
    
    /* Secondary Colors - Adjusted for Dark Mode */
    --secondary-50: #002116;
    --secondary-100: #00422b;
    --secondary-200: #006441;
    --secondary-300: #008656;
    --secondary-400: #00a86b;
    --secondary-500: #1ab776; /* Main Secondary (brighter) */
    --secondary-600: #4dc794;
    --secondary-700: #80d7b3;
    --secondary-800: #b3e7d1;
    --secondary-900: #e6f7f0;
    
    /* Semantic Colors - Dark Mode */
    --success-light: #1e4620;
    --success: #2ecc71;
    --success-dark: #5cd68d;
    
    --danger-light: #4a1f23;
    --danger: #ff4444;
    --danger-dark: #ff6b6b;
    
    --warning-light: #4a3f1f;
    --warning: #ffc107;
    --warning-dark: #ffd54f;
    
    --info-light: #1f3a4a;
    --info: #4a90e2;
    --info-dark: #74aae8;
    
    /* Neutral Colors - Dark Mode */
    --neutral-50: #1a1d21;
    --neutral-100: #22262b;
    --neutral-200: #2b3139;
    --neutral-300: #363d47;
    --neutral-400: #4b5563;
    --neutral-500: #6b7280;
    --neutral-600: #9ca3af;
    --neutral-700: #d1d5db;
    --neutral-800: #e5e7eb;
    --neutral-900: #f3f4f6;
    
    /* Text Colors - Dark Mode */
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --text-disabled: #6b7280;
    --text-inverse: #1a1d21;
    
    /* Background Colors - Dark Mode */
    --bg-primary: #0f1419;
    --bg-secondary: #1a1d21;
    --bg-tertiary: #22262b;
    --bg-elevated: #2b3139;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    /* Border Colors - Dark Mode */
    --border-light: #2b3139;
    --border-medium: #363d47;
    --border-dark: #4b5563;
    
    /* Shadows - Dark Mode (more subtle) */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --shadow-2xl: 0 35px 60px -15px rgba(0, 0, 0, 0.7);
    
    /* Medical Colors - Dark Mode Adjusted */
    --blood-red: #ff6b82;
    --heart-rate-red: #ff6b6b;
    --oxygen-blue: #74aae8;
    --temperature-orange: #ffab5e;
    --vital-green: #5cd68d;
  }
}

/* ============================================
   MANUAL DARK MODE OVERRIDE
   (for users who manually toggle)
   ============================================ */

[data-theme="dark"] {
  /* Same as @media (prefers-color-scheme: dark) */
  --primary-500: #1a8cff;
  --secondary-500: #1ab776;
  
  --success: #2ecc71;
  --danger: #ff4444;
  --warning: #ffc107;
  --info: #4a90e2;
  
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  
  --bg-primary: #0f1419;
  --bg-secondary: #1a1d21;
  --bg-tertiary: #22262b;
  --bg-elevated: #2b3139;
  
  --border-light: #2b3139;
  --border-medium: #363d47;
  --border-dark: #4b5563;
}

[data-theme="light"] {
  /* Force light mode even if system prefers dark */
  --primary-500: #0066cc;
  --secondary-500: #00a86b;
  
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
}

/* ============================================
   CSS CUSTOM PROPERTY FALLBACKS
   (for older browsers)
   ============================================ */

@supports not (--css: variables) {
  :root {
    color: #1a1a1a;
    background-color: #ffffff;
    font-family: 'Poppins', sans-serif;
  }
}