@import "tailwindcss";
@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:
    "Inter Variable",
    "SF Pro Display",
    ui-sans-serif,
    system-ui,
    sans-serif;
  --font-mono:
    "JetBrains Mono Variable",
    "SFMono-Regular",
    ui-monospace,
    monospace;
  --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-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) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

:root {
  --radius: 1.125rem;
  --background: oklch(0.985 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0 / 86%);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.145 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.955 0 0);
  --secondary-foreground: oklch(0.145 0 0);
  --muted: oklch(0.963 0 0);
  --muted-foreground: oklch(0.45 0 0);
  --accent: oklch(0.945 0 0);
  --accent-foreground: oklch(0.145 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.89 0 0);
  --input: oklch(0.9 0 0);
  --ring: oklch(0.33 0 0);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.145 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.955 0 0);
  --sidebar-accent-foreground: oklch(0.145 0 0);
  --sidebar-border: oklch(0.89 0 0);
  --sidebar-ring: oklch(0.33 0 0);
  --selection: oklch(0.145 0 0);
  --selection-foreground: oklch(0.985 0 0);
  --status-success: oklch(0.65 0.12 154);
  --status-warning: oklch(0.74 0.14 74);
  --status-danger: oklch(0.65 0.17 25);
}

.dark {
  --background: oklch(0.11 0 0);
  --foreground: oklch(0.97 0 0);
  --card: oklch(0.145 0 0 / 88%);
  --card-foreground: oklch(0.97 0 0);
  --popover: oklch(0.15 0 0);
  --popover-foreground: oklch(0.97 0 0);
  --primary: oklch(0.97 0 0);
  --primary-foreground: oklch(0.145 0 0);
  --secondary: oklch(0.18 0 0);
  --secondary-foreground: oklch(0.97 0 0);
  --muted: oklch(0.18 0 0);
  --muted-foreground: oklch(0.72 0 0);
  --accent: oklch(0.21 0 0);
  --accent-foreground: oklch(0.97 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 12%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.82 0 0);
  --sidebar: oklch(0.14 0 0);
  --sidebar-foreground: oklch(0.97 0 0);
  --sidebar-primary: oklch(0.97 0 0);
  --sidebar-primary-foreground: oklch(0.145 0 0);
  --sidebar-accent: oklch(0.18 0 0);
  --sidebar-accent-foreground: oklch(0.97 0 0);
  --sidebar-border: oklch(1 0 0 / 12%);
  --sidebar-ring: oklch(0.82 0 0);
  --selection: oklch(0.97 0 0);
  --selection-foreground: oklch(0.145 0 0);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  html {
    height: 100%;
    margin: 0;
    scroll-behavior: smooth;
  }

  body {
    @apply bg-background text-foreground;
    margin: 0;
    min-height: 100vh;
    background-image:
      radial-gradient(circle at top left, rgba(0, 0, 0, 0.05), transparent 24%),
      linear-gradient(135deg, rgba(0, 0, 0, 0.02), transparent 55%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 45%);
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
  }

  #root {
    min-height: 100%;
  }

  .dark body {
    background-image:
      radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 20%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 50%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 35%);
  }

  ::selection {
    background-color: var(--selection);
    color: var(--selection-foreground);
  }
}

.mermaid-shell {
  --mermaid-selection-fill: color-mix(in oklab, var(--foreground) 9%, transparent);
  --mermaid-selection-shadow: 0 24px 72px rgba(0, 0, 0, 0.12);
  --mermaid-tooltip-bg: color-mix(in oklab, var(--card) 96%, white 4%);
}

.dark .mermaid-shell {
  --mermaid-selection-fill: color-mix(in oklab, var(--foreground) 8%, transparent);
  --mermaid-selection-shadow: 0 30px 84px rgba(0, 0, 0, 0.46);
  --mermaid-tooltip-bg: color-mix(in oklab, var(--card) 92%, black 8%);
}

.mermaid-wrapper {
  cursor: grab;
  user-select: none;
  background-image:
    radial-gradient(circle at top left, color-mix(in oklab, var(--foreground) 5%, transparent), transparent 28%),
    linear-gradient(180deg, color-mix(in oklab, var(--background) 78%, transparent) 0%, transparent 100%);
}

.mermaid-wrapper svg {
  max-width: none !important;
  max-height: none !important;
  overflow: visible;
}

.mermaid-class-diagram {
  overflow: visible;
}

.mermaid-class-diagram .edgeLabel .label span {
  box-shadow: none;
}

.mermaid-class-diagram .members-group .mermaid-member-stack {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  gap: 4px;
  line-height: 1;
}

.mermaid-class-diagram .members-group .mermaid-member-stack p {
  margin: 0;
}

.mermaid-class-diagram .members-group .mermaid-member-type {
  color: color-mix(in oklab, var(--foreground) 55%, transparent);
  display: inline;
  font-size: 6.8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.mermaid-class-diagram .members-group .mermaid-member-name {
  color: var(--foreground);
  display: inline;
  font-size: 8.4px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.mermaid-class-diagram .members-group .mermaid-member-default {
  color: color-mix(in oklab, var(--foreground) 48%, transparent);
  display: block;
  font-size: 6.8px;
  font-style: italic;
  letter-spacing: 0.02em;
  padding-left: 8px;
}

.mermaid-highlight {
  fill: var(--foreground) !important;
  font-weight: 700 !important;
}

.mermaid-selected rect,
.mermaid-selected circle,
.mermaid-selected ellipse,
.mermaid-selected path,
.mermaid-selected polygon,
.selected-node rect,
.selected-node circle,
.selected-node ellipse,
.selected-node path,
.selected-node polygon {
  stroke: var(--foreground) !important;
  stroke-width: 2.2px !important;
  fill: var(--mermaid-selection-fill) !important;
}

.mermaidTooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 80;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--mermaid-tooltip-bg);
  box-shadow: 0 24px 64px -36px rgba(0, 0, 0, 0.45);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  max-width: min(28rem, calc(100vw - 2rem));
  pointer-events: none;
  padding: 0.55rem 0.7rem;
  text-transform: uppercase;
  white-space: normal;
  backdrop-filter: blur(18px);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
