@import "@fontsource/inter/latin-400.css";
@import "@fontsource/inter/latin-500.css";
@import "@fontsource/inter/latin-600.css";
@import "@fontsource/inter/latin-700.css";
@import "@fontsource/inter/latin-800.css";

/*
  This package intentionally does NOT ship a Tailwind utilities bundle.
  The consuming app should generate utilities by scanning this package’s
  compiled JS output.

  Scope: design tokens + base layer + scrollbar utilities only.
  Component-level overrides (e.g. legacy PrimeReact `p-*`, Quill `ql-*`)
  and hand-rolled animation classes have been removed — animation
  utilities come from `tw-animate-css`. Re-add specifics on demand.
*/

@source "./src/**/*.{js,ts,jsx,tsx}";
@source "./dist/**/*.js";

@import "tw-animate-css";
@import "react-day-picker/style.css";

/* ---------------------------------------------------------------- */
/* Base element defaults                                            */
/* ---------------------------------------------------------------- */

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(
    [type="file"]
  ),
textarea,
select,
[data-slot="input"],
[data-slot="textarea"],
[role="combobox"][aria-expanded] {
  border-radius: 4px;
}

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family:
    var(--font-inter),
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Roboto",
    "Oxygen",
    "Ubuntu",
    "Cantarell",
    "Fira Sans",
    "Droid Sans",
    "Helvetica Neue",
    sans-serif;
}

@media (min-width: 768px) {
  .taskboard-wizard-communication-card:has(
      [data-testid="taskboard-wizard-agent-chat-tab"][aria-selected="true"]
    ) {
    align-self: stretch;
    height: 100%;
    max-height: 100%;
  }
}

/* ---------------------------------------------------------------- */
/* Design tokens                                                   */
/* ---------------------------------------------------------------- */

@theme {
  --font-inter: "Inter";

  /* Highlight colors */
  --color-highlight-100: hsl(270 60% 48%);
  --color-highlight-100-hover: hsl(270 60% 40%);
  --color-highlight-30: hsl(270 85% 90%);
  --color-highlight-10: hsl(270 58% 97%);

  /* Secondary highlight colors */
  --color-highlight-secondary-100: hsl(206 97% 56%);
  --color-highlight-secondary-30: hsl(206 97% 87%);
  --color-highlight-secondary-10: hsl(206 97% 96%);

  /* Neutral colors */
  --color-neutral-grey-100: hsl(0 0% 7%);
  --color-neutral-grey-50: hsl(0 0% 54%);
  --color-neutral-grey-15: hsl(0 0% 86%);
  --color-neutral-grey-10: hsl(0 0% 91%);
  --color-neutral-grey-5: hsl(0 0% 96%);
  --color-white: hsl(0 0% 100%);
  --color-border-default: var(--color-neutral-grey-10);

  /* Feedback colors */
  --color-feedback-green: hsl(157 66% 37%);
  --color-feedback-green-light: hsl(154 70% 92%);
  --color-feedback-orange: hsl(41 100% 29%);
  --color-feedback-orange-light: hsl(41 100% 89%);
  --color-feedback-blue: hsl(225 62.6% 37%);
  --color-feedback-blue-light: hsl(226 61% 92%);
  --color-feedback-red: hsl(9 58% 41%);
  --color-feedback-red-light: hsl(6 74% 92%);
  /* More saturated red for destructive (delete) actions and critical tasks */
  --color-feedback-red-strong: hsl(6 76% 45%);
  --color-feedback-grey: hsl(0 0% 28%);
  --color-feedback-grey-light: hsl(0 0% 96%);

  /* Component colors */
  --color-component-default: hsl(206 97.3% 55.7%);
  --color-component-default-drop-zone: hsl(207 97.8% 82.4%);
  --color-component-shared: hsl(27 96% 61%);
  --color-component-shared-drop-zone: hsl(27 95% 84.3%);
  --color-component-layout: hsl(270 95.2% 75.3%);
  --color-component-layout-drop-zone: hsl(270 96% 90.2%);
  --color-component-readonly: hsl(218 10.6% 64.9%);
  --color-component-readonly-drop-zone: hsl(218 11.1% 85.9%);
  --color-component-nonmovable: hsl(0 90.6% 70.8%);
  --color-component-nonmovable-drop-zone: hsl(0 90% 88.2%);
  --color-component-suggestions: hsl(172 66% 50.4%);
  --color-component-suggestions-drop-zone: hsl(172 66.3% 80.2%);

  /* Badge sizing */
  --radius-badge: 4px;
  --badge-padding-y: 4px;
  --badge-padding-x: 8px;
  --badge-padding-sm-y: 2px;
  --badge-padding-sm-x: 4px;

  /* Type scale — text-2xs is the canonical 11px badge/small label size */
  --text-2xs: 11px;
  --text-3xs: 0.6rem;

  /* Animations (only those referenced in source; accordion/fade/zoom/slide
     utilities come from tw-animate-css) */
  --animate-fadeIn: "fadeIn 0.5s ease-in-out";
  --animate-fadeLeft: "fadeLeft 0.8s ease-in-out";
  --animate-fadeRight: "fadeRight 0.8s ease-in-out";

  @keyframes fadeIn {
    "0%": {
      opacity: 0;
    }
    "100%": {
      opacity: 1;
    }
  }
  @keyframes fadeLeft {
    "0%": {
      transform: translateX(-50%);
      opacity: 0;
    }
    "100%": {
      transform: translateX(0);
      opacity: 1;
    }
  }
  @keyframes fadeRight {
    "0%": {
      transform: translateX(50%);
      opacity: 0;
    }
    "100%": {
      transform: translateX(0);
      opacity: 1;
    }
  }
}

@utility badge-pad {
  padding-block: var(--badge-padding-y);
  padding-inline: var(--badge-padding-x);
}

@utility badge-pad-sm {
  padding-block: var(--badge-padding-sm-y);
  padding-inline: var(--badge-padding-sm-x);
}

/* ---------------------------------------------------------------- */
/* Theme variables (shadcn)                                        */
/* ---------------------------------------------------------------- */

:root {
  --background: var(--color-white);
  --foreground: var(--color-neutral-grey-100);
  --card: var(--color-white);
  --card-foreground: var(--color-neutral-grey-100);
  --popover: var(--color-white);
  --popover-foreground: var(--color-neutral-grey-100);
  --primary: var(--color-highlight-100);
  --primary-foreground: var(--color-white);
  --secondary: var(--color-neutral-grey-5);
  --secondary-foreground: var(--color-neutral-grey-100);
  --muted: var(--color-neutral-grey-5);
  --muted-foreground: var(--color-neutral-grey-50);
  --accent: var(--color-neutral-grey-5);
  --accent-foreground: var(--color-neutral-grey-100);
  --destructive: var(--color-feedback-red-strong);
  --destructive-foreground: var(--color-white);
  --border: var(--color-border-default);
  --input: var(--color-border-default);
  --ring: var(--color-neutral-grey-50);
  --chart-1: var(--color-component-default);
  --chart-2: var(--color-component-suggestions);
  --chart-3: var(--color-component-shared);
  --chart-4: var(--color-feedback-green);
  --chart-5: var(--color-feedback-orange);
  --radius: 0.625rem;
  --sidebar: var(--color-white);
  --sidebar-foreground: var(--color-neutral-grey-100);
  --sidebar-primary: var(--color-highlight-100);
  --sidebar-primary-foreground: var(--color-white);
  --sidebar-accent: var(--color-neutral-grey-5);
  --sidebar-accent-foreground: var(--color-neutral-grey-100);
  --sidebar-border: var(--color-border-default);
  --sidebar-ring: var(--color-neutral-grey-50);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.145 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.145 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.985 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.396 0.141 25.723);
  --destructive-foreground: oklch(0.637 0.237 25.331);
  --border: oklch(0.269 0 0);
  --input: oklch(0.269 0 0);
  --ring: oklch(0.439 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(0.269 0 0);
  --sidebar-ring: oklch(0.439 0 0);
}

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

/* ---------------------------------------------------------------- */
/* Utilities & base layer                                          */
/* ---------------------------------------------------------------- */

@layer utilities {
  /* Hide scrollbars while keeping scroll functionality */
  .scrollbar-hide {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
  }
  .scrollbar-hide::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
}

/* Alpha for the saved-field tick, registered so it can animate. Fading this
   (rather than the bar's width) makes the tick disappear in place — its size
   and position never change, so nothing slides across the field. */
@property --saved-bar-alpha {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

@layer components {
  .agent-greeting-message {
    font-size: 24px;
    line-height: 1.15;
  }

  .agent-greeting-message :where(h1, h2, h3, h4, h5, h6, p) {
    margin: 0;
    color: inherit;
    font: inherit;
    line-height: inherit;
  }

  .agent-terminal-height-expand-from-greeting {
    animation: agent-terminal-height-expand-from-greeting 560ms
      cubic-bezier(0.22, 1, 0.36, 1) both;
    overflow: hidden;
  }

  @keyframes agent-terminal-height-expand-from-greeting {
    from {
      max-height: var(--agent-terminal-expand-from-height, 0px);
    }
    to {
      max-height: var(--agent-terminal-expand-to-height, 100%);
    }
  }

  .parhelia-drop-zone-overlay-enter {
    animation: parhelia-drop-zone-overlay-enter 110ms ease-out both;
  }

  .parhelia-drop-zone-overlay-exit {
    animation: parhelia-drop-zone-overlay-exit 120ms ease-in forwards;
  }

  .parhelia-drop-zone-label-animate {
    animation: parhelia-drop-zone-label-in 140ms ease-out both;
  }

  .parhelia-drop-zone-y-fade {
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      black 24%,
      black 76%,
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      black 24%,
      black 76%,
      transparent 100%
    );
  }

  .parhelia-drop-zone-arrow-animate {
    --drop-zone-arrow-x: 0px;
    --drop-zone-arrow-y: 2px;
    animation: parhelia-drop-zone-arrow-nudge 0.75s ease-in-out infinite;
    will-change: transform;
  }

  .parhelia-drop-zone-arrow-animate[data-drop-anchor="top"] {
    --drop-zone-arrow-y: -2px;
  }

  .parhelia-drop-zone-arrow-animate[data-drop-anchor="bottom"] {
    --drop-zone-arrow-y: 2px;
  }

  .parhelia-drop-zone-arrow-animate[data-drop-anchor="left"] {
    --drop-zone-arrow-x: -2px;
    --drop-zone-arrow-y: 0px;
  }

  .parhelia-drop-zone-arrow-animate[data-drop-anchor="right"] {
    --drop-zone-arrow-x: 2px;
    --drop-zone-arrow-y: 0px;
  }

  @keyframes parhelia-drop-zone-overlay-enter {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes parhelia-drop-zone-overlay-exit {
    from {
      opacity: 1;
    }
    to {
      opacity: 0;
    }
  }

  @keyframes parhelia-drop-zone-label-in {
    from {
      opacity: 0;
      filter: blur(1px);
    }
    to {
      opacity: 1;
      filter: blur(0);
    }
  }

  @keyframes parhelia-drop-zone-arrow-nudge {
    0%,
    100% {
      transform: translate3d(0, 0, 0);
    }
    50% {
      transform: translate3d(
        var(--drop-zone-arrow-x),
        var(--drop-zone-arrow-y),
        0
      );
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .agent-terminal-height-expand-from-greeting,
    .parhelia-drop-zone-overlay-enter,
    .parhelia-drop-zone-overlay-exit,
    .parhelia-drop-zone-label-animate,
    .parhelia-drop-zone-arrow-animate {
      animation: none;
    }
  }

  /* The 2px bar lives at the RIGHT edge, but it's painted by the gradient
     itself (a hard colour-stop in the last 2px) rather than by
     background-position. background-position therefore stays at its initial
     value, so a `transition` on the field can never animate it from left to
     right when the bar appears — the bar shows in place, no sweep. */
  .edited-field.saved,
  .edited-field.saving {
    border-radius: 2px;
    background-repeat: no-repeat;
  }

  .edited-field.saved {
    --saved-bar: color-mix(
      in srgb,
      var(--color-feedback-green) calc(var(--saved-bar-alpha) * 100%),
      transparent
    );
    background-image: linear-gradient(
      to right,
      transparent calc(100% - 2px),
      var(--saved-bar) calc(100% - 2px)
    );
    animation: field-saved-fade 1.8s ease-out forwards;
  }

  .edited-field.saving {
    background-image: linear-gradient(
      to right,
      transparent calc(100% - 2px),
      var(--color-feedback-orange) calc(100% - 2px)
    );
  }

  .focused-field.saved .focus-shadow,
  .focused-field.saving .focus-shadow,
  [data-fieldname] > .saved .focus-shadow,
  [data-fieldname] > .saving .focus-shadow {
    background-repeat: no-repeat;
  }

  .focused-field.saved .focus-shadow,
  [data-fieldname] > .saved .focus-shadow {
    --saved-bar: color-mix(
      in srgb,
      var(--color-feedback-green) calc(var(--saved-bar-alpha) * 100%),
      transparent
    );
    background-image: linear-gradient(
      to right,
      transparent calc(100% - 2px),
      var(--saved-bar) calc(100% - 2px)
    );
    animation: field-saved-fade 1.8s ease-out forwards;
  }

  .focused-field.saving .focus-shadow,
  [data-fieldname] > .saving .focus-shadow {
    background-image: linear-gradient(
      to right,
      transparent calc(100% - 2px),
      var(--color-feedback-orange) calc(100% - 2px)
    );
  }

  /* Hold the green tick briefly so the save registers, then fade its colour
     to transparent in place. Width (2px) and position (right edge) are fixed,
     so the bar never moves. */
  @keyframes field-saved-fade {
    0%,
    40% {
      --saved-bar-alpha: 1;
    }
    100% {
      --saved-bar-alpha: 0;
    }
  }
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  ::selection {
    background: Highlight;
    color: HighlightText;
  }
  ::-moz-selection {
    background: Highlight;
    color: HighlightText;
  }
  body {
    @apply bg-background text-foreground;
  }
  button {
    cursor: pointer;
  }
}
