/* AZPlottingClass Documentation - Sphinx-like Theme */

:root {
  --color-bg: #fcfcfc;
  --color-bg-sidebar: #f7f7f7;
  --color-text: #333;
  --color-text-muted: #6b6b6b;
  --color-primary: #2980b9;
  --color-primary-dark: #1a5276;
  --color-secondary: #27ae60;
  --color-border: #e1e1e1;
  --color-code-bg: #f4f4f4;
  --color-code-inline: #e74c3c;
  --color-heading: #1c1c1c;
  --sidebar-width: 280px;
  --content-max-width: 900px;
  --font-sans: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Source Code Pro', 'Fira Code', 'Consolas', monospace;
}

/* Dark theme variables */
[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-bg-sidebar: #242424;
  --color-text: #e0e0e0;
  --color-text-muted: #999;
  --color-primary: #5dade2;
  --color-primary-dark: #85c1e9;
  --color-border: #3a3a3a;
  --color-code-bg: #2d2d2d;
  --color-code-inline: #f39c12;
  --color-heading: #fff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
}

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

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

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-header h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-primary);
}

.sidebar-header .version {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.sidebar-nav {
  padding: 1rem 0;
}

.sidebar-nav .nav-section {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li a {
  display: block;
  padding: 0.4rem 1.5rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover {
  background: rgba(0,0,0,0.05);
  color: var(--color-primary);
}

.sidebar-nav li a.active {
  color: var(--color-primary);
  background: rgba(41, 128, 185, 0.1);
  border-right: 3px solid var(--color-primary);
}

.sidebar-nav li.nested a {
  padding-left: 2.5rem;
  font-size: 0.9rem;
}

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

.content-wrapper {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 2rem 3rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.25rem; margin-top: 0; }
h2 { font-size: 1.75rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.3em; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

p {
  margin: 0 0 1rem;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--color-code-inline);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1rem 0;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Syntax highlighting */
.hljs-keyword { color: #c678dd; }
.hljs-string { color: #98c379; }
.hljs-number { color: #d19a66; }
.hljs-comment { color: #5c6370; font-style: italic; }
.hljs-function { color: #61afef; }
.hljs-class { color: #e5c07b; }
.hljs-params { color: #abb2bf; }
.hljs-built_in { color: #56b6c2; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

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

th {
  background: var(--color-code-bg);
  font-weight: 600;
}

tr:nth-child(even) {
  background: rgba(0,0,0,0.02);
}

/* API documentation styles */
.method-signature {
  background: var(--color-code-bg);
  padding: 1rem;
  border-radius: 4px;
  border-left: 4px solid var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  overflow-x: auto;
  margin: 1rem 0 0.5rem;
}

.method-doc {
  margin-bottom: 2rem;
}

.method-doc h4 {
  margin-top: 0.5rem;
}

.param-table {
  font-size: 0.9rem;
}

.param-table .param-name {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-primary-dark);
}

.param-table .param-type {
  font-family: var(--font-mono);
  color: var(--color-secondary);
}

.returns-info {
  background: rgba(39, 174, 96, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Admonitions */
.admonition {
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 4px;
  border-left: 4px solid;
}

.admonition-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.admonition.note {
  background: rgba(41, 128, 185, 0.1);
  border-color: var(--color-primary);
}

.admonition.warning {
  background: rgba(243, 156, 18, 0.1);
  border-color: #f39c12;
}

.admonition.tip {
  background: rgba(39, 174, 96, 0.1);
  border-color: var(--color-secondary);
}

/* Demo embed container */
.demo-container {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  margin: 1.5rem 0;
  background: #fff;
}

.demo-header {
  background: var(--color-code-bg);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.demo-header .demo-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.demo-header .demo-actions button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: 3px;
  font-size: 0.8rem;
  cursor: pointer;
}

.demo-header .demo-actions button:hover {
  background: var(--color-primary-dark);
}

.demo-frame {
  width: 100%;
  height: 500px;
  border: none;
  display: block;
}

.demo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--color-text-muted);
}

.demo-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Keyboard shortcuts */
kbd {
  display: inline-block;
  padding: 0.2em 0.5em;
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--color-border);
}

/* Top bar for mobile */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: var(--color-bg-sidebar);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1rem;
  align-items: center;
  z-index: 99;
}

.topbar-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg-sidebar);
  border: 1px solid var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 101;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

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

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

.breadcrumbs .separator {
  margin: 0 0.5rem;
}

/* Feature list */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.feature-card {
  padding: 1.25rem;
  background: var(--color-bg-sidebar);
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

.feature-card h4 {
  margin-top: 0;
  color: var(--color-primary);
}

.feature-card p {
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .topbar {
    display: flex;
  }
  
  .main-content {
    margin-left: 0;
    padding-top: 50px;
  }
  
  .content-wrapper {
    padding: 1.5rem;
  }
  
  .demo-frame {
    height: 350px;
  }
}

/* Search box in sidebar */
.sidebar-search {
  padding: 0.75rem 1.5rem;
}

.sidebar-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-search input::placeholder {
  color: var(--color-text-muted);
}

/* Enum table styling */
.enum-table {
  font-size: 0.9rem;
}

.enum-table code {
  font-size: 0.85em;
}
