@import 'tailwindcss';

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

@theme {
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-background: var(--background);
  --color-foreground: var(--foreground);

  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);

  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);

  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);

  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);

  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);

  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);

  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);

  --color-sidebar: var(--sidebar-background);
  --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);

  --radius-lg: var(--radius);
  --radius-md: calc(var(--radius) - 2px);
  --radius-sm: calc(var(--radius) - 4px);

  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;
  --animate-fade-in: jsonjoy-fade-in 0.3s ease-out;
  --animate-fade-out: jsonjoy-fade-out 0.3s ease-out;
  --animate-scale-in: jsonjoy-scale-in 0.2s ease-out;
  --animate-scale-out: jsonjoy-scale-out 0.2s ease-out;
  --animate-float: jsonjoy-float 3s ease-in-out infinite;
  --animate-pulse-subtle: pulse-subtle 3s ease-in-out infinite;
  --animate-enter:
    jsonjoy-fade-in 0.4s ease-out, jsonjoy-scale-in 0.3s ease-out;
  --animate-exit:
    jsonjoy-fade-out 0.3s ease-out, jsonjoy-scale-out 0.2s ease-out;

  --font-sans: var(--font-sans), system-ui, sans-serif;

  --transition-property-height: height;
  --transition-property-spacing: margin, padding;

  --ease-bounce-in: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  @keyframes jsonjoy-fade-in {
    0% {
      opacity: 0;
      transform: translateY(10px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
  @keyframes jsonjoy-fade-out {
    0% {
      opacity: 1;
      transform: translateY(0);
    }
    100% {
      opacity: 0;
      transform: translateY(10px);
    }
  }
  @keyframes jsonjoy-scale-in {
    0% {
      transform: scale(0.95);
      opacity: 0;
    }
    100% {
      transform: scale(1);
      opacity: 1;
    }
  }
  @keyframes jsonjoy-scale-out {
    from {
      transform: scale(1);
      opacity: 1;
    }
    to {
      transform: scale(0.95);
      opacity: 0;
    }
  }
  @keyframes jsonjoy-float {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-5px);
    }
  }
}

@utility container {
  margin-inline: auto;
  padding-inline: 2rem;
  @media (width >= --theme(--breakpoint-sm)) {
    max-width: none;
  }
  @media (width >= 1400px) {
    max-width: 1400px;
  }
}

/*
  The default border color has changed to `currentcolor` in Tailwind CSS v4,
  so we've added these compatibility styles to make sure everything still
  looks the same as it did with Tailwind CSS v3.

  If we ever want to remove these styles, we need to add an explicit border
  color utility to any element that depends on these defaults.
*/
@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentcolor);
  }
}

@utility json-field-row {
  @apply flex items-center gap-2 py-2 px-3 rounded-md hover:bg-secondary/50 transition-colors;
}

@utility json-field-label {
  @apply text-sm font-medium text-foreground/80;
}

@utility json-editor-container {
  @apply bg-white backdrop-blur-md rounded-xl border border-border shadow-xs;
}

@utility glass-panel {
  @apply bg-white/90 backdrop-blur-md rounded-xl border border-border shadow-xs;
}

@utility animate-in {
  @apply animate-enter;
}

@utility animate-out {
  @apply animate-exit;
}

@utility field-button {
  @apply flex items-center gap-1.5 px-2 py-1 rounded-md text-xs font-medium bg-secondary hover:bg-secondary/80 text-secondary-foreground transition-colors;
}

@utility hover-action {
  @apply opacity-0 group-hover:opacity-100 transition-opacity;
}

@utility monaco-editor-container {
  @apply w-full h-full;

  & > div {
    @apply h-full;
  }
}

@utility monaco-editor {
  @apply h-full;
}

@layer base {
  .jsonjoy {
    --background: hsl(210 40% 98%);
    --foreground: hsl(222.2 84% 4.9%);

    --card: hsl(0 0% 100%);
    --card-foreground: hsl(222.2 84% 4.9%);

    --popover: hsl(0 0% 100%);
    --popover-foreground: hsl(222.2 84% 4.9%);

    --primary: hsl(210 100% 50%);
    --primary-foreground: hsl(210 40% 98%);

    --secondary: hsl(210 40% 96.1%);
    --secondary-foreground: hsl(222.2 47.4% 11.2%);

    --muted: hsl(210 40% 96.1%);
    --muted-foreground: hsl(215.4 16.3% 46.9%);

    --accent: hsl(210 40% 96.1%);
    --accent-foreground: hsl(222.2 47.4% 11.2%);

    --destructive: hsl(0 84.2% 60.2%);
    --destructive-foreground: hsl(210 40% 98%);

    --border: hsl(214.3 31.8% 91.4%);
    --input: hsl(214.3 31.8% 91.4%);
    --ring: hsl(222.2 84% 4.9%);

    --radius: 0.8rem;

    --font-sans:
      'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
      'Helvetica Neue', Arial, sans-serif;
  }

  .jsonjoy.dark {
    --background: hsl(222.2 84% 4.9%);
    --foreground: hsl(210 40% 98%);

    --card: hsl(222.2 84% 4.9%);
    --card-foreground: hsl(210 40% 98%);

    --popover: hsl(222.2 84% 4.9%);
    --popover-foreground: hsl(210 40% 98%);

    --primary: hsl(210 100% 65%);
    --primary-foreground: hsl(222.2 47.4% 11.2%);

    --secondary: hsl(217.2 32.6% 17.5%);
    --secondary-foreground: hsl(210 40% 98%);

    --muted: hsl(217.2 32.6% 17.5%);
    --muted-foreground: hsl(215 20.2% 65.1%);

    --accent: hsl(217.2 32.6% 17.5%);
    --accent-foreground: hsl(210 40% 98%);

    --destructive: hsl(0 62.8% 30.6%);
    --destructive-foreground: hsl(210 40% 98%);

    --border: hsl(217.2 32.6% 17.5%);
    --input: hsl(217.2 32.6% 17.5%);
    --ring: hsl(212.7 26.8% 83.9%);
  }
}

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

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

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    @apply font-medium tracking-tight;
  }

  input,
  textarea,
  select {
    @apply focus-visible:outline-hidden;
  }
}
