@import "tailwindcss";

@plugin "tailwindcss-animate";

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

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  --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-foreground: var(--destructive-foreground);
  --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 {
  --background: oklch(1 0 0);
  --foreground: oklch(0.147 0.004 49.25);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.147 0.004 49.25);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.147 0.004 49.25);
  --primary: #e02020; /* Auntie PDF Red */
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.995 0.0084 48.98);
  --secondary-foreground: oklch(0.156 0.0063 73.05);
  --muted: oklch(0.993 0.0024 58.61);
  --muted-foreground: oklch(0.448 0.0056 64.77);
  --accent: oklch(0.993 0.0024 58.61);
  --accent-foreground: oklch(0.156 0.0063 73.05);
  --destructive: oklch(0.694 0.154 29.33);
  --destructive-foreground: oklch(1 0 0);
  --border: oklch(0.882 0.0206 62.5);
  --input: oklch(0.882 0.0206 62.5);
  --ring: oklch(0.147 0.004 49.25);
  --chart-1: oklch(0.691 0.266 209.39);
  --chart-2: oklch(0.598 0.177 51.22);
  --chart-3: oklch(0.53 0.138 99.25);
  --chart-4: oklch(0.613 0.188 254.41);
  --chart-5: oklch(0.65 0.283 147.27);
  --radius: 0.5rem;
  --sidebar: oklch(0.99 0.004 31.98);
  --sidebar-foreground: oklch(0.387 0.032 291.14);
  --sidebar-primary: oklch(0.692 0.176 314.07);
  --sidebar-primary-foreground: oklch(1 0.003 12.39);
  --sidebar-accent: oklch(0.97 0.011 288.97);
  --sidebar-accent-foreground: oklch(0.387 0.032 291.14);
  --sidebar-border: oklch(0.925 0.007 295.2);
  --sidebar-ring: oklch(0.692 0.176 314.07);
}

.dark {
  --background: oklch(0.147 0.004 49.25);
  --foreground: oklch(0.985 0.001 106.423);
  --card: oklch(0.147 0.004 49.25);
  --card-foreground: oklch(0.985 0.001 106.423);
  --popover: oklch(0.147 0.004 49.25);
  --popover-foreground: oklch(0.985 0.001 106.423);
  --primary: oklch(0.985 0.001 106.423);
  --primary-foreground: oklch(0.216 0.006 56.043);
  --secondary: oklch(0.268 0.007 34.298);
  --secondary-foreground: oklch(0.985 0.001 106.423);
  --muted: oklch(0.268 0.007 34.298);
  --muted-foreground: oklch(0.709 0.01 56.259);
  --accent: oklch(0.268 0.007 34.298);
  --accent-foreground: oklch(0.985 0.001 106.423);
  --destructive: oklch(0.396 0.141 25.723);
  --destructive-foreground: oklch(0.637 0.237 25.331);
  --border: oklch(0.268 0.007 34.298);
  --input: oklch(0.268 0.007 34.298);
  --ring: oklch(0.553 0.013 58.071);
  --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.216 0.006 56.043);
  --sidebar-foreground: oklch(0.985 0.001 106.423);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0.001 106.423);
  --sidebar-accent: oklch(0.268 0.007 34.298);
  --sidebar-accent-foreground: oklch(0.985 0.001 106.423);
  --sidebar-border: oklch(0.268 0.007 34.298);
  --sidebar-ring: oklch(0.553 0.013 58.071);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}

/* Add styling for markdown content */
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin: 1rem 0;
}

.prose h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.prose h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

.prose p {
  margin: 0.75rem 0;
}

.prose ul, .prose ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.prose li {
  margin: 0.25rem 0;
}

.prose code {
  font-family: monospace;
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

.prose pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.75rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.prose th, .prose td {
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  text-align: left;
}

.prose th {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Add KaTeX math formula styling */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
  max-width: 100%;
}

.katex {
  display: inline-block;
  max-width: 100%;
}

.katex-html {
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

/* Ensure math blocks fit within their containers */
.math {
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
  padding: 1rem 0;
}

/* Add a subtle scrollbar indicator for math overflow */
.prose .math::-webkit-scrollbar {
  height: 4px;
}

.prose .math::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.prose .math::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.prose .math::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}