/**
 * Thai-Medical Design Token System V2.0
 * QR Info Portal - Labor Pattaya
 * 
 * Complete design token system with CSS Custom Properties
 * Mobile-first, Thai-optimized, Dark Mode support
 */

/* ============================================
   BRAND COLORS
   ============================================ */

:root {
  /* Royal Thai Blue */
  --thai-blue-50: #eef2ff;
  --thai-blue-100: #e0e7ff;
  --thai-blue-200: #c7d2fe;
  --thai-blue-300: #a5b4fc;
  --thai-blue-400: #818cf8;
  --thai-blue-500: #2D3E8E;
  --thai-blue-600: #252e78;
  --thai-blue-700: #1e2362;
  --thai-blue-800: #171b4d;
  --thai-blue-900: #0f1339;
  --thai-blue-950: #07091f;

  /* Medical Teal (primary brand) */
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #0f766e;
  --teal-600: #0d6b64;
  --teal-700: #0b5f59;
  --teal-800: #0a4f4a;
  --teal-900: #083f3c;

  /* Lotus Pink */
  --lotus-50: #fdf2f8;
  --lotus-100: #fce7f3;
  --lotus-200: #fbcbe8;
  --lotus-300: #f9a8d4;
  --lotus-400: #f472b6;
  --lotus-500: #e8b4c2;
  --lotus-600: #db92a5;
  --lotus-700: #c77089;
  --lotus-800: #a44f6e;
  --lotus-900: #823453;
}

/* ============================================
   SEMANTIC COLORS
   ============================================ */

:root {
  /* Primary - Medical Teal */
  --color-primary: var(--teal-500);
  --color-primary-hover: var(--teal-600);
  --color-primary-light: var(--teal-100);
  
  /* Secondary - Royal Thai Blue */
  --color-secondary: var(--thai-blue-500);
  --color-secondary-hover: var(--thai-blue-600);
  --color-secondary-light: var(--thai-blue-100);
  
  /* Accent - Lotus Pink */
  --color-accent: var(--lotus-500);
  --color-accent-hover: var(--lotus-600);
  
  /* Status Colors */
  --color-success: #047857;
  --color-success-light: rgba(0, 200, 83, 0.1);
  --color-warning: #B45309;
  --color-warning-light: rgba(255, 179, 0, 0.1);
  --color-error: #B91C1C;
  --color-error-light: rgba(211, 47, 47, 0.1);
  --color-info: var(--thai-blue-400);
  --color-info-light: var(--thai-blue-50);
  
  /* Background & Text */
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-text: #1a1a2e;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  
  /* Surface Colors */
  --color-surface: #ffffff;
  --color-surface-elevated: #f9fafb;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

:root {
  /* Font Families */
  --font-thai: 'Sarabun', 'Kanit', 'Noto Sans Thai', system-ui, sans-serif;
  --font-latin: 'Inter', system-ui, -apple-system, sans-serif;
  --font-family: var(--font-thai);
  
  /* 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 - Thai Optimized */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-thai: 1.8;  /* Thai language optimized */
  --line-height-loose: 2;
  
  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
}

/* ============================================
   SPACING SCALE
   ============================================ */

:root {
  --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 */
  --space-32: 8rem;     /* 128px */
}

/* ============================================
   BORDER RADIUS
   ============================================ */

:root {
  --radius-none: 0;
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;  /* 24px */
  --radius-3xl: 2rem;     /* 32px */
  --radius-full: 9999px;
}

/* ============================================
   SHADOWS
   ============================================ */

:root {
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* ============================================
   TRANSITIONS
   ============================================ */

:root {
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-colors: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

/* ============================================
   Z-INDEX SCALE
   ============================================ */

:root {
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   BACKWARD COMPATIBILITY ALIASES
   ============================================ */

:root {
  /* Legacy token names for compatibility */
  --thai-turquoise-500: var(--teal-500);
  --thai-turquoise-600: var(--teal-600);
  --thai-turquoise-700: var(--teal-700);
  --gold-accent: var(--lotus-500);
  --primary: var(--color-primary);
  --secondary: var(--color-secondary);
}

/* ============================================
   DARK MODE TOKENS
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0F1419;
    --color-bg-alt: #1A2332;
    --color-text: #E8ECF1;
    --color-text-secondary: #A0AEC0;
    --color-text-muted: #718096;
    --color-border: #2D3748;
    --color-border-light: #1A2332;
    --color-surface: #1A2332;
    --color-surface-elevated: #2D3748;
  }
}

body.dark-mode {
  --color-bg: #0F1419;
  --color-bg-alt: #1A2332;
  --color-text: #E8ECF1;
  --color-text-secondary: #A0AEC0;
  --color-text-muted: #718096;
  --color-border: #2D3748;
  --color-border-light: #1A2332;
  --color-surface: #1A2332;
  --color-surface-elevated: #2D3748;
}

/* ============================================
   THEME VARIANTS (Demo Mode)
   ============================================ */

[data-theme="warm-earth"] {
  --color-primary: #B87333;
  --color-secondary: #8B4513;
  --color-accent: #DAA520;
}

[data-theme="modern-minimal"] {
  --color-primary: #1a1a1a;
  --color-secondary: #4a4a4a;
  --color-accent: #6366f1;
}

/* ============================================
   THAI TYPOGRAPHY CLASSES
   ============================================ */

.thai-text {
  font-family: var(--font-thai);
  line-height: var(--line-height-thai);
  letter-spacing: var(--tracking-wide);
}

.thai-heading {
  font-family: var(--font-thai);
  font-weight: var(--font-bold);
  line-height: var(--line-height-thai);
}

.thai-body {
  font-family: var(--font-thai);
  font-size: var(--text-base);
  line-height: var(--line-height-thai);
}

/* ============================================
   ACCESSIBILITY - TOUCH TARGETS
   ============================================ */

@media (pointer: coarse) {
  :root {
    --touch-target-min: 44px;
  }
}

/* Minimum touch target for mobile */
button, a, input[type="checkbox"], input[type="radio"] {
  min-height: var(--touch-target-min, 44px);
  min-width: var(--touch-target-min, 44px);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

:root {
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* Mobile-first: use @media (min-width: breakpoint) for desktop */
