/**
 * rnxJS Base Theme
 * CSS Custom Properties for theming
 */

:root {
  /* ========================================
     COLOR TOKENS
     ======================================== */

  /* Primary colors */
  --rnx-primary: #0d6efd;
  --rnx-primary-hover: #0b5ed7;
  --rnx-primary-active: #0a58ca;
  --rnx-primary-rgb: 13, 110, 253;

  /* Secondary colors */
  --rnx-secondary: #6c757d;
  --rnx-secondary-hover: #5c636a;
  --rnx-secondary-active: #565e64;

  /* Semantic colors */
  --rnx-success: #198754;
  --rnx-success-hover: #157347;
  --rnx-danger: #dc3545;
  --rnx-danger-hover: #bb2d3b;
  --rnx-warning: #ffc107;
  --rnx-warning-hover: #ffca2c;
  --rnx-info: #0dcaf0;
  --rnx-info-hover: #31d2f2;

  /* ========================================
     SURFACE COLORS
     ======================================== */

  --rnx-background: #ffffff;
  --rnx-surface: #f8f9fa;
  --rnx-surface-variant: #e9ecef;
  --rnx-surface-hover: #dee2e6;

  /* ========================================
     TEXT COLORS
     ======================================== */

  --rnx-text-primary: #212529;
  --rnx-text-secondary: #6c757d;
  --rnx-text-disabled: #adb5bd;
  --rnx-text-on-primary: #ffffff;
  --rnx-text-on-dark: #ffffff;

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

  --rnx-border-color: #dee2e6;
  --rnx-border-color-light: #e9ecef;
  --rnx-border-width: 1px;
  --rnx-border-radius: 0.375rem;
  --rnx-border-radius-sm: 0.25rem;
  --rnx-border-radius-lg: 0.5rem;
  --rnx-border-radius-pill: 50rem;

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

  --rnx-spacing-xs: 0.25rem;  /* 4px */
  --rnx-spacing-sm: 0.5rem;   /* 8px */
  --rnx-spacing-md: 1rem;     /* 16px */
  --rnx-spacing-lg: 1.5rem;   /* 24px */
  --rnx-spacing-xl: 3rem;     /* 48px */

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

  --rnx-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rnx-font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --rnx-font-size-xs: 0.75rem;   /* 12px */
  --rnx-font-size-sm: 0.875rem;  /* 14px */
  --rnx-font-size-base: 1rem;    /* 16px */
  --rnx-font-size-lg: 1.25rem;   /* 20px */
  --rnx-font-size-xl: 1.5rem;    /* 24px */

  --rnx-font-weight-normal: 400;
  --rnx-font-weight-medium: 500;
  --rnx-font-weight-bold: 700;

  --rnx-line-height-tight: 1.25;
  --rnx-line-height-base: 1.5;
  --rnx-line-height-relaxed: 1.75;

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

  --rnx-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --rnx-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --rnx-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --rnx-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

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

  --rnx-transition-fast: 150ms ease;
  --rnx-transition-normal: 300ms ease;
  --rnx-transition-slow: 500ms ease;

  /* ========================================
     Z-INDEX LAYERS
     ======================================== */

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

/* ========================================
   DARK MODE THEME
   ======================================== */

[data-theme="dark"],
[data-mode="dark"] {
  /* Surface colors */
  --rnx-background: #121212;
  --rnx-surface: #1e1e1e;
  --rnx-surface-variant: #2d2d2d;
  --rnx-surface-hover: #383838;

  /* Text colors */
  --rnx-text-primary: #ffffff;
  --rnx-text-secondary: #b0b0b0;
  --rnx-text-disabled: #6c6c6c;

  /* Border colors */
  --rnx-border-color: #404040;
  --rnx-border-color-light: #333333;

  /* Adjusted shadows for dark mode */
  --rnx-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --rnx-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --rnx-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --rnx-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);

  /* Slightly dimmer primary colors for better contrast */
  --rnx-primary: #3d8bfd;
  --rnx-primary-hover: #5a9eff;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.rnx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rnx-sr-only-focusable:focus,
.rnx-sr-only-focusable:active {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.rnx-skip-link {
  position: absolute;
  left: -10000px;
  top: 0;
  background: var(--rnx-text-primary);
  color: var(--rnx-background);
  padding: var(--rnx-spacing-sm) var(--rnx-spacing-md);
  text-decoration: none;
  z-index: var(--rnx-z-tooltip);
  border-radius: var(--rnx-border-radius);
}

.rnx-skip-link:focus {
  left: var(--rnx-spacing-md);
}

/* ========================================
   HIGH CONTRAST MODE SUPPORT
   ======================================== */

@media (prefers-contrast: high) {
  :root {
    --rnx-border-width: 2px;
    --rnx-shadow-sm: none;
    --rnx-shadow-md: none;
    --rnx-shadow-lg: none;
  }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  :root {
    --rnx-transition-fast: 0ms;
    --rnx-transition-normal: 0ms;
    --rnx-transition-slow: 0ms;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
