/**
 * Global CSS Variables - Shared Design Primitives
 * @version 1.0.0
 *
 * This file contains base design tokens shared across all apps in the monorepo.
 * It provides primitives (colors, spacing, typography) and basic semantic mappings.
 * Individual apps can override or extend these as needed.
 *
 * Usage:
 *   @import url('https://cloud.werdxz.info/shared/styles/variables.css');
 *
 *   Or for local development:
 *   @import url('../../shared/styles/variables.css');
 *
 *   .my-element {
 *     color: var(--color-text-primary);
 *     padding: var(--spacing-md);
 *   }
 *
 * Versioning: See shared/styles/README.md for version history and semver policy
 * Last updated: 2025-10-23
 */

:root {
  /* ========================================
     Color Primitives
     ======================================== */

  /* Base colors - raw palette */
  --blue: #1677ff;
  --blue-light: #4096ff;
  --blue-dark: #0958d9;

  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-400: #a3a3a3;
  --gray-600: #525252;
  --gray-800: #262626;
  --gray-900: #171717;

  --green: #52c41a;
  --red: #ff4d4f;
  --yellow: #faad14;
  --orange: #fa8c16;
  --purple: #8b5cf6;

  /* ========================================
     Base Semantic Colors
     Common mappings that most apps will use.
     Apps can override these in their own CSS.
     ======================================== */

  --color-bg-primary: #ffffff;
  --color-bg-secondary: var(--gray-50);

  --color-text-primary: var(--gray-900);
  --color-text-secondary: var(--gray-600);
  --color-text-tertiary: var(--gray-400);
  --color-text-link: var(--blue);
  --color-text-link-hover: var(--blue-dark);

  --color-border-default: var(--gray-200);
  --color-border-subtle: var(--gray-200);

  /* Status/State colors for badges, alerts, etc. */
  --color-status-success: var(--green);
  --color-status-info: var(--blue);
  --color-status-warning: var(--orange);
  --color-status-error: var(--red);
  --color-status-neutral: var(--gray-400);
  --color-status-purple: var(--purple);

  /* ========================================
     Typography - Font Families
     ======================================== */

  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  --font-family-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  --font-family-serif: 'Georgia', 'Times New Roman', 'Times', serif;

  /* ========================================
     Typography - Font Sizes
     ======================================== */

  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-md: 1.125rem;     /* 18px */
  --font-size-lg: 1.25rem;      /* 20px */
  --font-size-xl: 1.5rem;       /* 24px */
  --font-size-2xl: 1.875rem;    /* 30px */
  --font-size-3xl: 2.25rem;     /* 36px */
  --font-size-4xl: 3rem;        /* 48px */
  --font-size-5xl: 3.75rem;     /* 60px */

  /* Heading sizes */
  --font-size-h1: var(--font-size-4xl);
  --font-size-h2: var(--font-size-3xl);
  --font-size-h3: var(--font-size-2xl);
  --font-size-h4: var(--font-size-xl);
  --font-size-h5: var(--font-size-lg);
  --font-size-h6: var(--font-size-base);

  /* ========================================
     Typography - Font Weights
     ======================================== */

  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* ========================================
     Typography - Line Heights
     ======================================== */

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;

  /* ========================================
     Spacing Scale
     ======================================== */

  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */
  --spacing-3xl: 4rem;     /* 64px */
  --spacing-4xl: 6rem;     /* 96px */
  --spacing-5xl: 8rem;     /* 128px */

  /* ========================================
     Responsive Breakpoints
     ======================================== */

  --breakpoint-xs: 480px;
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  /* ========================================
     Border Radius
     ======================================== */

  --radius-none: 0;
  --radius-sm: 0.125rem;    /* 2px */
  --radius-base: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;    /* 6px */
  --radius-lg: 0.5rem;      /* 8px */
  --radius-xl: 0.75rem;     /* 12px */
  --radius-2xl: 1rem;       /* 16px */
  --radius-full: 9999px;

  /* ========================================
     Shadows
     ======================================== */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --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);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* ========================================
     Z-Index Scale
     ======================================== */

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

  /* ========================================
     Transitions
     ======================================== */

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Dark Mode Support
   ======================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-primary: var(--gray-900);
    --color-bg-secondary: var(--gray-800);

    --color-text-primary: var(--gray-50);
    --color-text-secondary: var(--gray-400);
    --color-text-tertiary: var(--gray-600);
    --color-text-link: var(--blue-light);
    --color-text-link-hover: var(--blue);

    --color-border-default: var(--gray-600);
    --color-border-subtle: var(--gray-800);
  }
}
