/* CSS Variables - ROA2WEB Design System */

:root {
  /* Spacing System */
  --space-xs: 0.25rem; /* 4px */
  --space-sm: 0.5rem; /* 8px */
  --space-md: 1rem; /* 16px */
  --space-lg: 1.5rem; /* 24px */
  --space-xl: 2rem; /* 32px */
  --space-2xl: 3rem; /* 48px */
  --space-3xl: 4rem; /* 64px */

  /* Typography Scale */
  --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: 2rem; /* 32px */
  --text-4xl: 2.5rem; /* 40px */

  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-loose: 1.75;

  /* Colors - Minimal Professional Palette */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #3b82f6;

  --color-secondary: #64748b;
  --color-secondary-dark: #475569;
  --color-secondary-light: #94a3b8;

  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #0891b2;

  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-text-inverse: #ffffff;

  --color-bg: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-bg-muted: #f3f4f6;
  --color-bg-dark: #111827;

  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  --color-border-dark: #d1d5db;

  /* Surface colors for PrimeVue compatibility */
  --surface-0: #ffffff;
  --surface-50: #f8fafc;
  --surface-100: #f1f5f9;
  --surface-200: #e2e8f0;
  --surface-300: #cbd5e1;
  --surface-400: #94a3b8;
  --surface-500: #64748b;
  --surface-600: #475569;
  --surface-700: #334155;
  --surface-800: #1e293b;
  --surface-900: #0f172a;
  --surface-950: #020617;

  /* Semantic surface tokens (PrimeVue-style) - CRITICAL for dark mode */
  --surface-card: #ffffff;
  --surface-ground: #f8fafc;
  --surface-section: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-border: #e2e8f0;
  --surface-overlay: #ffffff;

  /* Primary color scale */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Green color scale (success) */
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  /* Yellow color scale (warning) */
  --yellow-50: #fefce8;
  --yellow-100: #fef9c3;
  --yellow-200: #fef08a;
  --yellow-300: #fde047;
  --yellow-400: #facc15;
  --yellow-500: #eab308;
  --yellow-600: #ca8a04;
  --yellow-700: #a16207;
  --yellow-800: #854d0e;
  --yellow-900: #713f12;

  /* Blue color scale (info) */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* Gray color scale */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Red color palette for errors */
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-300: #fca5a5;
  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;
  --red-900: #7f1d1d;
  --red-950: #450a0a;

  /* Compatibility aliases for old variable names */
  --primary-color: var(--color-primary);
  --primary-color-dark: var(--color-primary-dark);
  --primary-color-light: var(--color-primary-light);
  --text-color: var(--color-text);
  --text-color-secondary: var(--color-text-secondary);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:
    0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius-sm: 0.25rem; /* 4px */
  --radius-md: 0.5rem; /* 8px */
  --radius-lg: 0.75rem; /* 12px */
  --radius-xl: 1rem; /* 16px */
  --radius-full: 9999px;

  /* Layout Specific */
  --header-height: 56px;
  --sidebar-width: 240px;
  --card-radius: var(--radius-md);
  --container-max-width: 1400px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Additional Status Colors */
  --color-success-bg: rgba(5, 150, 105, 0.1);
  --color-warning-bg: rgba(217, 119, 6, 0.1);
  --color-error-bg: rgba(220, 38, 38, 0.1);
  --color-info-bg: rgba(8, 145, 178, 0.1);

  /* Color RGB values for opacity usage */
  --color-primary-rgb: 37, 99, 235;
  --color-success-rgb: 5, 150, 105;
  --color-warning-rgb: 217, 119, 6;
  --color-error-rgb: 220, 38, 38;

  /* Monospace font for numbers */
  --font-mono:
    "SF Mono", Consolas, "Liberation Mono", Menlo, Courier, monospace;

  /* Z-Index Scale */
  --z-dropdown: 1200;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;

  /* Breakpoints (for reference in media queries) */
  --breakpoint-mobile: 480px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;
  --breakpoint-wide: 1400px;
}

/* Manual dark theme via data-theme attribute (highest priority) */
[data-theme="dark"] {
  /* Text colors - inverted for dark mode */
  --color-text: #f9fafb;
  --color-text-secondary: #d1d5db;
  --color-text-muted: #9ca3af;
  --text-color: #f9fafb;
  --text-color-secondary: #d1d5db;

  /* Background colors */
  --color-bg: #111827;
  --color-bg-secondary: #1f2937;
  --color-bg-muted: #374151;

  /* Border colors */
  --color-border: #374151;
  --color-border-light: #4b5563;
  --color-border-dark: #6b7280;

  /* Surface numeric scale - inverted for dark mode */
  --surface-0: #0f172a;
  --surface-50: #1e293b;
  --surface-100: #334155;
  --surface-200: #475569;
  --surface-300: #64748b;
  --surface-400: #94a3b8;
  --surface-500: #cbd5e1;
  --surface-600: #e2e8f0;
  --surface-700: #f1f5f9;
  --surface-800: #f8fafc;
  --surface-900: #ffffff;
  --surface-950: #ffffff;

  /* Semantic surface tokens - CRITICAL for dark mode components */
  --surface-card: #1e293b;
  --surface-ground: #0f172a;
  --surface-section: #1e293b;
  --surface-hover: #334155;
  --surface-border: #475569;
  --surface-overlay: #1e293b;

  /* Gray scale - inverted for dark mode */
  --gray-50: #111827;
  --gray-100: #1f2937;
  --gray-200: #374151;
  --gray-300: #4b5563;
  --gray-400: #6b7280;
  --gray-500: #9ca3af;
  --gray-600: #d1d5db;
  --gray-700: #e5e7eb;
  --gray-800: #f3f4f6;
  --gray-900: #f9fafb;

  /* Status colors - slightly adjusted for dark backgrounds */
  --green-50: #052e16;
  --green-100: #14532d;
  --green-800: #86efac;
  --green-900: #bbf7d0;

  --yellow-50: #422006;
  --yellow-100: #713f12;
  --yellow-800: #fde047;
  --yellow-900: #fef08a;

  --red-50: #450a0a;
  --red-100: #7f1d1d;
  --red-800: #fca5a5;
  --red-900: #fecaca;

  --blue-50: #1e3a8a;
  --blue-100: #1e40af;
  --blue-800: #93c5fd;
  --blue-900: #bfdbfe;
}

/* System preference dark mode (fallback when no manual theme set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    /* Text colors - inverted for dark mode */
    --color-text: #f9fafb;
    --color-text-secondary: #d1d5db;
    --color-text-muted: #9ca3af;
    --text-color: #f9fafb;
    --text-color-secondary: #d1d5db;

    /* Background colors */
    --color-bg: #111827;
    --color-bg-secondary: #1f2937;
    --color-bg-muted: #374151;

    /* Border colors */
    --color-border: #374151;
    --color-border-light: #4b5563;
    --color-border-dark: #6b7280;

    /* Surface numeric scale - inverted for dark mode */
    --surface-0: #0f172a;
    --surface-50: #1e293b;
    --surface-100: #334155;
    --surface-200: #475569;
    --surface-300: #64748b;
    --surface-400: #94a3b8;
    --surface-500: #cbd5e1;
    --surface-600: #e2e8f0;
    --surface-700: #f1f5f9;
    --surface-800: #f8fafc;
    --surface-900: #ffffff;
    --surface-950: #ffffff;

    /* Semantic surface tokens - CRITICAL for dark mode components */
    --surface-card: #1e293b;
    --surface-ground: #0f172a;
    --surface-section: #1e293b;
    --surface-hover: #334155;
    --surface-border: #475569;
    --surface-overlay: #1e293b;

    /* Gray scale - inverted for dark mode */
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-800: #f3f4f6;
    --gray-900: #f9fafb;

    /* Status colors - slightly adjusted for dark backgrounds */
    --green-50: #052e16;
    --green-100: #14532d;
    --green-800: #86efac;
    --green-900: #bbf7d0;

    --yellow-50: #422006;
    --yellow-100: #713f12;
    --yellow-800: #fde047;
    --yellow-900: #fef08a;

    --red-50: #450a0a;
    --red-100: #7f1d1d;
    --red-800: #fca5a5;
    --red-900: #fecaca;

    --blue-50: #1e3a8a;
    --blue-100: #1e40af;
    --blue-800: #93c5fd;
    --blue-900: #bfdbfe;
  }
}
