@import "tailwindcss";

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

@theme {
  --color-background: hsl(var(--background));
  --color-foreground: hsl(var(--foreground));
  --color-card: hsl(var(--card));
  --color-card-foreground: hsl(var(--card-foreground));
  --color-popover: hsl(var(--popover));
  --color-popover-foreground: hsl(var(--popover-foreground));
  --color-primary: hsl(var(--primary));
  --color-primary-foreground: hsl(var(--primary-foreground));
  --color-secondary: hsl(var(--secondary));
  --color-secondary-foreground: hsl(var(--secondary-foreground));
  --color-muted: hsl(var(--muted));
  --color-muted-foreground: hsl(var(--muted-foreground));
  --color-accent: hsl(var(--accent));
  --color-accent-foreground: hsl(var(--accent-foreground));
  --color-destructive: hsl(var(--destructive));
  --color-destructive-foreground: hsl(var(--destructive-foreground));
  --color-border: hsl(var(--border));
  --color-input: hsl(var(--input));
  --color-ring: hsl(var(--ring));
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 3.9%;
    --primary: 45 93% 47%;
    --primary-foreground: 0 0% 2%;
    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;
    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;
    --accent: 0 0% 96.1%;
    --accent-foreground: 0 0% 9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 89.8%;
    --input: 0 0% 89.8%;
    --ring: 45 93% 47%;
    --radius: 0.5rem;
  }

  .dark {
    --background: 240 6% 6%;
    --foreground: 0 0% 95%;
    --card: 240 5% 8%;
    --card-foreground: 0 0% 95%;
    --popover: 240 5% 8%;
    --popover-foreground: 0 0% 95%;
    --primary: 45 93% 47%;
    --primary-foreground: 0 0% 2%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 50.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 45 93% 47%;

    /* Agent graph node status colors */
    --node-running: 45 95% 58%;
    --node-looping: 38 90% 55%;
    --node-complete: 43 70% 45%;
    --node-pending: 35 15% 28%;
    --node-pending-bg: 35 10% 12%;
    --node-pending-border: 35 10% 20%;
    --node-error: 0 65% 55%;

    /* Agent graph trigger node colors */
    --trigger-bg: 210 25% 14%;
    --trigger-border: 210 30% 30%;
    --trigger-text: 210 30% 65%;
    --trigger-icon: 210 40% 55%;

    /* Draft graph chrome colors */
    --draft-edge: 220 10% 30%;
    --draft-edge-arrow: 220 10% 35%;
    --draft-edge-label: 220 10% 45%;
    --draft-back-edge: 220 10% 25%;
    --draft-group-fill: 220 15% 18%;
    --draft-group-stroke: 220 10% 40%;
    --draft-chrome-text: 220 10% 50%;
    --draft-chrome-text-dim: 220 10% 55%;
    --draft-node-text: 0 0% 78%;
    --draft-node-text-hover: 0 0% 92%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
  }

  button {
    cursor: pointer;
  }

  textarea {
    padding: 0;
    margin: 0;
  }
}

* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover,
*:active {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Webkit (Chrome/Safari/Edge) — thin overlay track */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

*:hover::-webkit-scrollbar-thumb,
*:active::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Light mode adjustments */
:root:not(.dark) *:hover,
:root:not(.dark) *:active {
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

:root:not(.dark) *:hover::-webkit-scrollbar-thumb,
:root:not(.dark) *:active::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

:root:not(.dark) *::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}

/* Keep scrollbar-hide for elements that truly need no scrollbar (e.g. tab bars) */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Pulse ring animation for SVG elements */
@keyframes pulse-ring {
  0% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.05); }
  100% { opacity: 0.25; transform: scale(1); }
}

/* Slide-in animation */
@keyframes slide-in-from-right {
  from { transform: translateX(10px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.animate-in.slide-in-from-right {
  animation: slide-in-from-right 0.2s ease-out;
}

/* Slide-up animation for question widget */
@keyframes slide-in-from-bottom {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.animate-in.slide-in-from-bottom {
  animation: slide-in-from-bottom 0.25s ease-out;
}
