/* Documentation-specific styles */

/* Override root variables for docs page to match main site */
.docs-page {
  --background: #eef3ff;
  --background-accent: rgba(198, 219, 255, 0.45);
  --surface: #ffffff;
  --surface-alt: #f5f8ff;
  --surface-emphasis: #e1e9ff;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --accent-gradient: linear-gradient(135deg, #1d4ed8, #7c3aed);
  --text-primary: #071731;
  --text-secondary: #2f4261;
  --text-muted: #5f6e92;
  --border: rgba(37, 99, 235, 0.16);
  --shadow-lg: 0 24px 48px -24px rgba(25, 56, 110, 0.35);
  --shadow-subtle: 0 18px 42px -30px rgba(40, 60, 105, 0.25);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;

  background: linear-gradient(180deg, rgba(220, 232, 255, 0.7), transparent 45%), var(--background);
}

.docs-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
}

/* Sidebar Navigation */
.docs-sidebar {
  position: sticky;
  top: 73px;
  height: calc(100vh - 73px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 0;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 0 1.5rem;
}

.docs-nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-nav-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
  padding: 0 0.5rem;
}

.docs-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.docs-nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.docs-nav-link:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-left-color: var(--accent);
}

.docs-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* Main Content Area */
.docs-main {
  background: var(--background);
  overflow-y: auto;
}

.docs-content {
  max-width: 900px;
  padding: 3rem 4rem;
  margin: 0 auto;
}

/* Articles */
.docs-article {
  margin-bottom: 4rem;
  scroll-margin-top: 100px;
}

.docs-article:last-child {
  margin-bottom: 0;
}

.docs-article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.docs-article-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.docs-lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
}

.docs-article-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  line-height: 1.8;
}

.docs-article-body h2 {
  font-size: 1.75rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

.docs-article-body h3 {
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

.docs-article-body h2:first-child,
.docs-article-body h3:first-child {
  margin-top: 0;
}

.docs-article-body p {
  color: var(--text-secondary);
  margin: 0;
}

.docs-article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.docs-article-body a:hover {
  color: #1d4ed8;
  text-decoration-thickness: 2px;
}

/* Lists */
.docs-list {
  padding-left: 1.5rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-list li {
  color: var(--text-secondary);
  line-height: 1.7;
}

.docs-list li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Code Blocks */
.docs-code-wrapper {
  position: relative;
  margin: 1rem 0;
}

.docs-code-block {
  background: #02040a;
  color: #d5e2ff;
  border-radius: var(--radius-md);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
  box-shadow: 0 12px 24px -18px rgba(37, 99, 235, 0.4);
}

.docs-code-block code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: inherit;
  color: #d5e2ff;
  display: block;
}

.docs-copy-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.4rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.docs-code-wrapper:hover .docs-copy-button {
  opacity: 1;
}

.docs-copy-button:hover {
  background: var(--muted);
  border-color: var(--accent);
  color: var(--accent);
}

.docs-copy-button.copied {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #10b981;
}

/* Inline code */
.docs-article-body code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 0.88em;
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-weight: 500;
}

/* Syntax highlighting tokens for dark code blocks */
.docs-code-block .token-comment {
  color: #7f8db5;
  font-style: italic;
}

.docs-code-block .token-keyword {
  color: #569cd6;
  font-weight: 600;
}

.docs-code-block .token-module {
  color: #4ec9b0;
}

.docs-code-block .token-string {
  color: #ce9178;
}

.docs-code-block .token-builtin {
  color: #dcdcaa;
}

.docs-code-block .token-variable {
  color: #9cdcfe;
}

.docs-code-block .token-function {
  color: #dcdcaa;
}

/* Callouts */
.docs-callout {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-subtle);
}

.docs-callout-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.docs-callout-content {
  color: var(--text-secondary);
}

.docs-callout-content p {
  margin-bottom: 0.5rem;
}

.docs-callout-content p:last-child {
  margin-bottom: 0;
}

.docs-callout-content ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.docs-callout-content li {
  margin: 0.25rem 0;
}

.docs-callout-info {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.9));
}

.docs-callout-success {
  border-left-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0.9));
}

.docs-callout-warning {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(255, 255, 255, 0.9));
}

.docs-callout-danger {
  border-left-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(255, 255, 255, 0.9));
}

/* Grid Layout for Cards */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.docs-card {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.docs-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.docs-card h3 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.docs-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Tables */
.docs-table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  background: var(--surface);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.docs-table thead {
  background: var(--accent-soft);
}

.docs-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.docs-table td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.docs-table tbody tr:last-child td {
  border-bottom: none;
}

.docs-table tbody tr:hover {
  background: var(--surface-alt);
}

/* Breadcrumbs */
.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.docs-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.docs-breadcrumbs a:hover {
  color: var(--accent);
}

.docs-breadcrumbs-separator {
  color: var(--text-muted);
}

/* Header Active State */
.header-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Mobile Sidebar Toggle */
.docs-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-foreground);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.docs-mobile-toggle:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

/* Search Box */
.docs-search {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.docs-search-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.docs-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.docs-search-input::placeholder {
  color: var(--muted-foreground);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .docs-container {
    grid-template-columns: 240px 1fr;
  }

  .docs-content {
    padding: 2.5rem 3rem;
  }
}

@media (max-width: 768px) {
  .docs-container {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: fixed;
    left: -100%;
    top: 73px;
    width: 80%;
    max-width: 300px;
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: var(--shadow);
  }

  .docs-sidebar.mobile-open {
    left: 0;
  }

  .docs-mobile-toggle {
    display: block;
  }

  .docs-content {
    padding: 2rem 1.5rem;
  }

  .docs-article-header h1 {
    font-size: 2rem;
  }

  .docs-article-body h2 {
    font-size: 1.5rem;
  }

  .docs-article-body h3 {
    font-size: 1.2rem;
  }

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

@media (max-width: 540px) {
  .docs-content {
    padding: 1.5rem 1rem;
  }

  .docs-code-block {
    padding: 1rem;
    font-size: 0.85rem;
  }

  .docs-callout {
    padding: 1rem;
  }
}

/* Scrollbar Styling */
.docs-sidebar::-webkit-scrollbar {
  width: 6px;
}

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

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

.docs-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Print Styles */
@media print {
  .docs-sidebar,
  .site-header,
  .site-footer {
    display: none;
  }

  .docs-container {
    grid-template-columns: 1fr;
  }

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