@import "tailwindcss";
@plugin "@tailwindcss/typography";
@import "tw-animate-css";
@import "shadcn/tailwind.css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif;
  --font-mono: var(--font-geist-mono);
  --font-heading: var(--font-sans);
  --text-xs: 0.8125rem;
  --text-xs--line-height: 1.25rem;
  --text-sm: 0.9375rem;
  --text-sm--line-height: 1.45rem;
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}

:root {
  --background: #FFFFFF;
  --foreground: #15171C;
  --card: #FFFFFF;
  --card-foreground: #15171C;
  --popover: #FFFFFF;
  --popover-foreground: #15171C;
  --primary: #4277FB;
  --primary-foreground: #FFFFFF;
  --secondary: #ECEEF3;
  --secondary-foreground: #15171C;
  --muted: #F1F3F5;
  --muted-foreground: #6B7280;
  --accent: #ECEEF3;
  --accent-foreground: #15171C;
  --destructive: oklch(0.577 0.245 27.325);
  --border: #E6E8EC;
  --input: #DCDFE4;
  --ring: #4277FB;
  --chart-1: oklch(0.87 0 0);
  --chart-2: oklch(0.556 0 0);
  --chart-3: oklch(0.439 0 0);
  --chart-4: oklch(0.371 0 0);
  --chart-5: oklch(0.269 0 0);
  --radius: 0.625rem;
  --sidebar: #F7F8FA;
  --sidebar-foreground: #4B5563;
  --sidebar-primary: #4277FB;
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: #ECEEF3;
  --sidebar-accent-foreground: #15171C;
  --sidebar-border: #E6E8EC;
  --sidebar-ring: #4277FB;
  /* highlight.js syntax tokens (GitHub Light palette). Recessed onto --muted so
     code blocks read as a distinct surface on the white page. */
  --hljs-bg: var(--muted);
  --hljs-fg: #24292e;
  --hljs-keyword: #d73a49;
  --hljs-entity: #6f42c1;
  --hljs-constant: #005cc5;
  --hljs-string: #032f62;
  --hljs-variable: #e36209;
  --hljs-comment: #6a737d;
  --hljs-entity-tag: #22863a;
  --hljs-section: #005cc5;
  --hljs-bullet: #735c0f;
  --hljs-addition-fg: #22863a;
  --hljs-addition-bg: #f0fff4;
  --hljs-deletion-fg: #b31d28;
  --hljs-deletion-bg: #ffeef0;
}

.dark {
  --background: oklch(0.17 0 0);
  --foreground: oklch(0.97 0 0);
  --card: oklch(0.225 0 0);
  --card-foreground: oklch(0.965 0 0);
  --popover: oklch(0.225 0 0);
  --popover-foreground: oklch(0.965 0 0);
  --primary: oklch(0.94 0 0);
  --primary-foreground: oklch(0.18 0 0);
  --secondary: oklch(0.32 0 0);
  --secondary-foreground: oklch(0.96 0 0);
  --muted: oklch(0.31 0 0);
  --muted-foreground: oklch(0.82 0 0);
  --accent: oklch(0.34 0 0);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 18%);
  --input: oklch(1 0 0 / 24%);
  --ring: oklch(0.535 0.143 261);
  --chart-1: oklch(0.87 0 0);
  --chart-2: oklch(0.556 0 0);
  --chart-3: oklch(0.439 0 0);
  --chart-4: oklch(0.371 0 0);
  --chart-5: oklch(0.269 0 0);
  --sidebar: #0A0A0C;
  --sidebar-foreground: #B6B6BC;
  --sidebar-primary: #4277FB;
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: #1C1C22;
  --sidebar-accent-foreground: #FFFFFF;
  --sidebar-border: #1C1C1E;
  --sidebar-ring: oklch(0.78 0 0);
  /* highlight.js syntax tokens (GitHub Dark palette). */
  --hljs-bg: #0d1117;
  --hljs-fg: #c9d1d9;
  --hljs-keyword: #ff7b72;
  --hljs-entity: #d2a8ff;
  --hljs-constant: #79c0ff;
  --hljs-string: #a5d6ff;
  --hljs-variable: #ffa657;
  --hljs-comment: #8b949e;
  --hljs-entity-tag: #7ee787;
  --hljs-section: #1f6feb;
  --hljs-bullet: #f2cc60;
  --hljs-addition-fg: #aff5b4;
  --hljs-addition-bg: #033a16;
  --hljs-deletion-fg: #ffdcd7;
  --hljs-deletion-bg: #67060c;
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
    font-size: 15px;
    font-weight: 450;
    font-synthesis-weight: none;
    text-rendering: optimizeLegibility;
  }
  html {
    @apply font-sans;
  }
}

/* Respect the OS "reduce motion" setting globally: neutralize transitions,
   animations, and smooth scrolling for users who opt out of motion. Component
   code can still layer `motion-reduce:` variants for finer control. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.chat-markdown {
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.chat-markdown > :first-child { margin-top: 0; }
.chat-markdown > :last-child { margin-bottom: 0; }
.chat-markdown p { margin: 0.375rem 0; }
.chat-markdown pre { margin: 0.5rem 0; padding: 0.625rem 0.75rem; border-radius: 0.5rem; overflow-x: auto; font-size: 12px; }
.chat-markdown code:not(pre code) { padding: 0.05rem 0.3rem; border-radius: 0.25rem; font-size: 0.9em; background: var(--color-muted); }
.chat-markdown ul, .chat-markdown ol { margin: 0.375rem 0; padding-left: 1.25rem; }
.chat-markdown li { margin: 0.125rem 0; }
.chat-markdown h1, .chat-markdown h2, .chat-markdown h3 { margin: 0.5rem 0 0.25rem; font-weight: 600; }
.chat-markdown a { text-decoration: underline; text-underline-offset: 2px; }
.chat-markdown blockquote { margin: 0.5rem 0; padding-left: 0.75rem; border-left: 2px solid var(--color-border); color: var(--color-muted-foreground); }
.chat-markdown table { border-collapse: collapse; margin: 0.5rem 0; }
.chat-markdown th, .chat-markdown td { border: 1px solid var(--color-border); padding: 0.25rem 0.5rem; }

/* Theme-aware syntax highlighting. Replaces the unconditional github-dark
   stylesheet with variable-driven rules so fenced code blocks follow the
   active theme instead of always rendering dark. Token roles and colors
   mirror GitHub's prettylights palette (see --hljs-* in :root / .dark). */
.hljs { color: var(--hljs-fg); background: var(--hljs-bg); }
pre code.hljs { display: block; overflow-x: auto; padding: 1em; }
code.hljs { padding: 3px 5px; }
.hljs-doctag, .hljs-keyword, .hljs-meta .hljs-keyword, .hljs-template-tag,
.hljs-template-variable, .hljs-type, .hljs-variable.language_ { color: var(--hljs-keyword); }
.hljs-title, .hljs-title.class_, .hljs-title.class_.inherited__, .hljs-title.function_ { color: var(--hljs-entity); }
.hljs-attr, .hljs-attribute, .hljs-literal, .hljs-meta, .hljs-number, .hljs-operator,
.hljs-variable, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-id { color: var(--hljs-constant); }
.hljs-regexp, .hljs-string, .hljs-meta .hljs-string { color: var(--hljs-string); }
.hljs-built_in, .hljs-symbol { color: var(--hljs-variable); }
.hljs-comment, .hljs-code, .hljs-formula { color: var(--hljs-comment); }
.hljs-name, .hljs-quote, .hljs-selector-tag, .hljs-selector-pseudo { color: var(--hljs-entity-tag); }
.hljs-subst { color: var(--hljs-fg); }
.hljs-section { color: var(--hljs-section); font-weight: bold; }
.hljs-bullet { color: var(--hljs-bullet); }
.hljs-emphasis { color: var(--hljs-fg); font-style: italic; }
.hljs-strong { color: var(--hljs-fg); font-weight: bold; }
.hljs-addition { color: var(--hljs-addition-fg); background-color: var(--hljs-addition-bg); }
.hljs-deletion { color: var(--hljs-deletion-fg); background-color: var(--hljs-deletion-bg); }

/* Inline doc panel: bump heading sizes so sections stand out in the slide-over
   (the flat chat sizing reads as undifferentiated for a docs page). */
.doc-panel .chat-markdown h1 { font-size: 1.1rem; }
.doc-panel .chat-markdown h2 { font-size: 1rem; }
.doc-panel .chat-markdown h3 { font-size: 0.95rem; }

/* Streaming cursor */
.chat-markdown .streaming-cursor::after {
  content: "▉";
  display: inline;
  animation: cursor-blink 1s step-end infinite;
  font-weight: 100;
  margin-left: 1px;
  opacity: 0.85;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Live status dot — used on Tasks list rows where status indicates the task
   is still in flight (queued/running/waiting_approval). The dual-layer pulse
   gives a soft halo without depending on Tailwind's generic animate-pulse,
   which fades the whole element rather than emitting a ring. */
.gini-live-dot {
  position: relative;
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}
.gini-live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.6;
  animation: gini-live-pulse 1.6s ease-out infinite;
}
@keyframes gini-live-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  80% { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}
