/* shadcn/ui Inspired Dark Theme Documentation CSS */
:root {
  /* Background colors */
  --background: #09090b;
  --background-secondary: #0a0a0c;
  --sidebar-bg: #09090b;

  /* Foreground colors */
  --foreground: #fafafa;
  --foreground-muted: #a1a1aa;
  --foreground-subtle: #71717a;

  /* Border colors */
  --border: #27272a;
  --border-hover: #3f3f46;

  /* Primary - Zinc accent */
  --primary: #18181b;
  --primary-foreground: #fafafa;

  /* Accent - Subtle blue */
  --accent: #3b82f6;
  --accent-muted: rgba(59, 130, 246, 0.15);
  --accent-foreground: #60a5fa;

  /* Status colors */
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.15);
  --warning: #eab308;
  --warning-muted: rgba(234, 179, 8, 0.15);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-muted: rgba(59, 130, 246, 0.15);

  /* Card */
  --card: #18181b;
  --card-hover: #1f1f23;
  --card-border: #27272a;

  /* Code */
  --code-bg: #18181b;
  --code-inline-bg: #27272a;
  --code-text: #e4e4e7;

  /* Radius */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 6px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  line-height: 1.7;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

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

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

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

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  color: var(--foreground);
}

.sidebar-logo svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
}

.sidebar-logo img {
  height: 48px;
  width: auto;
}

.sidebar-logo span {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-version {
  display: inline-block;
  font-size: 11px;
  color: var(--foreground-subtle);
  background: var(--card);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.sidebar-nav {
  padding: 16px 0;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  padding: 8px 20px 8px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground-subtle);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  margin: 2px 8px;
  color: var(--foreground-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover {
  background: var(--card);
  color: var(--foreground);
}

.nav-link.active {
  background: var(--accent-muted);
  color: var(--accent-foreground);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  min-height: 100vh;
  background: var(--background);
}

.content-header {
  background: linear-gradient(180deg, var(--card) 0%, var(--background) 100%);
  border-bottom: 1px solid var(--border);
  padding: 48px 48px 40px;
}

.content-header h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--foreground);
}

.content-header p {
  font-size: 16px;
  color: var(--foreground-muted);
  max-width: 600px;
}

.content-body {
  padding: 40px 48px;
  max-width: 900px;
  margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 32px;
  margin-bottom: 16px;
}

h1 { font-size: 28px; }
h2 {
  font-size: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p {
  margin-bottom: 16px;
  color: var(--foreground-muted);
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--foreground-muted);
}

li {
  margin-bottom: 8px;
}

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

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

strong {
  color: var(--foreground);
  font-weight: 500;
}

/* Code */
code {
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 13px;
  background: var(--code-inline-bg);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  color: var(--foreground);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--code-text);
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 8px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: 0;
}

.code-header + pre {
  margin-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.code-lang {
  font-size: 12px;
  color: var(--foreground-subtle);
  text-transform: uppercase;
  font-weight: 500;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: var(--card-hover);
  color: var(--foreground);
  border-color: var(--border-hover);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

th {
  background: var(--card);
  font-weight: 500;
  color: var(--foreground);
  font-size: 13px;
}

td {
  color: var(--foreground-muted);
}

tr:last-child td {
  border-bottom: none;
}

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

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 16px 0;
  display: flex;
  gap: 12px;
  border: 1px solid;
}

.alert-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.alert-info {
  background: var(--info-muted);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent-foreground);
}

.alert-info .alert-icon {
  stroke: var(--accent-foreground);
}

.alert-success {
  background: var(--success-muted);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.alert-success .alert-icon {
  stroke: #4ade80;
}

.alert-warning {
  background: var(--warning-muted);
  border-color: rgba(234, 179, 8, 0.3);
  color: #facc15;
}

.alert-warning .alert-icon {
  stroke: #facc15;
}

.alert-danger {
  background: var(--danger-muted);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.alert-danger .alert-icon {
  stroke: #f87171;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s ease;
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--card-hover);
}

.card-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.card-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent-foreground);
}

.card h3 {
  margin-top: 0;
  font-size: 16px;
  color: var(--foreground);
}

.card p {
  color: var(--foreground-muted);
  font-size: 14px;
  margin-bottom: 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-muted);
  color: #4ade80;
}

.badge-warning {
  background: var(--warning-muted);
  color: #facc15;
}

.badge-info {
  background: var(--info-muted);
  color: var(--accent-foreground);
}

.badge-danger {
  background: var(--danger-muted);
  color: #f87171;
}

/* Feature Grid (Index page) */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 32px 0;
}

.feature-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s ease;
}

.feature-item:hover {
  border-color: var(--border-hover);
}

.feature-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.feature-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-foreground);
}

.feature-item h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.feature-item p {
  margin: 0;
  font-size: 14px;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 60px 40px;
  background: linear-gradient(180deg, var(--card) 0%, var(--background) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-muted);
  color: var(--accent-foreground);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 24px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.hero-logo {
  display: block;
  max-width: 360px;
  height: auto;
  margin: 0 auto 32px auto;
}

.hero h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 16px 0;
  background: linear-gradient(135deg, var(--foreground) 0%, var(--foreground-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero p {
  font-size: 18px;
  color: var(--foreground-muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

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

.btn-primary:hover {
  background: var(--foreground-muted);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--card);
  border-color: var(--border-hover);
  text-decoration: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* Architecture Diagram */
.arch-diagram {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--code-text);
  padding: 24px;
  border-radius: var(--radius);
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre;
}

/* Component List (Architecture page) */
.component-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.component-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.component-item:hover {
  border-color: var(--border-hover);
}

.component-item h4 {
  margin: 0 0 8px 0;
  color: var(--foreground);
  font-size: 15px;
}

.component-item p {
  margin: 0 0 12px 0;
  font-size: 13px;
}

.component-item code {
  font-size: 11px;
}

/* Footer */
.docs-footer {
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  margin-top: 60px;
  color: var(--foreground-subtle);
  font-size: 13px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
}

/* Mobile Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
  backdrop-filter: blur(4px);
}

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

/* Responsive Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper table {
  margin: 0;
  min-width: 500px;
}

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
  .content-body {
    max-width: 1000px;
  }

  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop (1024px - 1399px) */
@media (max-width: 1399px) {
  .content-body {
    max-width: 800px;
  }
}

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
  .sidebar {
    width: 260px;
  }

  .main-content {
    margin-left: 260px;
  }

  .content-header {
    padding: 40px 32px;
  }

  .content-body {
    padding: 32px;
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .component-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    padding: 48px 32px;
  }

  .hero h1 {
    font-size: 36px;
  }
}

/* Mobile Landscape & Small Tablet (640px - 767px) */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

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

  .mobile-menu-btn {
    display: flex;
  }

  .content-header {
    padding: 80px 20px 32px;
  }

  .content-header h1 {
    font-size: 26px;
  }

  .content-header p {
    font-size: 15px;
  }

  .content-body {
    padding: 24px 20px;
  }

  .hero {
    padding: 80px 20px 40px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .feature-item {
    padding: 20px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .component-list {
    grid-template-columns: 1fr;
  }

  .docs-footer {
    padding: 24px 20px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 16px;
  }

  /* Code blocks */
  pre {
    padding: 14px 16px;
    font-size: 12px;
    border-radius: var(--radius-sm);
  }

  .code-header {
    padding: 6px 12px;
  }

  .arch-diagram {
    font-size: 9px;
    padding: 16px;
  }

  /* Alerts */
  .alert {
    padding: 14px 16px;
    flex-direction: column;
    gap: 8px;
  }

  .alert-icon {
    margin-top: 0;
  }
}

/* Mobile Portrait (< 640px) */
@media (max-width: 639px) {
  .content-header {
    padding: 72px 16px 24px;
  }

  .content-header h1 {
    font-size: 22px;
  }

  .content-body {
    padding: 20px 16px;
  }

  .hero {
    padding: 72px 16px 32px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 5px 12px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .hero p {
    font-size: 14px;
  }

  .feature-item {
    padding: 16px;
  }

  .feature-icon {
    width: 38px;
    height: 38px;
  }

  .feature-icon svg {
    width: 18px;
    height: 18px;
  }

  .feature-item h3 {
    font-size: 15px;
  }

  .feature-item p {
    font-size: 13px;
  }

  .card {
    padding: 16px;
  }

  .card h3 {
    font-size: 15px;
  }

  .card p {
    font-size: 13px;
  }

  /* Tables - stack on mobile */
  table {
    font-size: 13px;
  }

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

  code {
    font-size: 12px;
    padding: 2px 5px;
  }

  pre code {
    font-size: 11px;
  }

  .badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  .docs-footer {
    padding: 20px 16px;
    font-size: 12px;
  }

  /* Sidebar adjustments */
  .sidebar {
    width: 260px;
  }

  .sidebar-header {
    padding: 20px 16px;
  }

  .sidebar-logo span {
    font-size: 16px;
  }

  .nav-link {
    padding: 8px 16px;
    font-size: 13px;
  }

  .nav-section-title {
    padding: 8px 16px;
    font-size: 10px;
  }
}

/* Extra small devices (< 380px) */
@media (max-width: 379px) {
  .content-header h1 {
    font-size: 20px;
  }

  .hero h1 {
    font-size: 22px;
  }

  .hero p {
    font-size: 13px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 13px;
  }

  .feature-item h3 {
    font-size: 14px;
  }

  pre {
    font-size: 11px;
    padding: 12px;
  }

  .arch-diagram {
    font-size: 8px;
    padding: 12px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .nav-link {
    padding: 12px 20px;
  }

  .btn {
    padding: 14px 24px;
  }

  .copy-btn {
    padding: 6px 12px;
  }

  .card:hover,
  .feature-item:hover,
  .component-item:hover {
    border-color: var(--border);
    background: var(--card);
  }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 60px 20px 30px;
  }

  .hero h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .hero p {
    margin-bottom: 20px;
  }

  .content-header {
    padding: 60px 20px 24px;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .mobile-menu-btn,
  .sidebar-overlay,
  .copy-btn {
    display: none !important;
  }

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

  .content-body {
    max-width: 100%;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* Syntax Highlighting (Dark theme) */
.hljs-keyword { color: #c678dd; }
.hljs-string { color: #98c379; }
.hljs-number { color: #d19a66; }
.hljs-comment { color: #5c6370; font-style: italic; }
.hljs-function { color: #61afef; }
.hljs-variable { color: #e06c75; }
.hljs-attr { color: #d19a66; }
.hljs-built_in { color: #e6c07b; }

/* Scrollbar for main content */
.main-content::-webkit-scrollbar {
  width: 8px;
}

.main-content::-webkit-scrollbar-track {
  background: var(--background);
}

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

.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

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