/* ════════════════════════════════════════════════════════════
   IRONNODE — Documentation Stylesheet
   css/docs.css
   ════════════════════════════════════════════════════════════ */

/* Docs Body Layout */
.docs-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-base);
}

/* ── Docs Header ────────────────────────────────────────────── */
#docsHeader {
  height: 72px;
  background: rgba(2, 4, 8, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.docs-header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 32px;
  max-width: 1600px;
  margin: 0 auto;
}

.logo-sub {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: var(--primary-dim);
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
  vertical-align: middle;
}

/* Hamburger button in docs */
.docs-hamburger {
  display: none;
}

/* ── Docs Layout Container ───────────────────────────────────── */
.docs-layout-container {
  display: flex;
  height: calc(100vh - 72px);
  margin-top: 72px;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Left Sidebar (Navigation) ───────────────────────────────── */
.docs-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: rgba(8, 13, 24, 0.5);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  z-index: 90;
}

.sidebar-search {
  padding: 20px 24px 15px;
  position: sticky;
  top: 0;
  background: rgba(2, 4, 8, 0.8);
  backdrop-filter: blur(10px);
  z-index: 2;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  transition: all var(--trans-base);
}

.search-input-wrap:focus-within {
  border-color: var(--primary);
  background: rgba(0, 212, 255, 0.02);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}

.search-input-wrap svg {
  flex-shrink: 0;
}

.search-input-wrap input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  width: 100%;
}

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

.sidebar-nav {
  padding: 10px 24px 30px;
  flex: 1;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-left: 12px;
}

.sidebar-link {
  display: block;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all var(--trans-fast);
  margin-bottom: 2px;
}

.sidebar-link:hover {
  color: var(--primary);
  background: rgba(0, 212, 255, 0.04);
}

.sidebar-link.active {
  color: var(--primary);
  background: rgba(0, 212, 255, 0.08);
  font-weight: 600;
  border-left: 2px solid var(--primary);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.sidebar-link.filtered-out {
  display: none;
}

/* ── Content Wrapper ────────────────────────────────────────── */
.docs-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 40px 60px;
  height: 100%;
}

.docs-content-inner {
  max-width: 820px;
  margin: 0 auto;
  padding-bottom: 80px;
}

/* Breadcrumbs */
.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.crumb-separator {
  user-select: none;
}

.crumb.active {
  color: var(--primary);
}

/* Content Typography styling */
.doc-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.doc-section.active {
  display: block;
}

.doc-section h3 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.doc-section h4 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 36px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.doc-section p {
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

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

.doc-section ul, .doc-section ol {
  margin-bottom: 24px;
  padding-left: 20px;
  color: var(--text-secondary);
}

.doc-section li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.doc-section code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--secondary);
}

/* Alert Callouts */
.info-box, .warning-box {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 10px;
  margin: 24px 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.info-box {
  background: rgba(0, 212, 255, 0.04);
  border: 1px solid rgba(0, 212, 255, 0.15);
  color: var(--text-secondary);
}

.info-box-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.warning-box {
  background: rgba(255, 51, 102, 0.04);
  border: 1px solid rgba(255, 51, 102, 0.15);
  color: var(--text-secondary);
}

.warning-box-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Step lists for tutorial */
.step-list {
  list-style: none;
  padding-left: 0 !important;
}

.step-list li {
  position: relative;
  padding-left: 36px;
  margin-bottom: 16px;
}

.step-list li::before {
  content: counter(section);
  counter-increment: section;
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  background: var(--primary-dim);
  border: 1px solid var(--border);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.step-list {
  counter-reset: section;
}

/* Code Blocks */
.code-block-wrapper {
  background: rgba(2, 8, 16, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 24px 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(0, 212, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.copy-code-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
  transition: all var(--trans-fast);
}

.copy-code-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(0, 212, 255, 0.05);
}

.copy-code-btn.copied {
  color: var(--secondary);
  border-color: var(--secondary);
  background: rgba(0, 255, 136, 0.05);
}

.code-block-wrapper pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
}

.code-block-wrapper code {
  background: transparent;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  margin: 24px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: rgba(0, 0, 0, 0.3);
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-card);
  font-family: var(--font-display);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 4px;
}

.badge-success { background: rgba(0, 255, 136, 0.1); color: var(--secondary); border: 1px solid rgba(0, 255, 136, 0.2); }
.badge-warning { background: rgba(255, 215, 0, 0.08); color: var(--accent-yellow); border: 1px solid rgba(255, 215, 0, 0.2); }
.badge-orange { background: rgba(255, 140, 66, 0.08); color: var(--accent-orange); border: 1px solid rgba(255, 140, 66, 0.2); }
.badge-danger { background: rgba(255, 51, 102, 0.1); color: var(--accent-red); border: 1px solid rgba(255, 51, 102, 0.2); }
.badge-info { background: rgba(0, 212, 255, 0.1); color: var(--primary); border: 1px solid rgba(0, 212, 255, 0.2); }

/* Docs Footer */
.docs-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border-card);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Right Sidebar (Table of Contents) ───────────────────────── */
.docs-toc {
  width: 220px;
  flex-shrink: 0;
  padding: 40px 24px;
  border-left: 1px solid var(--border);
  background: rgba(2, 4, 8, 0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.toc-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

#tocList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-link {
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: color var(--trans-fast);
  line-height: 1.4;
}

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

.toc-link.active {
  color: var(--primary);
  font-weight: 500;
}

.toc-link-h4 {
  padding-left: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Mobile Menu Overlay ─────────────────────────────────────── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans-base) ease;
  z-index: 85;
}

.mobile-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive Styling ──────────────────────────────────────── */
@media (max-width: 1200px) {
  .docs-toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .docs-hamburger {
    display: flex;
  }

  .docs-sidebar {
    position: fixed;
    top: 72px;
    left: -280px;
    bottom: 0;
    background: rgba(2, 4, 8, 0.98);
    backdrop-filter: blur(20px);
    transition: transform var(--trans-spring);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }

  .docs-sidebar.open {
    transform: translateX(280px);
  }

  .docs-content-wrapper {
    padding: 30px 24px;
  }
}
