/* Ferrox-RC Documentation Reader Styling */
:root {
  --docs-bg: #090b10;
  --docs-sidebar-bg: #0d1117;
  --docs-border: rgba(255, 255, 255, 0.08);
  --docs-text: #e6edf3;
  --docs-text-muted: #8b949e;
  --docs-accent-rust: #e05a47;
  --docs-accent-cyan: #38bdf8;
  --docs-accent-green: #34d399;
  --docs-code-bg: #161b22;
  --docs-active-bg: rgba(224, 90, 71, 0.12);
}

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

body.docs-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--docs-bg);
  color: var(--docs-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nav Header */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 11, 16, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--docs-border);
}

.docs-header-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 28px);
}

.docs-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--docs-text);
  flex-shrink: 0;
}

.docs-brand span.title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
}

.docs-brand span.title span {
  color: var(--docs-accent-rust);
}

.docs-brand .docs-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  background: rgba(224, 90, 71, 0.15);
  color: var(--docs-accent-rust);
  border: 1px solid rgba(224, 90, 71, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.docs-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.docs-nav-links a {
  color: var(--docs-text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.docs-nav-links a:hover {
  color: var(--docs-text);
}

/* Mobile Toggle Button */
.docs-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--docs-border);
  color: var(--docs-text);
  border-radius: 8px;
  padding: 7px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.docs-mobile-toggle:hover {
  border-color: var(--docs-accent-cyan);
}

/* Mobile Drawer */
.docs-mobile-drawer {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 14px clamp(16px, 3vw, 28px) 20px;
  border-top: 1px solid var(--docs-border);
  background: rgba(9, 11, 16, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
}

.docs-mobile-drawer.is-open {
  display: flex;
  animation: docsNavSlideDown 0.2s ease forwards;
}

@keyframes docsNavSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.docs-mobile-drawer a {
  color: var(--docs-text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 0;
  transition: color 0.15s ease;
}

.docs-mobile-drawer a:hover {
  color: var(--docs-text);
}

/* Layout */
.docs-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 60px);
}

/* Sidebar */
.docs-sidebar {
  width: 320px;
  background: var(--docs-sidebar-bg);
  border-right: 1px solid var(--docs-border);
  padding: 24px 16px;
  overflow-y: auto;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  flex-shrink: 0;
}

.docs-search-box {
  margin-bottom: 20px;
}

.docs-search-input {
  width: 100%;
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--docs-text);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.docs-search-input:focus {
  border-color: var(--docs-accent-cyan);
}

.docs-group {
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 8px;
}

.docs-group:last-child {
  border-bottom: none;
}

.docs-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  transition: background 0.15s ease;
}

.docs-group-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.docs-group-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--docs-text-muted);
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-group.open .docs-group-title {
  color: var(--docs-text);
}

.docs-group-chevron {
  width: 16px;
  height: 16px;
  color: var(--docs-text-muted);
  transition: transform 0.2s ease, color 0.15s ease;
}

.docs-group.open .docs-group-chevron {
  transform: rotate(90deg);
  color: var(--docs-accent-cyan);
}

.docs-group-links {
  list-style: none;
  margin-top: 4px;
  padding-left: 6px;
  display: none;
}

.docs-group.open .docs-group-links {
  display: block;
}


.docs-group-links li a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: #c9d1d9;
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.docs-group-links li a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.docs-group-links li a.active {
  background: var(--docs-active-bg);
  color: var(--docs-accent-rust);
  font-weight: 500;
  border-left: 2px solid var(--docs-accent-rust);
  border-radius: 0 6px 6px 0;
}

/* Main Content Area */
.docs-content-container {
  flex: 1;
  padding: 40px 60px;
  max-width: 960px;
  overflow-y: auto;
}

.docs-breadcrumbs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--docs-text-muted);
  margin-bottom: 20px;
}

.docs-breadcrumbs span {
  color: var(--docs-accent-cyan);
}

/* Markdown Render Typography */
.markdown-body {
  font-family: 'Inter', sans-serif;
  color: #c9d1d9;
  line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-family: 'Space Grotesk', sans-serif;
  color: #f0f6fc;
  font-weight: 600;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  border-bottom: 1px solid var(--docs-border);
  padding-bottom: 0.3em;
}

.markdown-body h1 { font-size: 2.2rem; }
.markdown-body h2 { font-size: 1.6rem; }
.markdown-body h3 { font-size: 1.25rem; border-bottom: none; }
.markdown-body h4 { font-size: 1.05rem; border-bottom: none; }

.markdown-body p {
  margin-bottom: 1.2em;
}

.markdown-body a {
  color: var(--docs-accent-cyan);
  text-decoration: none;
}
.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 1.2em;
  padding-left: 1.6em;
}

.markdown-body li {
  margin-bottom: 0.4em;
}

.markdown-body pre {
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 1.4em;
}

/* Mermaid Flowcharts */
.markdown-body .mermaid {
  background: rgba(14, 17, 23, 0.6);
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  padding: 20px;
  margin: 1.5em 0;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.markdown-body .mermaid svg {
  max-width: 100%;
  height: auto;
}

.markdown-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
}

.markdown-body p code,
.markdown-body li code {
  background: rgba(240, 246, 252, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #ff7b72;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.markdown-body blockquote {
  border-left: 3px solid var(--docs-accent-rust);
  padding: 8px 16px;
  background: rgba(224, 90, 71, 0.05);
  color: #8b949e;
  margin-bottom: 1.2em;
  border-radius: 0 6px 6px 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.4em;
  font-size: 0.9rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--docs-border);
  padding: 8px 14px;
  text-align: left;
}

.markdown-body th {
  background: var(--docs-code-bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #f0f6fc;
}

.markdown-body tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--docs-border);
  margin: 2em 0;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--docs-border);
  margin: 1em 0;
}

/* Loading & Error States */
.docs-loader {
  font-family: 'JetBrains Mono', monospace;
  color: var(--docs-accent-cyan);
  padding: 40px;
  text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 860px) {
  .docs-nav-links {
    display: none;
  }
  .docs-mobile-toggle {
    display: inline-flex;
  }
  .docs-layout {
    flex-direction: column;
  }
  .docs-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--docs-border);
    max-height: 280px;
  }
  .docs-content-container {
    padding: 24px 20px;
  }
}
