@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');
@import "tailwindcss";

:root {
  /* Background Layers */
  --bg-base: #0a0a0a;      /* Main background */
  --bg-elevated: #111111;   /* Cards, panels */
  --bg-surface: #161616;    /* Subtle elevation */
  --bg-highlight: #1a1a1a;  /* Interactive states */

  /* Legacy Terminal Colors (mapped to new system) */
  --bg-primary: var(--bg-base);
  --bg-secondary: var(--bg-elevated);
  --bg-tertiary: var(--bg-highlight);

  /* Border Hierarchy */
  --border-subtle: #1a1a1a;   /* Section dividers */
  --border-default: #2a2a2a;  /* Default borders */
  --border-strong: #3a3a3a;   /* Focus states */

  /* Legacy border color (mapped) */
  --border-color: var(--border-default);

  /* Text Hierarchy */
  --text-primary: #e0e0e0;    /* Primary content */
  --text-secondary: #a0a0a0;  /* Secondary content */
  --text-tertiary: #666666;   /* Labels, hints */

  /* Legacy text colors (mapped) */
  --text-muted: var(--text-tertiary);

  /* Semantic Colors */
  --semantic-positive: #00d26a;  /* Bullish, gains */
  --semantic-negative: #ff4757;  /* Bearish, losses */
  --semantic-neutral: #888888;   /* Neutral, unknown */
  --semantic-info: #58a6ff;      /* Links, info */
  --semantic-warning: #ffb000;   /* Warnings, attention */

  /* Legacy accent colors (mapped) */
  --accent-green: var(--semantic-positive);
  --accent-red: var(--semantic-negative);
  --accent-blue: var(--semantic-info);

  /* Typography Scale */
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;

  /* Display */
  --text-display-2xl: 36px; /* text-4xl */
  --text-display-xl: 30px;  /* text-3xl */

  /* Spacing System */
  --section-vertical-lg: 6rem;
  --section-vertical-md: 4rem;
  --section-vertical-sm: 2rem;

  --element-gap-lg: 1.5rem;
  --element-gap-md: 1rem;
  --element-gap-sm: 0.5rem;

  --padding-none: 0;
  --padding-sm: 0.5rem;
  --padding-md: 1rem;
  --padding-lg: 1.5rem;

  /* Research mode */
  --research-bg: #0b1016;
  --research-surface: #0f141b;
  --research-panel: #121923;
  --research-grid: rgba(98, 123, 153, 0.12);
  --research-accent-thesis: #8ab9f7;
  --research-accent-risk: #ff8f9e;
  --research-accent-catalyst: #7fe2b5;
  --research-accent-evidence: #7fc0ff;
  --research-accent-ghost: #d2b6ff;
  --research-text-strong: #eef4ff;
  --research-text-muted: #98aec6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root[data-density='compact'] {
  --padding-md: 0.75rem;
  --padding-lg: 1rem;
}

:root[data-density='detailed'] {
  --padding-md: 1.125rem;
  --padding-lg: 1.75rem;
}

#root {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a3a;
}

/* Utility Classes */
.font-mono {
  font-family: var(--font-mono);
}

.animate-in {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Delay classes for staggered animations */
.delay-75 {
  animation-delay: 75ms;
}

.delay-150 {
  animation-delay: 150ms;
}

.delay-200 {
  animation-delay: 200ms;
}

/* Line clamp for text truncation */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Selection color */
::selection {
  background-color: var(--accent-blue);
  color: var(--bg-primary);
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Tab animations */
.tab-transition {
  transition: all 0.15s ease-in-out;
}

.research-shell {
  background-image:
    linear-gradient(to right, transparent 0, transparent calc(100% - 1px), var(--research-grid) calc(100% - 1px)),
    linear-gradient(to bottom, transparent 0, transparent calc(100% - 1px), var(--research-grid) calc(100% - 1px));
  background-size: 24px 24px;
}

/* Custom width for sidebar (Tailwind w-70 equivalent) */
.w-70 {
  width: 17.5rem; /* 280px */
}

/* Typography Scale Utility Classes */
.text-display-2xl {
  font-size: var(--text-display-2xl);
  font-weight: 700;
  line-height: 1;
}

.text-display-xl {
  font-size: var(--text-display-xl);
  font-weight: 700;
  line-height: 1;
}

.text-heading-lg {
  font-size: 1.125rem; /* 18px */
  font-weight: 600;
  line-height: 1.4;
}

.text-heading-md {
  font-size: 1rem; /* 16px */
  font-weight: 500;
  line-height: 1.5;
}

.text-heading-sm {
  font-size: 0.875rem; /* 14px */
  font-weight: 500;
  line-height: 1.5;
}

.text-label-xs {
  font-size: 0.625rem; /* 10px */
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.text-label-sm {
  font-size: 0.75rem; /* 12px */
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.text-body-sm {
  font-size: 0.875rem; /* 14px */
  line-height: 1.75;
  font-weight: 400;
}

.text-body-xs {
  font-size: 0.75rem; /* 12px */
  line-height: 1.6;
  font-weight: 400;
}

/* Spacing Utility Classes */
.space-y-section-lg > * + * {
  margin-top: var(--section-vertical-lg);
}

.space-y-section-md > * + * {
  margin-top: var(--section-vertical-md);
}

.space-y-section-sm > * + * {
  margin-top: var(--section-vertical-sm);
}
