@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Light Theme Variables ── */
  --mono-100: #0f172a;        /* Deepest text color */
  --mono-200: #f8fafc;        /* Sidebar background */
  --mono-300: #e2e8f0;        /* Borders */
  --mono-400: #94a3b8;        /* Scrollbar track, disabled elements */
  --mono-500: #64748b;        /* Subtext / Placeholders */
  --mono-600: #475569;        /* Hover link text */
  --mono-700: #334155;        /* Main body content text */
  --mono-800: #1e293b;        /* Headings / Dark text */
  --mono-900: #0f172a;        /* Title text */
  --mono-1000: #ffffff;       /* Main page background */

  /* Theme colors */
  --primary: #0f172a;
  --primary-rgb: 15, 23, 42;
  --accent: #10b981;
  --accent-rgb: 16, 185, 129;
  
  /* Layout backgrounds */
  --header-bg: rgba(255, 255, 255, 0.8);
  --sidebar-bg: #f8fafc;
  --body-bg: #ffffff;
  
  /* Alert Box colors */
  --note-bg: rgba(59, 130, 246, 0.05);
  --note-border: #3b82f6;
  --note-text: #1e3a8a;
  
  --warning-bg: rgba(245, 158, 11, 0.05);
  --warning-border: #f59e0b;
  --warning-text: #78350f;
  
  --tip-bg: rgba(16, 185, 129, 0.05);
  --tip-border: #10b981;
  --tip-text: #065f46;
  
  /* Code blocks styles */
  --code-bg: #0f172a;
  --code-border: #1e293b;
  --code-text: #f8fafc;
  --code-inline-bg: #f1f5f9;
  --code-inline-color: #0f172a;
  --code-inline-border: #e2e8f0;

  /* Navigation */
  --nav-active-bg: rgba(15, 23, 42, 0.04);
  --nav-active-color: #0f172a;
  
  /* Layout widths */
  --sidebar-width: 280px;
  --toc-width: 240px;
  --header-height: 70px;
}

html.dark-theme, body.dark-theme, [data-theme="dark"] {
  /* ── Dark Theme Variables ── */
  --mono-100: #f8fafc;        /* Crisp white/light-gray text */
  --mono-200: #0b0f19;        /* Sidebar background */
  --mono-300: #1e293b;        /* Borders */
  --mono-400: #475569;        /* Scrollbar track */
  --mono-500: #94a3b8;        /* Subtext / Placeholders */
  --mono-600: #cbd5e1;        /* Hover link text */
  --mono-700: #cbd5e1;        /* Main body content text */
  --mono-800: #f1f5f9;        /* Headings */
  --mono-900: #ffffff;        /* Title text */
  --mono-1000: #070a13;       /* Main page background */

  /* Theme colors */
  --primary: #ffffff;
  --primary-rgb: 255, 255, 255;
  --accent: #10b981;
  --accent-rgb: 16, 185, 129;
  
  /* Layout backgrounds */
  --header-bg: rgba(7, 10, 19, 0.8);
  --sidebar-bg: #0b0f19;
  --body-bg: #070a13;
  
  /* Alert Box colors */
  --note-bg: rgba(59, 130, 246, 0.1);
  --note-border: #3b82f6;
  --note-text: #bfdbfe;
  
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: #f59e0b;
  --warning-text: #fde68a;
  
  --tip-bg: rgba(16, 185, 129, 0.1);
  --tip-border: #10b981;
  --tip-text: #a7f3d0;
  
  /* Code blocks styles */
  --code-bg: #0b0f19;
  --code-border: #1e293b;
  --code-text: #f8fafc;
  --code-inline-bg: #1e293b;
  --code-inline-color: #cbd5e1;
  --code-inline-border: #334155;

  /* Navigation */
  --nav-active-bg: rgba(255, 255, 255, 0.05);
  --nav-active-color: #ffffff;
}

/* ── Core Reset ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--body-bg);
  color: var(--mono-700);
  line-height: 1.8;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 !important; /* Override style.css container padding */
  max-width: 100% !important; /* Full width layout */
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--mono-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  margin-bottom: 0 !important; /* Override style.css margin */
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo {
  height: 38px;
  width: auto;
  display: block;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--mono-900);
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

.badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--mono-300);
  color: var(--mono-500);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-subtitle {
  color: var(--mono-500);
  font-size: 0.75rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-right: 1px solid var(--mono-300);
  padding-right: 1.5rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--mono-500);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
  transition: all 0.3s;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--mono-500);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--mono-200);
  color: var(--mono-900);
  transform: translateY(-1px);
}

/* ── Mobile menu toggle ── */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--mono-500);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
}

.mobile-menu-toggle:hover {
  background: var(--mono-200);
  color: var(--mono-900);
}

/* ── Docs Wrapper ── */
.docs-wrapper {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
  margin-top: 0 !important; /* Override style.css margin */
}

/* ── Sidebar ── */
.docs-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--mono-300);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 2rem 0;
  flex-shrink: 0;
  z-index: 99;
}

.sidebar-header {
  display: none; /* Only visible on mobile */
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--mono-300);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--mono-900);
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar-logo img {
  height: 28px;
  width: auto;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--mono-500);
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close:hover {
  background: var(--mono-300);
  color: var(--mono-900);
}

.sidebar-search {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--mono-300);
}

.search-wrapper {
  position: relative;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mono-500);
  font-size: 0.85rem;
}

.search-wrapper input {
  width: 100%;
  padding: 0.6rem 0.6rem 0.6rem 2.2rem;
  background: var(--mono-1000);
  border: 1px solid var(--mono-300);
  border-radius: 8px;
  color: var(--mono-100);
  font-size: 0.85rem;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-wrapper input::placeholder {
  color: var(--mono-500);
}

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

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  padding: 0.25rem 1.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mono-500);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1.5rem 0.4rem 1.75rem;
  color: var(--mono-500);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.nav-link i {
  width: 16px;
  font-size: 0.85rem;
  color: var(--mono-500);
  text-align: center;
}

.nav-link:hover {
  color: var(--mono-600);
  background: var(--mono-300);
}

.nav-link.active {
  color: var(--nav-active-color);
  background: var(--nav-active-bg);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-link.active i {
  color: var(--accent);
}

/* ── Main Content Area ── */
.docs-main {
  flex: 1;
  min-width: 0;
  padding: 3rem 4rem;
  background: var(--body-bg);
}

.docs-content {
  max-width: 780px;
  margin: 0 auto;
}

/* ── Typography & Content Styles ── */
.section-content {
  animation: fadeIn 0.25s ease-out;
}

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

.docs-hero {
  padding: 0 0 3rem;
  border-bottom: 1px solid var(--mono-300);
  margin-bottom: 2.5rem;
}

.docs-hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--mono-800);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.docs-hero .subtitle {
  font-size: 1.15rem;
  color: var(--mono-500);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: var(--mono-1000) !important;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--mono-800);
  border-color: var(--mono-800);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.12);
}

.btn-secondary {
  background: var(--mono-200);
  color: var(--mono-800);
  border: 1px solid var(--mono-300);
}

.btn-secondary:hover {
  background: var(--mono-300);
  transform: translateY(-1px);
}

.section-content h2 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--mono-800);
  margin: 3.5rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--mono-300);
  letter-spacing: -0.025em;
}

.section-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--mono-800);
  margin: 2.25rem 0 0.85rem;
  letter-spacing: -0.015em;
}

.section-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mono-800);
  margin: 1.75rem 0 0.75rem;
}

.section-content p {
  color: var(--mono-700);
  margin-bottom: 1.25rem;
}

.section-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.section-content a:hover {
  border-bottom-color: var(--accent);
}

.section-content ul, .section-content ol {
  color: var(--mono-700);
  margin: 1rem 0 1.5rem 1.5rem;
}

.section-content li {
  margin-bottom: 0.65rem;
}

/* ── Inline Code & Block Code ── */
.section-content code {
  background: var(--code-inline-bg);
  color: var(--code-inline-color);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.88em;
  font-family: 'JetBrains Mono', 'SF Mono', Courier, monospace;
  border: 1px solid var(--code-inline-border);
}

.section-content pre {
  background: var(--code-bg) !important;
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--code-border);
}

.section-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--code-text);
  font-size: 0.85rem;
  line-height: 1.7;
  font-family: 'JetBrains Mono', 'SF Mono', Courier, monospace;
}

/* ── Copy Code Button ── */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.75rem;
  z-index: 10;
}

pre:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: scale(1.05);
}

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

/* ── Alert Boxes ── */
.section-content .note, 
.section-content .warning, 
.section-content .tip {
  border-left: 4px solid;
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.75rem 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.section-content .note {
  background: var(--note-bg);
  border-color: var(--note-border);
  color: var(--note-text);
}

.section-content .warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.section-content .tip {
  background: var(--tip-bg);
  border-color: var(--tip-border);
  color: var(--tip-text);
}

.section-content .note strong,
.section-content .warning strong,
.section-content .tip strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--mono-800);
}

/* ── Table of Contents (TOC) ── */
.docs-toc {
  width: var(--toc-width);
  padding: 3rem 1.5rem;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-left: 1px solid var(--mono-300);
  flex-shrink: 0;
  z-index: 90;
}

.toc-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mono-500);
  font-weight: 700;
  margin-bottom: 1rem;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-left: 1px solid var(--mono-300);
}

.toc-link {
  color: var(--mono-500);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0.3rem 1rem;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: all 0.2s;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-link:hover {
  color: var(--mono-600);
}

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

/* ── Downloads Grid ── */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.download-item {
  background: var(--mono-200);
  border: 1px solid var(--mono-300);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.25s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.download-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.download-item i {
  font-size: 2.2rem;
  color: var(--mono-500);
  margin-bottom: 0.75rem;
  transition: color 0.2s;
}

.download-item:hover i {
  color: var(--accent);
}

.download-item .download-name {
  color: var(--mono-800);
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.25rem;
}

.download-item .download-size {
  color: var(--mono-500);
  font-size: 0.75rem;
  margin-bottom: 1rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--mono-1000) !important;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.download-btn:hover {
  background: var(--mono-800);
  transform: translateY(-1px);
}

/* ── Legal modal overlays ── */
.modal-overlay {
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--body-bg) !important;
  border: 1px solid var(--mono-300) !important;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  border-bottom: 1px solid var(--mono-300) !important;
  background: var(--sidebar-bg);
  padding: 1.25rem 1.5rem !important;
}

.modal-header h3 {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  color: var(--mono-800) !important;
}

.modal-close {
  border-radius: 6px !important;
  border: 1px solid var(--mono-300) !important;
  background: var(--body-bg) !important;
  color: var(--mono-500) !important;
  font-weight: 600 !important;
  padding: 0.4rem 0.8rem !important;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--mono-200) !important;
  color: var(--mono-900) !important;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--mono-300);
  padding: 2rem;
  margin-top: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--mono-500);
}

footer a {
  color: var(--mono-500);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.15s;
}

footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

::-webkit-scrollbar-track {
  background: var(--mono-200);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--mono-400);
}

/* ── Responsive adjustments ── */
@media (max-width: 1200px) {
  .docs-toc {
    display: none;
  }
  .docs-main {
    max-width: 100%;
    padding: 3rem 2.5rem;
  }
}

@media (max-width: 768px) {
  .header-status-group {
    display: none; /* Hide RPC details on small screens */
  }
  
  .mobile-menu-toggle {
    display: block;
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1500;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
  }

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

  .sidebar-header {
    display: flex;
  }

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

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

  .docs-hero .subtitle {
    font-size: 1rem;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }
  
  footer {
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 1rem;
  }
}