/**
 * RootReal Form Components - Design System
 * 
 * Core design tokens and variables for the form component library.
 * This file defines the foundational design system including colors,
 * typography, spacing, and other design tokens.
 */

:root {
  /* ============================================================================
   * Color Palette
   * ========================================================================== */
  
  /* Primary Colors */
  --rr-primary-50: #eff6ff;
  --rr-primary-100: #dbeafe;
  --rr-primary-200: #bfdbfe;
  --rr-primary-300: #93c5fd;
  --rr-primary-400: #60a5fa;
  --rr-primary-500: #3b82f6;
  --rr-primary-600: #2563eb;
  --rr-primary-700: #1d4ed8;
  --rr-primary-800: #1e40af;
  --rr-primary-900: #1e3a8a;

  /* Secondary Colors */
  --rr-secondary-50: #f8fafc;
  --rr-secondary-100: #f1f5f9;
  --rr-secondary-200: #e2e8f0;
  --rr-secondary-300: #cbd5e1;
  --rr-secondary-400: #94a3b8;
  --rr-secondary-500: #64748b;
  --rr-secondary-600: #475569;
  --rr-secondary-700: #334155;
  --rr-secondary-800: #1e293b;
  --rr-secondary-900: #0f172a;

  /* Semantic Colors */
  --rr-success-500: #22c55e;
  --rr-success-600: #16a34a;
  --rr-success-700: #15803d;
  
  --rr-warning-500: #f59e0b;
  --rr-warning-600: #d97706;
  --rr-warning-700: #b45309;
  
  --rr-danger-500: #ef4444;
  --rr-danger-600: #dc2626;
  --rr-danger-700: #b91c1c;
  
  --rr-info-500: #3b82f6;
  --rr-info-600: #2563eb;
  --rr-info-700: #1d4ed8;

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

  /* ============================================================================
   * Typography
   * ========================================================================== */
  
  --rr-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                    'Helvetica Neue', Arial, sans-serif;
  --rr-font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', 
                         Consolas, 'Courier New', monospace;

  /* Font Sizes */
  --rr-font-size-xs: 0.75rem;    /* 12px */
  --rr-font-size-sm: 0.875rem;   /* 14px */
  --rr-font-size-base: 1rem;     /* 16px */
  --rr-font-size-lg: 1.125rem;   /* 18px */
  --rr-font-size-xl: 1.25rem;    /* 20px */
  --rr-font-size-2xl: 1.5rem;    /* 24px */

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

  /* Line Heights */
  --rr-line-height-tight: 1.25;
  --rr-line-height-normal: 1.5;
  --rr-line-height-relaxed: 1.75;

  /* ============================================================================
   * Spacing
   * ========================================================================== */
  
  --rr-spacing-0: 0;
  --rr-spacing-1: 0.25rem;   /* 4px */
  --rr-spacing-2: 0.5rem;    /* 8px */
  --rr-spacing-3: 0.75rem;   /* 12px */
  --rr-spacing-4: 1rem;      /* 16px */
  --rr-spacing-5: 1.25rem;   /* 20px */
  --rr-spacing-6: 1.5rem;    /* 24px */
  --rr-spacing-8: 2rem;      /* 32px */
  --rr-spacing-10: 2.5rem;   /* 40px */
  --rr-spacing-12: 3rem;     /* 48px */

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

  /* ============================================================================
   * Shadows
   * ========================================================================== */
  
  --rr-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --rr-shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --rr-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --rr-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --rr-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --rr-shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  --rr-shadow-focus: 0 0 0 3px rgb(59 130 246 / 0.5);

  /* ============================================================================
   * Transitions
   * ========================================================================== */
  
  --rr-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --rr-transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --rr-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

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

  /* ============================================================================
   * Component-Specific Tokens
   * ========================================================================== */
  
  /* Input Components */
  --rr-input-height-sm: 2rem;      /* 32px */
  --rr-input-height-base: 2.5rem;  /* 40px */
  --rr-input-height-lg: 3rem;      /* 48px */
  
  --rr-input-padding-x-sm: 0.5rem;
  --rr-input-padding-x-base: 0.75rem;
  --rr-input-padding-x-lg: 1rem;
  
  --rr-input-padding-y-sm: 0.375rem;
  --rr-input-padding-y-base: 0.5rem;
  --rr-input-padding-y-lg: 0.625rem;

  /* Border Widths */
  --rr-border-width: 1px;
  --rr-border-width-2: 2px;
  --rr-border-width-4: 4px;

  /* Focus Ring */
  --rr-focus-ring-width: 2px;
  --rr-focus-ring-offset: 2px;
  --rr-focus-ring-color: var(--rr-primary-500);

  /* Disabled State */
  --rr-disabled-opacity: 0.5;
  --rr-disabled-cursor: not-allowed;
}

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

@media (prefers-color-scheme: dark) {
  :root {
    /* Invert color scales for dark mode */
    --rr-gray-50: #111827;
    --rr-gray-100: #1f2937;
    --rr-gray-200: #374151;
    --rr-gray-300: #4b5563;
    --rr-gray-400: #6b7280;
    --rr-gray-500: #9ca3af;
    --rr-gray-600: #d1d5db;
    --rr-gray-700: #e5e7eb;
    --rr-gray-800: #f3f4f6;
    --rr-gray-900: #f9fafb;

    /* Adjust shadows for dark mode */
    --rr-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --rr-shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --rr-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --rr-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --rr-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
  }
}

/* ============================================================================
 * Utility Classes
 * ========================================================================== */

.rr-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;
}

.rr-focus-visible:focus-visible {
  outline: var(--rr-focus-ring-width) solid var(--rr-focus-ring-color);
  outline-offset: var(--rr-focus-ring-offset);
}

.rr-disabled {
  opacity: var(--rr-disabled-opacity);
  cursor: var(--rr-disabled-cursor);
  pointer-events: none;
}

