/**
 * OpenDev Documentation Styles
 * Dark theme consistent with OpenDev platform
 */

/* ============================================================================
   CSS Variables
   ============================================================================ */
:root {
  /* Colors - Dark Theme */
  --docs-bg-primary: #0d0d0d;
  --docs-bg-secondary: #1a1a1a;
  --docs-bg-tertiary: #262626;
  --docs-bg-code: #1e1e1e;
  
  --docs-text-primary: #ffffff;
  --docs-text-secondary: #a3a3a3;
  --docs-text-muted: #737373;
  
  --docs-accent: #3b82f6;
  --docs-accent-hover: #2563eb;
  --docs-accent-light: rgba(59, 130, 246, 0.1);
  
  --docs-border: #333333;
  --docs-border-light: #404040;
  
  --docs-success: #22c55e;
  --docs-warning: #f59e0b;
  --docs-error: #ef4444;
  
  /* Typography */
  --docs-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --docs-font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;
  
  /* Spacing */
  --docs-sidebar-width: 280px;
  --docs-content-max-width: 900px;
  --docs-header-height: 64px;
}

/* ============================================================================
   Base Styles
   ============================================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

/* Header */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--docs-header-height);
  background-color: var(--docs-bg-secondary);
  border-bottom: 1px solid var(--docs-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

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

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

.docs-logo svg {
  width: 32px;
  height: 32px;
}

.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--docs-text-secondary);
  font-size: 14px;
}

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

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

.docs-breadcrumb-sep {
  color: var(--docs-text-muted);
}

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

/* Language Toggle Button - Same style as SDK Downloads page */
.docs-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  color: var(--docs-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0 12px;
}

.docs-lang-toggle:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--docs-accent);
  color: var(--docs-accent);
}

/* Legacy support - button and anchor */
.docs-lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  color: var(--docs-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  box-sizing: border-box;
}

a.docs-lang-switch {
  font-family: inherit;
}

.docs-lang-switch:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--docs-accent);
  color: var(--docs-accent);
}

.docs-lang-switch svg {
  display: none;
}

.docs-lang-switch .lang-label {
  display: inline;
}

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

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

.docs-sidebar-title {
  padding: 0 24px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--docs-text-muted);
}

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

.docs-sidebar-link {
  display: block;
  padding: 8px 24px;
  color: var(--docs-text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

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

.docs-sidebar-link.active {
  color: var(--docs-accent);
  background-color: var(--docs-accent-light);
  border-left-color: var(--docs-accent);
}

.docs-sidebar-link.sub {
  padding-left: 40px;
  font-size: 13px;
}

/* Main Content */
.docs-main {
  margin-left: var(--docs-sidebar-width);
  margin-top: var(--docs-header-height);
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 48px 24px;
}

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

/* Table of Contents (Right Sidebar) */
.docs-toc {
  position: fixed;
  top: calc(var(--docs-header-height) + 48px);
  right: 24px;
  width: 220px;
  max-height: calc(100vh - var(--docs-header-height) - 96px);
  overflow-y: auto;
}

.docs-toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--docs-text-muted);
  margin-bottom: 12px;
}

.docs-toc-list {
  list-style: none;
}

.docs-toc-link {
  display: block;
  padding: 4px 0;
  color: var(--docs-text-secondary);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -2px;
  transition: all 0.2s;
}

.docs-toc-link:hover {
  color: var(--docs-text-primary);
}

.docs-toc-link.active {
  color: var(--docs-accent);
  border-left-color: var(--docs-accent);
}

.docs-toc-link.level-3 {
  padding-left: 24px;
  font-size: 12px;
}

/* ============================================================================
   Typography
   ============================================================================ */
.docs-content h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--docs-text-primary);
}

.docs-content h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--docs-border);
  color: var(--docs-text-primary);
}

.docs-content h2:first-of-type {
  margin-top: 32px;
  border-top: none;
  padding-top: 0;
}

.docs-content h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--docs-text-primary);
}

.docs-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--docs-text-primary);
}

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

.docs-content .lead {
  font-size: 18px;
  color: var(--docs-text-secondary);
  margin-bottom: 32px;
}

.docs-content a {
  color: var(--docs-accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

.docs-content em {
  font-style: italic;
}

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

.docs-content li {
  margin-bottom: 8px;
}

.docs-content li > ul,
.docs-content li > ol {
  margin-top: 8px;
  margin-bottom: 0;
}

/* ============================================================================
   Code Blocks
   ============================================================================ */
.docs-content code {
  font-family: var(--docs-font-mono);
  font-size: 14px;
}

.docs-content :not(pre) > code {
  background-color: var(--docs-bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--docs-accent);
}

.docs-content pre {
  background-color: var(--docs-bg-code);
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  overflow-x: auto;
  position: relative;
}

.docs-content pre code {
  background: none;
  padding: 0;
  color: var(--docs-text-primary);
  line-height: 1.5;
}

/* Code Block Header */
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--docs-bg-tertiary);
  border-bottom: 1px solid var(--docs-border);
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
}

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

.code-block-copy {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--docs-border);
  border-radius: 4px;
  color: var(--docs-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.code-block-copy:hover {
  background-color: var(--docs-bg-secondary);
  color: var(--docs-text-primary);
}

.code-block-copy.copied {
  color: var(--docs-success);
  border-color: var(--docs-success);
}

/* ============================================================================
   Tables
   ============================================================================ */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

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

.docs-content th {
  font-weight: 600;
  color: var(--docs-text-primary);
  background-color: var(--docs-bg-secondary);
}

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

.docs-content tr:hover td {
  background-color: var(--docs-bg-secondary);
}

/* ============================================================================
   Callouts / Alerts
   ============================================================================ */
.docs-callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  border-left: 4px solid;
}

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

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

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

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

.docs-callout.info .docs-callout-title {
  color: var(--docs-accent);
}

.docs-callout.warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: var(--docs-warning);
}

.docs-callout.warning .docs-callout-title {
  color: var(--docs-warning);
}

.docs-callout.error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--docs-error);
}

.docs-callout.error .docs-callout-title {
  color: var(--docs-error);
}

.docs-callout.success {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: var(--docs-success);
}

.docs-callout.success .docs-callout-title {
  color: var(--docs-success);
}

/* ============================================================================
   Images
   ============================================================================ */
.docs-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--docs-border);
  margin-bottom: 24px;
}

.docs-content figure {
  margin-bottom: 24px;
}

.docs-content figcaption {
  text-align: center;
  font-size: 14px;
  color: var(--docs-text-muted);
  margin-top: 8px;
}

/* ============================================================================
   Steps
   ============================================================================ */
.docs-steps {
  counter-reset: step;
  margin-bottom: 24px;
}

.docs-step {
  position: relative;
  padding-left: 48px;
  padding-bottom: 24px;
  border-left: 2px solid var(--docs-border);
  margin-left: 16px;
}

.docs-step:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.docs-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -17px;
  top: 0;
  width: 32px;
  height: 32px;
  background-color: var(--docs-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.docs-step-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--docs-text-primary);
}

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

/* ============================================================================
   Footer
   ============================================================================ */
.docs-footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--docs-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.docs-footer-nav {
  display: flex;
  gap: 16px;
}

.docs-footer-link {
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  background-color: var(--docs-bg-secondary);
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  min-width: 200px;
}

.docs-footer-link:hover {
  border-color: var(--docs-accent);
  background-color: var(--docs-bg-tertiary);
}

.docs-footer-link-label {
  font-size: 12px;
  color: var(--docs-text-muted);
  margin-bottom: 4px;
}

.docs-footer-link-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--docs-text-primary);
}

.docs-footer-link.prev .docs-footer-link-label::before {
  content: '← ';
}

.docs-footer-link.next .docs-footer-link-label::after {
  content: ' →';
}

/* ============================================================================
   Index Page
   ============================================================================ */
.docs-index-header {
  text-align: center;
  margin-bottom: 48px;
}

.docs-index-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
}

.docs-index-desc {
  font-size: 20px;
  color: var(--docs-text-secondary);
}

.docs-category {
  margin-bottom: 48px;
}

.docs-category-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--docs-border);
}

.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

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

.docs-card:hover {
  border-color: var(--docs-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

.docs-card-icon svg {
  width: 24px;
  height: 24px;
  color: var(--docs-accent);
}

.docs-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--docs-text-primary);
  margin-bottom: 8px;
}

.docs-card-desc {
  font-size: 14px;
  color: var(--docs-text-secondary);
  line-height: 1.5;
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */
@media (max-width: 1280px) {
  .docs-toc {
    display: none;
  }
}

@media (max-width: 1024px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .docs-sidebar.open {
    transform: translateX(0);
  }
  
  .docs-main {
    margin-left: 0;
  }
  
  .docs-mobile-toggle {
    display: flex;
  }
}

@media (max-width: 768px) {
  .docs-header {
    padding: 0 16px;
  }
  
  .docs-breadcrumb {
    display: none;
  }
  
  .docs-main {
    padding: 24px 16px;
  }
  
  .docs-content h1 {
    font-size: 28px;
  }
  
  .docs-content h2 {
    font-size: 20px;
  }
  
  .docs-index-title {
    font-size: 32px;
  }
  
  .docs-card-grid {
    grid-template-columns: 1fr;
  }
  
  .docs-footer {
    flex-direction: column;
    gap: 16px;
  }
  
  .docs-footer-link {
    width: 100%;
    min-width: auto;
  }
}

/* ============================================================================
   Utilities
   ============================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.docs-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--docs-text-primary);
  cursor: pointer;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--docs-border-light);
}
