/* ==========================================================================
   RVBBIT Documentation Styles
   Unified styling matching the landing page v3 exactly
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables (exact match with landing page)
   -------------------------------------------------------------------------- */
:root {
  --bg: #05070c;
  --panel: #0b0f1a;
  --panel-2: #0f1322;
  --ink: #e7f2ff;
  --muted: #9aa7bd;
  --cyan: #1cf6ff;
  --teal: #21d7ff;
  --magenta: #ff2fa8;
  --pink: #ff5ac8;
  --purple: #7a5cff;
  --green: #00ff88;
  --orange: #ffbd2e;
  --line: rgba(40, 240, 255, 0.18);
  --glow: rgba(28, 246, 255, 0.24);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* --------------------------------------------------------------------------
   Fonts
   -------------------------------------------------------------------------- */
@font-face {
  font-display: swap;
  font-family: 'Outrun future';
  src: url('assets/Outrun-future.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-display: swap;
  font-family: 'Outrun future';
  src: url('assets/Outrun-future-Bold.otf') format('opentype');
  font-weight: bold;
  font-style: bold;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Quicksand", "Space Grotesk", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 600px at 85% 0%, rgba(28, 246, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 10% 20%, rgba(255, 47, 168, 0.12), transparent 55%),
    linear-gradient(180deg, #05070c 0%, #060914 60%, #04060c 100%);
  background-attachment: fixed;
}

pre, code {
  font-family: "Cascadia Code", "Google Sans Code", "JetBrains Mono", monospace;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--teal);
}

/* Iconify icon base styling */
iconify-icon {
  display: inline-flex;
  vertical-align: middle;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Page Structure (matching landing page with sidebar)
   -------------------------------------------------------------------------- */
.page {
  position: relative;
  min-height: 100vh;
  display: block;
}

.page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(transparent 94%, rgba(28, 246, 255, 0.05) 96%),
    linear-gradient(90deg, transparent 94%, rgba(28, 246, 255, 0.05) 96%);
  background-size: 48px 48px;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

/* Main content offset for sidebar - responsive width */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  padding: 48px 56px 100px 56px;
}

@media (min-width: 1600px) {
  .main-content {
    max-width: 1400px;
  }
}

@media (min-width: 1900px) {
  .main-content {
    max-width: none;
    padding-right: 120px;
  }
}

/* --------------------------------------------------------------------------
   TOC Sidebar (exact match with landing page v3)
   -------------------------------------------------------------------------- */
.toc-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  overflow: hidden;
  padding: 24px 0 24px 20px;
  background: linear-gradient(90deg, rgba(5, 7, 12, 0.98), rgba(5, 7, 12, 0.95));
  border-right: 1px solid rgba(28, 246, 255, 0.1);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* Only show scrollbar on nav when content overflows */
.toc-nav {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(28, 246, 255, 0.3) transparent;
}

.toc-nav::-webkit-scrollbar {
  width: 4px;
}

.toc-nav::-webkit-scrollbar-track {
  background: transparent;
}

.toc-nav::-webkit-scrollbar-thumb {
  background: rgba(28, 246, 255, 0.3);
  border-radius: 2px;
}

/* Brand/Logo in sidebar */
.toc-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-family: "Outrun future";
  height: 55px;
  font-size: 28px;
  gap: 10px;
  padding: 0 0 20px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.toc-brand img {
  width: 45px;
  height: 45px;
  filter: drop-shadow(0 0 8px rgba(28, 246, 255, 0.4));
}

.toc-brand span {
  font-family: "Outrun future";
  color: #d9f7ff;
}

/* Navigation groups */
.toc-group {
  margin-bottom: 24px;
}

.toc-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  opacity: 0.6;
  padding: 0 12px 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.toc-group-label .group-icon {
  font-size: 0.8rem;
}

/* Navigation links */
.toc-link {
  display: block;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: var(--ink);
  background: rgba(28, 246, 255, 0.05);
}

.toc-link.active {
  color: var(--cyan);
  background: rgba(28, 246, 255, 0.1);
  border-left-color: var(--cyan);
}

/* Sub-sections (page anchors) */
.toc-subsections {
  margin: 4px 0 8px 0;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 12px;
}

.toc-sublink {
  display: block;
  padding: 5px 10px;
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.7;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toc-sublink:hover {
  color: var(--ink);
  opacity: 1;
  background: rgba(255, 255, 255, 0.03);
}

.toc-sublink.active {
  color: var(--cyan);
  opacity: 1;
}

/* Group-specific sublink colors */
.toc-group.cyan .toc-sublink.active {
  color: var(--cyan);
}

.toc-group.purple .toc-sublink.active {
  color: var(--purple);
}

.toc-group.green .toc-sublink.active {
  color: var(--green);
}

/* Group-specific active colors (using class names) */
.toc-group.cyan .toc-link.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(28, 246, 255, 0.1);
}

.toc-group.cyan .toc-group-label {
  color: var(--cyan);
}

.toc-group.purple .toc-link.active {
  color: var(--purple);
  border-left-color: var(--purple);
  background: rgba(122, 92, 255, 0.1);
}

.toc-group.purple .toc-group-label {
  color: var(--purple);
}

.toc-group.green .toc-link.active {
  color: var(--green);
  border-left-color: var(--green);
  background: rgba(0, 255, 136, 0.1);
}

.toc-group.green .toc-group-label {
  color: var(--green);
}

.toc-group.orange .toc-link.active {
  color: var(--orange);
  border-left-color: var(--orange);
  background: rgba(255, 189, 46, 0.1);
}

.toc-group.orange .toc-group-label {
  color: var(--orange);
}

.toc-group.magenta .toc-link.active {
  color: var(--magenta);
  border-left-color: var(--magenta);
  background: rgba(255, 47, 168, 0.1);
}

.toc-group.magenta .toc-group-label {
  color: var(--magenta);
}

/* Sidebar CTA / Links section */
.toc-cta {
  margin-top: 24px;
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.toc-cta .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.85rem;
  padding: 10px 16px;
}

/* External links in sidebar */
.toc-external-links {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.toc-external-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.2s ease;
}

.toc-external-link:hover {
  color: var(--ink);
  background: rgba(28, 246, 255, 0.05);
}

.toc-external-link iconify-icon {
  font-size: 1rem;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid var(--cyan);
  background: rgba(28, 246, 255, 0.15);
  color: var(--cyan);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  background: rgba(28, 246, 255, 0.25);
  box-shadow: 0 0 20px rgba(28, 246, 255, 0.2);
  color: var(--cyan);
}

.btn.secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--muted);
}

.btn.secondary:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Main Content Area (typography and spacing applied directly to .main-content)
   -------------------------------------------------------------------------- */

/* Typography */
.main-content h1 {
  font-family: "Outrun future", "Quicksand", sans-serif;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: normal;
  line-height: 1.1;
  letter-spacing: 0.04em;
  margin: 0 0 24px;
  background: linear-gradient(120deg, #d7f7ff, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(28, 246, 255, 0.15);
}

.main-content h2 {
  font-size: 1.7rem;
  margin: 56px 0 20px;
  color: var(--ink);
  border-bottom: 1px solid rgba(28, 246, 255, 0.2);
  padding-bottom: 10px;
}

.main-content h3 {
  font-size: 1.25rem;
  margin: 36px 0 16px;
  color: var(--ink);
}

.main-content h4 {
  font-size: 1.05rem;
  margin: 28px 0 12px;
  color: var(--cyan);
  font-weight: 600;
}

.main-content p {
  line-height: 1.75;
  margin: 0 0 18px;
  color: var(--ink);
  opacity: 0.92;
}

.main-content p.lead {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 36px;
  line-height: 1.7;
}

.main-content ul, .main-content ol {
  line-height: 1.8;
  margin: 0 0 20px;
  padding-left: 28px;
}

.main-content li {
  margin-bottom: 10px;
  color: var(--ink);
  opacity: 0.92;
}

.main-content strong {
  color: var(--ink);
  font-weight: 600;
}

.main-content hr {
  border: none;
  border-top: 1px solid rgba(28, 246, 255, 0.2);
  margin: 48px 0;
}

/* --------------------------------------------------------------------------
   Code Blocks (landing page style)
   -------------------------------------------------------------------------- */
.code-block {
  background: linear-gradient(150deg, rgba(8, 12, 20, 0.98), rgba(12, 16, 28, 0.95));
  border-radius: var(--radius-md);
  border: 1px solid rgba(28, 246, 255, 0.2);
  border-left: 3px solid var(--cyan);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  margin: 24px 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.3);
}

.code-block-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(28, 246, 255, 0.15);
  border: 1px solid rgba(28, 246, 255, 0.3);
  border-radius: 4px;
  font-family: "Google Sans Code", "JetBrains Mono", monospace;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block-lang::before {
  content: "\2B21";
  font-size: 0.7rem;
}

.code-block-lang.python {
  background: rgba(255, 189, 46, 0.15);
  border-color: rgba(255, 189, 46, 0.3);
  color: var(--orange);
}

.code-block-lang.yaml {
  background: rgba(255, 47, 168, 0.15);
  border-color: rgba(255, 47, 168, 0.3);
  color: var(--magenta);
}

.code-block-lang.bash, .code-block-lang.cli {
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.3);
  color: var(--green);
}

.code-block-lang.config {
  background: rgba(122, 92, 255, 0.15);
  border-color: rgba(122, 92, 255, 0.3);
  color: var(--purple);
}

.code-block-content {
  padding: 20px 24px;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
  font-family: "Cascadia Code", "Google Sans Code", "JetBrains Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.75;
  color: #cde7ff;
}

/* Inline code */
code {
  background: rgba(28, 246, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: "Cascadia Code", "Google Sans Code", "JetBrains Mono", monospace;
  font-size: 0.88em;
  color: var(--cyan);
  border: 1px solid rgba(28, 246, 255, 0.15);
}

pre code {
  background: none;
  padding: 0;
  border: none;
}

/* Syntax highlighting */
.kw { color: var(--magenta); font-weight: 500; }
.fn { color: var(--cyan); }
.str { color: var(--green); }
.num { color: var(--orange); }
.cmt { color: #6a737d; font-style: italic; }
.key { color: var(--purple); }

/* Mermaid Diagrams */
.mermaid-container {
  background: linear-gradient(145deg, rgba(10, 10, 18, 0.9), rgba(26, 26, 46, 0.5));
  border: 1px solid rgba(28, 246, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 30px;
  margin: 32px 0;
  overflow-x: auto;
}

.mermaid-container pre.mermaid {
  background: transparent;
  border: none;
  margin: 0;
  display: flex;
  justify-content: center;
}

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

/* Mermaid theme overrides - purple-blue dark theme */
.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node circle {
  fill: #12121f !important;
  stroke: var(--cyan) !important;
}

.mermaid .state-start,
.mermaid .state-end {
  fill: var(--cyan) !important;
}

.mermaid .edgePath path {
  stroke: #3d4a5c !important;
}

.mermaid .label,
.mermaid text {
  fill: var(--text) !important;
}

/* State diagram cluster backgrounds */
.mermaid .statediagram-cluster rect {
  fill: #151530 !important;
  stroke: rgba(0, 212, 255, 0.35) !important;
}

.mermaid .cluster-label {
  fill: var(--cyan) !important;
}

/* State nodes inside clusters */
.mermaid g.stateGroup rect {
  fill: #12121f !important;
  stroke: var(--cyan) !important;
}

/* --------------------------------------------------------------------------
   Info Boxes (landing page style)
   -------------------------------------------------------------------------- */
.info-box {
  background: linear-gradient(135deg, rgba(28, 246, 255, 0.08), rgba(28, 246, 255, 0.03));
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 28px 0;
  border: 1px solid rgba(28, 246, 255, 0.15);
  border-left-width: 3px;
}

.info-box.warning {
  background: linear-gradient(135deg, rgba(255, 189, 46, 0.08), rgba(255, 189, 46, 0.03));
  border-color: rgba(255, 189, 46, 0.15);
  border-left-color: var(--orange);
}

.info-box.tip {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.08), rgba(0, 255, 136, 0.03));
  border-color: rgba(0, 255, 136, 0.15);
  border-left-color: var(--green);
}

.info-box.magenta {
  background: linear-gradient(135deg, rgba(255, 47, 168, 0.08), rgba(255, 47, 168, 0.03));
  border-color: rgba(255, 47, 168, 0.15);
  border-left-color: var(--magenta);
}

.info-box-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin: 0 0 10px;
  font-weight: 600;
}

.info-box.warning .info-box-title {
  color: var(--orange);
}

.info-box.tip .info-box-title {
  color: var(--green);
}

.info-box.magenta .info-box-title {
  color: var(--magenta);
}

.info-box p {
  margin: 0;
  opacity: 0.95;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Tables (landing page style)
   -------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 0.9rem;
  border: 1px solid rgba(28, 246, 255, 0.15);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

thead {
  background: rgba(28, 246, 255, 0.1);
}

th {
  padding: 14px 18px;
  text-align: left;
  font-weight: 600;
  color: var(--cyan);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid rgba(28, 246, 255, 0.2);
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:hover {
  background: rgba(28, 246, 255, 0.04);
}

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

/* --------------------------------------------------------------------------
   TOC (Table of Contents - in content)
   Hidden since we now show sub-sections in sidebar
   -------------------------------------------------------------------------- */
.toc {
  display: none; /* Moved to sidebar sub-sections */
}

.toc-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin: 0 0 14px;
  font-weight: 600;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 24px;
}

.toc li {
  margin-bottom: 8px;
  break-inside: avoid;
}

.toc a {
  color: var(--muted);
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.toc a:hover {
  color: var(--cyan);
}

@media (max-width: 600px) {
  .toc ul {
    columns: 1;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
  border-top: 1px solid rgba(28, 246, 255, 0.1);
  padding: 36px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  background: rgba(5, 7, 12, 0.5);
}

footer a {
  color: var(--cyan);
  margin: 0 4px;
}

footer a:hover {
  color: var(--teal);
}

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

.feature-card {
  background: linear-gradient(150deg, rgba(11, 15, 26, 0.9), rgba(15, 19, 34, 0.8));
  border: 1px solid rgba(28, 246, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.3s ease;
}

.feature-card:hover {
  border-color: rgba(28, 246, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.feature-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 246, 255, 0.12);
  border: 1px solid rgba(28, 246, 255, 0.25);
  border-radius: 12px;
  color: var(--cyan);
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.feature-card-icon.magenta {
  background: rgba(255, 47, 168, 0.12);
  border-color: rgba(255, 47, 168, 0.25);
  color: var(--magenta);
}

.feature-card-icon.green {
  background: rgba(0, 255, 136, 0.12);
  border-color: rgba(0, 255, 136, 0.25);
  color: var(--green);
}

.feature-card-icon.purple {
  background: rgba(122, 92, 255, 0.12);
  border-color: rgba(122, 92, 255, 0.25);
  color: var(--purple);
}

.feature-card h4 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: var(--ink);
}

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

/* --------------------------------------------------------------------------
   Gradient Text
   -------------------------------------------------------------------------- */
.gradient-text {
  background: linear-gradient(120deg, #d7f7ff, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------------------------------------------------------------------------
   Loading State
   -------------------------------------------------------------------------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
}

.loading::after {
  content: "";
  width: 24px;
  height: 24px;
  border: 2px solid rgba(28, 246, 255, 0.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 12px;
}

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

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .main-content {
    margin-left: 240px;
  }

  .main-content {
    padding: 40px 40px 80px 40px;
  }
}

@media (max-width: 900px) {
  .toc-sidebar {
    display: none;
  }

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

  .main-content {
    padding: 32px 24px 60px 24px;
  }
}

@media (max-width: 600px) {
  .main-content h1 {
    font-size: 2rem;
    letter-spacing: 0.02em;
  }

  .main-content h2 {
    font-size: 1.4rem;
  }

  .code-block-content {
    padding: 16px;
  }

  .code-block pre {
    font-size: 0.78rem;
  }

  table {
    font-size: 0.8rem;
  }

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

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

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

  .main-content {
    max-width: 100%;
    padding: 0;
  }

  .page::before {
    display: none;
  }

  body {
    background: white;
    color: black;
  }
}
