@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 47.4% 11.2%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 47.4% 11.2%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 100% 50%;
    --destructive-foreground: 210 40% 98%;
    --ring: 215 20.2% 65.1%;
    --radius: 0.5rem;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background font-sans text-foreground antialiased;
  }
}

#plasmo-shadow-container {
  all: initial;
  box-sizing: border-box;
}

/* Markdown 内容样式 */
.markdown-content {
  @apply text-sm leading-relaxed;
}

.markdown-content p {
  @apply mb-2 last:mb-0;
}

.markdown-content h1 {
  @apply text-base font-bold mb-2 mt-3 first:mt-0;
}

.markdown-content h2 {
  @apply text-sm font-bold mb-2 mt-3 first:mt-0;
}

.markdown-content h3 {
  @apply text-sm font-semibold mb-1 mt-2 first:mt-0;
}

.markdown-content ul {
  @apply list-disc list-inside mb-2 space-y-0.5 pl-2;
}

.markdown-content ol {
  @apply list-decimal list-inside mb-2 space-y-0.5 pl-2;
}

.markdown-content li {
  @apply text-sm leading-relaxed;
}

.markdown-content blockquote {
  @apply border-l-4 border-gray-400 pl-3 italic mb-2 text-gray-600 bg-gray-50 py-1 rounded-r;
}

.markdown-content code {
  @apply bg-gray-200 text-gray-800 px-1.5 py-0.5 rounded text-xs font-mono;
}

.markdown-content pre {
  @apply bg-gray-900 text-gray-100 border rounded-md p-3 mb-2 overflow-x-auto text-xs;
}

.markdown-content pre code {
  @apply bg-transparent text-gray-100 p-0 font-mono;
}

.markdown-content strong {
  @apply font-bold;
}

.markdown-content em {
  @apply italic;
}

.markdown-content a {
  @apply text-blue-600 hover:text-blue-800 underline;
}

.markdown-content table {
  @apply min-w-full border-collapse text-xs mb-2 border border-gray-300 rounded;
}

.markdown-content th {
  @apply border-b border-r border-gray-300 px-2 py-1.5 bg-gray-50 font-semibold text-left last:border-r-0;
}

.markdown-content td {
  @apply border-b border-r border-gray-300 px-2 py-1.5 last:border-r-0;
}

/* KaTeX 数学公式样式修复 */
.markdown-content .katex {
  font-size: 1em !important;
  line-height: 1.2 !important;
}

.markdown-content .katex-display {
  margin: 1em 0 !important;
  text-align: center !important;
}

.markdown-content .katex-display > .katex {
  display: inline-block !important;
  white-space: nowrap !important;
}

/* 修复行内数学公式的样式 */
.markdown-content .katex-inline {
  display: inline !important;
  vertical-align: baseline !important;
}

/* 确保数学公式不被 prose 样式影响 */
.markdown-content .katex * {
  font-family: 'KaTeX_Main', 'Times New Roman', serif !important;
}
