@import "tailwindcss";

/* Register theme tokens with Tailwind so utility classes work */
@theme {
  --color-background: var(--background);
  --color-background-subtle: var(--background-subtle);
  --color-surface: var(--surface);
  --color-surface-variant: var(--surface-variant);
  --color-surface-subtle: var(--surface-subtle);
  --color-border: var(--border);
  --color-border-focus: var(--border-focus);
  --color-border-disabled: var(--border-disabled);
  --color-foreground: var(--foreground);
  --color-foreground-muted: var(--foreground-muted);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-primary-muted: var(--primary-muted);
  --color-accent: var(--accent);

  /* Semantic status colors */
  --color-success: var(--success);
  --color-warning: var(--warning);
  --color-error: var(--error);
  --color-info: var(--info);

  /* Visualization pointer colors */
  --color-viz-pointer-left: var(--viz-pointer-left);
  --color-viz-pointer-right: var(--viz-pointer-right);
  --color-viz-pointer-mid: var(--viz-pointer-mid);
  --color-viz-pointer-default: var(--viz-pointer-default);
  --color-viz-success: var(--viz-success);
  --color-viz-compare: var(--viz-compare);
  --color-viz-highlight: var(--viz-highlight);

  --font-sans: var(--font-inter);
  --font-mono: var(--font-jetbrains-mono);
}

:root {
  --background: #ffffff;
  --background-subtle: #f5f5f5;
  --foreground: #171717;
  --foreground-muted: #5a5a5a;
  --surface: #ffffff;
  --surface-variant: #f5f5f5;
  --surface-subtle: #fafafa;
  --card: #ffffff;
  --card-foreground: #171717;
  --primary: #3b82f6;
  --primary-foreground: #ffffff;
  --primary-hover: #2563eb;
  --primary-muted: #dbeafe;
  --secondary: #f3f4f6;
  --secondary-foreground: #171717;
  --muted: #f3f4f6;
  --muted-foreground: #5f6368;
  --accent: #0891b2;
  --border: #e5e7eb;
  --border-focus: var(--primary);
  --border-disabled: #d4d4d4;
  --ring: #3b82f6;

  /* Semantic status colors */
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --info: #2563eb;

  /* Difficulty colors */
  --difficulty-easy: #16a34a;
  --difficulty-easy-bg: #dcfce7;
  --difficulty-medium: #ca8a04;
  --difficulty-medium-bg: #fef9c3;
  --difficulty-hard: #dc2626;
  --difficulty-hard-bg: #fee2e2;

  /* Callout colors - Warning (orange/red) */
  --callout-warning-bg: #fff7ed;
  --callout-warning-border: #f97316;
  --callout-warning-fg: #9a3412;

  /* Callout colors - Success (green) */
  --callout-success-bg: #f0fdf4;
  --callout-success-border: #22c55e;
  --callout-success-fg: #166534;

  /* Callout colors - Info (blue) */
  --callout-info-bg: #eff6ff;
  --callout-info-border: #3b82f6;
  --callout-info-fg: #1e40af;

  /* Callout colors - Insight (purple) */
  --callout-insight-bg: #faf5ff;
  --callout-insight-border: #a855f7;
  --callout-insight-fg: #6b21a8;

  /* Approach boxes */
  --approach-wrong-bg: #fef2f2;
  --approach-wrong-border: #fecaca;
  --approach-wrong-fg: #dc2626;
  --approach-correct-bg: #f0fdf4;
  --approach-correct-border: #bbf7d0;
  --approach-correct-fg: #16a34a;

  /* Badge colors - Category (teal) */
  --badge-category: #0d9488;
  --badge-category-bg: #ccfbf1;

  /* Badge colors - Pattern (indigo) */
  --badge-pattern: #4f46e5;
  --badge-pattern-bg: #e0e7ff;

  /* Badge colors - Optimal (green) */
  --badge-optimal: #16a34a;
  --badge-optimal-bg: #dcfce7;

  /* Visualization colors */
  --viz-default: #f3f4f6;
  --viz-active: #3b82f6;
  --viz-comparing: #f59e0b;
  --viz-found: #22c55e;
  --viz-visited: #9ca3af;
  --viz-swapping: #8b5cf6;
  --viz-transition: 300ms;

  /* Visualization pointer colors */
  --viz-pointer-left: #2563eb;
  --viz-pointer-right: #ea580c;
  --viz-pointer-mid: #9333ea;
  --viz-pointer-default: #4b5563;
  --viz-success: #16a34a;
  --viz-compare: #eab308;
  --viz-highlight: #4f46e5;
  --viz-dimmed-opacity: 0.3;

  /* Visualization timing */
  --viz-duration-fast: 200ms;
  --viz-duration-normal: 400ms;
  --viz-duration-slow: 600ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --background-subtle: #121212;
    --foreground: #e5e5e5;
    --foreground-muted: #b0b0b0;
    --surface: #141414;
    --surface-variant: #1e1e1e;
    --surface-subtle: #0f0f0f;
    --card: #171717;
    --card-foreground: #ededed;
    --primary: #6366f1;
    --primary-foreground: #ffffff;
    --primary-hover: #818cf8;
    --primary-muted: #1e1b4b;
    --secondary: #262626;
    --secondary-foreground: #ededed;
    --muted: #262626;
    --muted-foreground: #a3a3a3;
    --accent: #22d3ee;
    --border: #262626;
    --border-focus: var(--primary);
    --border-disabled: #404040;
    --ring: #3b82f6;

    /* Semantic status colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Difficulty colors (dark mode) */
    --difficulty-easy: #4ade80;
    --difficulty-easy-bg: rgba(34, 197, 94, 0.2);
    --difficulty-medium: #facc15;
    --difficulty-medium-bg: rgba(234, 179, 8, 0.2);
    --difficulty-hard: #f87171;
    --difficulty-hard-bg: rgba(239, 68, 68, 0.2);

    /* Callout colors - Warning (dark mode) */
    --callout-warning-bg: rgba(249, 115, 22, 0.15);
    --callout-warning-border: #f97316;
    --callout-warning-fg: #fdba74;

    /* Callout colors - Success (dark mode) */
    --callout-success-bg: rgba(34, 197, 94, 0.15);
    --callout-success-border: #22c55e;
    --callout-success-fg: #86efac;

    /* Callout colors - Info (dark mode) */
    --callout-info-bg: rgba(59, 130, 246, 0.15);
    --callout-info-border: #3b82f6;
    --callout-info-fg: #93c5fd;

    /* Callout colors - Insight (dark mode) */
    --callout-insight-bg: rgba(168, 85, 247, 0.15);
    --callout-insight-border: #a855f7;
    --callout-insight-fg: #d8b4fe;

    /* Approach boxes (dark mode) */
    --approach-wrong-bg: rgba(220, 38, 38, 0.15);
    --approach-wrong-border: rgba(220, 38, 38, 0.4);
    --approach-wrong-fg: #f87171;
    --approach-correct-bg: rgba(22, 163, 74, 0.15);
    --approach-correct-border: rgba(22, 163, 74, 0.4);
    --approach-correct-fg: #4ade80;

    /* Badge colors - Category (teal, dark mode) */
    --badge-category: #2dd4bf;
    --badge-category-bg: rgba(20, 184, 166, 0.2);

    /* Badge colors - Pattern (indigo, dark mode) */
    --badge-pattern: #a5b4fc;
    --badge-pattern-bg: rgba(99, 102, 241, 0.2);

    /* Badge colors - Optimal (green, dark mode) */
    --badge-optimal: #4ade80;
    --badge-optimal-bg: rgba(34, 197, 94, 0.2);

    /* Visualization colors (dark mode) */
    --viz-default: #374151;
    --viz-active: #3b82f6;
    --viz-comparing: #f59e0b;
    --viz-found: #22c55e;
    --viz-visited: #6b7280;
    --viz-swapping: #8b5cf6;

    /* Visualization pointer colors (dark mode) */
    --viz-pointer-left: #3b82f6;
    --viz-pointer-right: #f97316;
    --viz-pointer-mid: #a855f7;
    --viz-pointer-default: #6b7280;
    --viz-success: #22c55e;
    --viz-compare: #fbbf24;
    --viz-highlight: #6366f1;
    --viz-dimmed-opacity: 0.3;

    /* Visualization timing */
    --viz-duration-fast: 200ms;
    --viz-duration-normal: 400ms;
    --viz-duration-slow: 600ms;
  }
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Improved line-height for prose content */
.prose-content {
  line-height: 1.7;
}

/* Visualization element transitions */
.viz-element {
  transition:
    background-color var(--viz-transition) ease,
    transform var(--viz-transition) ease,
    opacity var(--viz-transition) ease;
}

.viz-cell-bg {
  transition:
    fill var(--viz-transition) ease;
}

.viz-value {
  transition:
    fill var(--viz-transition) ease;
}

.viz-pointer {
  transition:
    transform var(--viz-transition) ease;
}
