/* Fumadocs/shadcn-inspired Documentation Theme */
/* Modern theme with dark/light mode support */

:root {
  /* Light mode (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --bg-card: #ffffff;
  --bg-hover: #e8eaed;
  --border-color: #e0e0e0;
  --border-subtle: #eaeaea;
  --text-primary: #1a1a1a;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: rgba(37, 99, 235, 0.1);
  --success: #16a34a;
  --warning: #ca8a04;
  --code-bg: #f6f8fa;
  --code-text: #24292f;
  --sidebar-width: 280px;
  --header-height: 64px;
  --content-max-width: 900px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark mode */
[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #171717;
  --bg-card: #18181b;
  --bg-hover: #27272a;
  --border-color: #27272a;
  --border-subtle: #1f1f23;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-subtle: rgba(59, 130, 246, 0.1);
  --success: #22c55e;
  --warning: #eab308;
  --code-bg: #1e1e2e;
  --code-text: #e4e4e7;
}

/* System preference detection */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #171717;
    --bg-card: #18181b;
    --bg-hover: #27272a;
    --border-color: #27272a;
    --border-subtle: #1f1f23;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-subtle: rgba(59, 130, 246, 0.1);
    --success: #22c55e;
    --warning: #eab308;
    --code-bg: #1e1e2e;
    --code-text: #e4e4e7;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.docs-layout {
  display: flex;
  min-height: 100vh;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-primary);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

[data-theme="dark"] .header {
  background: rgba(10, 10, 10, 0.9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .header {
    background: rgba(10, 10, 10, 0.9);
  }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
}

.mobile-menu-toggle:hover {
  background: var(--bg-hover);
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
}

.mobile-menu-toggle .close-icon {
  display: none;
}

.mobile-menu-toggle.active .menu-icon {
  display: none;
}

.mobile-menu-toggle.active .close-icon {
  display: block;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.header-nav {
  display: flex;
  gap: 24px;
  list-style: none;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-nav a.active {
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.github-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.github-link svg {
  width: 20px;
  height: 20px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 24px 16px;
  z-index: 50;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin: 2px 0;
}

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 500;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  flex: 1;
  min-width: 0;
}

.content-wrapper {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 48px 48px 96px;
}

/* Landing Page */
.landing-hero {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: 800px;
  margin: 0 auto;
}

.landing-hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.landing-hero .tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.landing-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--text-secondary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  padding: 48px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
}

.feature-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2.25rem;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.5rem;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

h3 {
  font-size: 1.25rem;
  margin-top: 32px;
  margin-bottom: 12px;
}

h4 {
  font-size: 1.1rem;
  margin-top: 24px;
  margin-bottom: 8px;
}

p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Lists */
ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

li {
  margin-bottom: 8px;
}

li::marker {
  color: var(--text-muted);
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

pre {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0 24px;
  font-size: 0.875rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  color: var(--code-text);
  font-size: inherit;
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun-icon {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .moon-icon {
    display: none;
  }
}

/* Copy Button */
.code-block {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.code-block:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.copy-btn.copied {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

td {
  color: var(--text-secondary);
}

tr:hover td {
  background: var(--bg-secondary);
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-subtle);
  padding: 16px 20px;
  margin: 16px 0 24px;
  border-radius: 0 8px 8px 0;
}

blockquote p {
  margin: 0;
  color: var(--text-secondary);
}

blockquote strong {
  color: var(--accent);
}

/* Callouts */
.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin: 16px 0 24px;
  border: 1px solid;
}

.callout-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.callout-warning {
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.3);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Horizontal Rule */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 48px 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Page Navigation */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.page-nav-link {
  flex: 1;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
}

.page-nav-link:hover {
  border-color: var(--text-muted);
  text-decoration: none;
}

.page-nav-link.prev {
  text-align: left;
}

.page-nav-link.next {
  text-align: right;
}

.page-nav-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.page-nav-title {
  font-weight: 500;
  color: var(--text-primary);
}

/* Footer */
.footer {
  margin-left: var(--sidebar-width);
  padding: 24px 48px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer a {
  color: var(--text-secondary);
}

/* LLM Docs Page */
.llm-docs {
  max-width: 100%;
}

.llm-section {
  margin-bottom: 48px;
}

.llm-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.llm-copy-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 16px 0;
}

.llm-copy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
}

.llm-copy-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.llm-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.llm-copy-btn:hover {
  background: var(--accent-hover);
}

.llm-copy-btn.copied {
  background: var(--success);
}

.llm-copy-content {
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.llm-copy-content pre {
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.llm-full-doc {
  max-height: none;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .header-nav {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--header-height));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 90;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 80;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .footer {
    margin-left: 0;
  }

  .content-wrapper {
    padding: 32px 24px 64px;
  }

  .landing-hero h1 {
    font-size: 2.5rem;
  }

  .landing-features {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    padding: 32px 16px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 16px;
  }

  .header-left {
    gap: 16px;
  }

  .logo {
    font-size: 1.1rem;
  }

  .logo-icon {
    width: 24px;
    height: 24px;
  }

  .header-right {
    gap: 8px;
  }

  .theme-toggle,
  .github-link {
    width: 32px;
    height: 32px;
  }

  .theme-toggle svg,
  .github-link svg {
    width: 18px;
    height: 18px;
  }

  .landing-hero {
    padding: 48px 16px 40px;
  }

  .landing-hero h1 {
    font-size: 2rem;
  }

  .landing-hero .tagline {
    font-size: 1rem;
  }

  .landing-buttons {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .btn {
    justify-content: center;
  }

  .content-wrapper {
    padding: 24px 16px 48px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
    margin-top: 32px;
  }

  h3 {
    font-size: 1.1rem;
  }

  .page-nav {
    flex-direction: column;
  }

  table {
    display: block;
    overflow-x: auto;
    font-size: 0.85rem;
  }

  th, td {
    padding: 8px 12px;
  }

  pre {
    padding: 12px 14px;
    font-size: 0.8rem;
  }

  .code-block .copy-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .feature-card {
    padding: 20px;
  }

  .feature-card h3 {
    font-size: 1rem;
  }

  .feature-card p {
    font-size: 0.85rem;
  }

  blockquote {
    padding: 12px 16px;
  }

  .llm-copy-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .llm-copy-btn {
    width: 100%;
    justify-content: center;
  }

  .llm-copy-content {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .landing-hero h1 {
    font-size: 1.75rem;
  }

  .landing-features {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    width: 100%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

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

/* Selection */
::selection {
  background: var(--accent);
  color: white;
}

/* Print */
@media print {
  .sidebar,
  .header,
  .copy-btn,
  .llm-copy-btn {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  body {
    background: white;
    color: black;
  }
}