
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');

@import "tailwindcss";

@import "tw-animate-css";

@import "shadcn-vue/tailwind.css";

@custom-variant dark (&:is(.dark *));
@source "../src/**/*.vue";

/* ============================================
   Global base styles and app themes
   ============================================ */

:root,
:root[data-theme="warm"],
:root[data-theme="system"] {
  color-scheme: light;
  --app-bg: #faf9f6;
  --app-text: #38342e;
  --app-text-strong: #2d2a26;
  --app-text-soft: #5c574e;
  --app-muted: #8c877d;
  --app-subtle: #b8b3a8;
  --app-border: #e8e4da;
  --app-border-strong: #e0dbcf;
  --app-sidebar-bg: #f4f1eb;
  --app-panel-bg: #faf9f6;
  --app-surface: #fffdfa;
  --app-surface-muted: #f4f1ea;
  --app-hover: #ede8dd;
  --app-active-bg: #fdf0e5;
  --app-accent: #bf6a3b;
  --app-accent-muted: #d6aa8e;
  --app-accent-strong: #9f4f28;
  --app-link: #7a55d9;
  --app-link-hover: #6342bd;
  --app-control: #8c6be8;
  --app-control-hover: #7a55d9;
  --app-control-contrast: #ffffff;
  --app-selection: #e8d5b0;
  --app-overlay: rgba(56, 52, 46, 0.22);
  --app-toast-bg: rgba(56, 52, 46, 0.8);
  --app-shadow: rgba(56, 52, 46, 0.16);
  --code-background: #f4f1ea;
  --code-foreground: #38342e;
  --code-border: #e0dbcf;
  --code-token-comment: #8c877d;
  --code-token-constant: #8c4f2b;
  --code-token-keyword: #7651a8;
  --code-token-parameter: #9f4f28;
  --code-token-function: #315f78;
  --code-token-string: #6f641f;
  --code-token-string-expression: #6f641f;
  --code-token-punctuation: #6e685f;
  --code-token-link: #6342bd;
  --code-token-inserted: #3d7a4d;
  --code-token-deleted: #b34242;
  --code-token-changed: #9a691f;
}

:root[data-theme="white"] {
  color-scheme: light;
  --app-bg: #ffffff;
  --app-text: #202124;
  --app-text-strong: #111315;
  --app-text-soft: #4f5660;
  --app-muted: #767d86;
  --app-subtle: #a4aab2;
  --app-border: #e8eaed;
  --app-border-strong: #d7dbe0;
  --app-sidebar-bg: #f7f8fa;
  --app-panel-bg: #ffffff;
  --app-surface: #ffffff;
  --app-surface-muted: #f4f6f8;
  --app-hover: #eef1f4;
  --app-active-bg: #e9f1ff;
  --app-accent: #2563eb;
  --app-accent-muted: #93b4f8;
  --app-accent-strong: #1d4ed8;
  --app-link: #2563eb;
  --app-link-hover: #1e40af;
  --app-control: #2563eb;
  --app-control-hover: #1d4ed8;
  --app-control-contrast: #ffffff;
  --app-selection: #bfdbfe;
  --app-overlay: rgba(17, 24, 39, 0.2);
  --app-toast-bg: rgba(17, 24, 39, 0.82);
  --app-shadow: rgba(17, 24, 39, 0.15);
  --code-background: #f4f6f8;
  --code-foreground: #24292f;
  --code-border: #d7dbe0;
  --code-token-comment: #6e7781;
  --code-token-constant: #953800;
  --code-token-keyword: #8250df;
  --code-token-parameter: #953800;
  --code-token-function: #0550ae;
  --code-token-string: #0a3069;
  --code-token-string-expression: #0a3069;
  --code-token-punctuation: #57606a;
  --code-token-link: #0969da;
  --code-token-inserted: #1a7f37;
  --code-token-deleted: #cf222e;
  --code-token-changed: #9a6700;
}

:root[data-theme="gray"] {
  color-scheme: light;
  --app-bg: #f3f4f6;
  --app-text: #2f3337;
  --app-text-strong: #1f2328;
  --app-text-soft: #555b62;
  --app-muted: #737a82;
  --app-subtle: #a3a9b0;
  --app-border: #dde1e6;
  --app-border-strong: #cfd5dc;
  --app-sidebar-bg: #e9ecef;
  --app-panel-bg: #f3f4f6;
  --app-surface: #ffffff;
  --app-surface-muted: #eceff2;
  --app-hover: #dfe3e8;
  --app-active-bg: #e5ecf5;
  --app-accent: #4f6f93;
  --app-accent-muted: #8aa1ba;
  --app-accent-strong: #3b5674;
  --app-link: #4f6f93;
  --app-link-hover: #334e68;
  --app-control: #4f6f93;
  --app-control-hover: #3b5674;
  --app-control-contrast: #ffffff;
  --app-selection: #cbd5e1;
  --app-overlay: rgba(31, 35, 40, 0.24);
  --app-toast-bg: rgba(31, 35, 40, 0.82);
  --app-shadow: rgba(31, 35, 40, 0.14);
  --code-background: #eceff2;
  --code-foreground: #2f3337;
  --code-border: #cfd5dc;
  --code-token-comment: #737a82;
  --code-token-constant: #8b572a;
  --code-token-keyword: #7c5c99;
  --code-token-parameter: #8b572a;
  --code-token-function: #3b668c;
  --code-token-string: #537238;
  --code-token-string-expression: #537238;
  --code-token-punctuation: #656c74;
  --code-token-link: #3b668c;
  --code-token-inserted: #4e7a52;
  --code-token-deleted: #a94a4a;
  --code-token-changed: #8b6b2f;
}

:root[data-theme="black"] {
  color-scheme: dark;
  --app-bg: #101113;
  --app-text: #e7e9ed;
  --app-text-strong: #f6f7f9;
  --app-text-soft: #c8ccd2;
  --app-muted: #9aa1aa;
  --app-subtle: #6f7782;
  --app-border: #2b2f35;
  --app-border-strong: #383d45;
  --app-sidebar-bg: #17191d;
  --app-panel-bg: #101113;
  --app-surface: #1b1e23;
  --app-surface-muted: #242830;
  --app-hover: #242830;
  --app-active-bg: #253049;
  --app-accent: #8ab4ff;
  --app-accent-muted: #5d7fac;
  --app-accent-strong: #bdd4ff;
  --app-link: #9dbdff;
  --app-link-hover: #c6d8ff;
  --app-control: #7c9cff;
  --app-control-hover: #9db8ff;
  --app-control-contrast: #101113;
  --app-selection: #30415f;
  --app-overlay: rgba(0, 0, 0, 0.48);
  --app-toast-bg: rgba(0, 0, 0, 0.82);
  --app-shadow: rgba(0, 0, 0, 0.36);
  --code-background: #1b1e23;
  --code-foreground: #e7e9ed;
  --code-border: #383d45;
  --code-token-comment: #8b949e;
  --code-token-constant: #ffa657;
  --code-token-keyword: #ff7b72;
  --code-token-parameter: #ffa657;
  --code-token-function: #d2a8ff;
  --code-token-string: #a5d6ff;
  --code-token-string-expression: #a5d6ff;
  --code-token-punctuation: #b1bac4;
  --code-token-link: #79c0ff;
  --code-token-inserted: #7ee787;
  --code-token-deleted: #ff7b72;
  --code-token-changed: #e3b341;
}

:root[data-theme="gruvbox"] {
  color-scheme: dark;
  --app-bg: #282828;
  --app-text: #ebdbb2;
  --app-text-strong: #fbf1c7;
  --app-text-soft: #d5c4a1;
  --app-muted: #bdae93;
  --app-subtle: #928374;
  --app-border: #3c3836;
  --app-border-strong: #504945;
  --app-sidebar-bg: #32302f;
  --app-panel-bg: #282828;
  --app-surface: #1d2021;
  --app-surface-muted: #3c3836;
  --app-hover: #3c3836;
  --app-active-bg: #4a3627;
  --app-accent: #fe8019;
  --app-accent-muted: #d79921;
  --app-accent-strong: #fabd2f;
  --app-link: #83a598;
  --app-link-hover: #8ec07c;
  --app-control: #d65d0e;
  --app-control-hover: #fe8019;
  --app-control-contrast: #1d2021;
  --app-selection: #665c54;
  --app-overlay: rgba(29, 32, 33, 0.52);
  --app-toast-bg: rgba(29, 32, 33, 0.9);
  --app-shadow: rgba(0, 0, 0, 0.38);
  --code-background: #1d2021;
  --code-foreground: #ebdbb2;
  --code-border: #504945;
  --code-token-comment: #928374;
  --code-token-constant: #d3869b;
  --code-token-keyword: #fb4934;
  --code-token-parameter: #fe8019;
  --code-token-function: #fabd2f;
  --code-token-string: #b8bb26;
  --code-token-string-expression: #b8bb26;
  --code-token-punctuation: #bdae93;
  --code-token-link: #83a598;
  --code-token-inserted: #b8bb26;
  --code-token-deleted: #fb4934;
  --code-token-changed: #fabd2f;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --app-bg: #101113;
    --app-text: #e7e9ed;
    --app-text-strong: #f6f7f9;
    --app-text-soft: #c8ccd2;
    --app-muted: #9aa1aa;
    --app-subtle: #6f7782;
    --app-border: #2b2f35;
    --app-border-strong: #383d45;
    --app-sidebar-bg: #17191d;
    --app-panel-bg: #101113;
    --app-surface: #1b1e23;
    --app-surface-muted: #242830;
    --app-hover: #242830;
    --app-active-bg: #253049;
    --app-accent: #8ab4ff;
    --app-accent-muted: #5d7fac;
    --app-accent-strong: #bdd4ff;
    --app-link: #9dbdff;
    --app-link-hover: #c6d8ff;
    --app-control: #7c9cff;
    --app-control-hover: #9db8ff;
    --app-control-contrast: #101113;
    --app-selection: #30415f;
    --app-overlay: rgba(0, 0, 0, 0.48);
    --app-toast-bg: rgba(0, 0, 0, 0.82);
    --app-shadow: rgba(0, 0, 0, 0.36);
    --code-background: #1b1e23;
    --code-foreground: #e7e9ed;
    --code-border: #383d45;
    --code-token-comment: #8b949e;
    --code-token-constant: #ffa657;
    --code-token-keyword: #ff7b72;
    --code-token-parameter: #ffa657;
    --code-token-function: #d2a8ff;
    --code-token-string: #a5d6ff;
    --code-token-string-expression: #a5d6ff;
    --code-token-punctuation: #b1bac4;
    --code-token-link: #79c0ff;
    --code-token-inserted: #7ee787;
    --code-token-deleted: #ff7b72;
    --code-token-changed: #e3b341;
  }
}

html {
  /* ── Font stack: refined system serif for Chinese + English ── */
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
}

/* ── Selection ── */
::selection {
  background: var(--app-selection);
  color: var(--app-text);
}

/* ============================================
   Scrollbar — thin, elegant, matches light theme
   ============================================ */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--app-border-strong) transparent;
}

/* WebKit (Chrome, Edge, Safari, Tauri WebView2) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--app-border-strong);
  border-radius: 9999px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--app-muted);
}

::-webkit-scrollbar-thumb:active {
  background: var(--app-subtle);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

@theme inline {
  --font-sans: 'Geist Variable', sans-serif;
  --font-heading: var(--font-sans);
  --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: 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);
  --color-foreground: var(--foreground);
  --color-background: var(--background);
  --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.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.87 0 0);
  --chart-2: oklch(0.556 0 0);
  --chart-3: oklch(0.439 0 0);
  --chart-4: oklch(0.371 0 0);
  --chart-5: oklch(0.269 0 0);
  --radius: 0.625rem;
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 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.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.87 0 0);
  --chart-2: oklch(0.556 0 0);
  --chart-3: oklch(0.439 0 0);
  --chart-4: oklch(0.371 0 0);
  --chart-5: oklch(0.269 0 0);
  --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(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
}

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