/* ==========================================================================
   JSango Documentation Stylesheet (docs.css)
   ========================================================================== */

.docs-body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
}

.docs-navbar {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(6, 9, 17, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.docs-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  gap: 16px;
}

.docs-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.docs-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.docs-logo .logo-text {
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.docs-sidebar-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.docs-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-indigo);
}

.docs-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 480px;
  margin: 0 16px;
}

.docs-search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.docs-search-wrapper input {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 36px 9px 36px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.docs-search-wrapper input:focus {
  border-color: var(--accent-indigo);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

.search-kbd {
  position: absolute;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  pointer-events: none;
}

.docs-search-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  position: absolute;
  right: 12px;
  transition: var(--transition);
}

.docs-search-close-btn:hover {
  color: var(--text-primary);
}

.docs-mobile-search-btn {
  display: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.docs-mobile-search-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-indigo);
}

.docs-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Docs 3-Column Layout */
.docs-layout {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  min-height: calc(100vh - 72px);
}

/* Left Sidebar */
.docs-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 32px 20px 48px;
  border-right: 1px solid var(--border-subtle);
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

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

.sidebar-heading {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border-left: 2px solid transparent;
}

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

.sidebar-link.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border-left-color: #38bdf8;
  font-weight: 600;
}

/* Main Content Area */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 36px 48px 80px;
  max-width: 860px;
}

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

.docs-breadcrumbs .sep {
  opacity: 0.5;
}

.docs-breadcrumbs .active-crumb {
  color: var(--accent-emerald);
  font-weight: 600;
}

.doc-section {
  padding-top: 10px;
  margin-bottom: 40px;
}

.doc-section h1 {
  font-family: var(--font-sans);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.doc-section h2 {
  font-family: var(--font-sans);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

.doc-section h3 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 24px 0 12px;
  color: #e2e8f0;
}

.lead-text {
  font-size: 1.15rem;
  color: #cbd5e1;
  line-height: 1.7;
  margin-bottom: 24px;
}

.doc-section p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
  font-size: 0.96rem;
}

.doc-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 48px 0;
}

/* Callout Alerts */
.callout {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  margin: 24px 0;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
}

.callout-tip {
  border-left: 4px solid var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.callout-warn {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.callout-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.callout-body {
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Principle Cards Grid */
.principle-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.p-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.p-card h4 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #38bdf8;
}

.p-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Code Box */
.code-box {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin: 20px 0 28px;
  overflow: hidden;
}

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

.copy-code-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.code-box pre {
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
}

/* CLI Reference Table */
.cli-table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
}

.cli-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.cli-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.cli-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cli-table td code {
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Docs Nav Footer */
.docs-nav-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
}

.doc-nav-btn {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  flex: 1;
  transition: var(--transition);
}

.doc-nav-btn:hover {
  border-color: var(--accent-indigo);
  background: rgba(30, 41, 59, 0.8);
  transform: translateY(-2px);
}

.doc-nav-btn .sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.doc-nav-btn .title {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.doc-nav-btn.next {
  text-align: right;
}

/* Right Table of Contents */
.docs-toc {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 36px 20px 48px;
}

.toc-heading {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.toc-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  transition: var(--transition);
  display: block;
}

.toc-link:hover, .toc-link.active {
  color: #34d399;
}

/* Mobile Sidebar Backdrop */
.docs-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 89;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.docs-sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Responsive Rules for Docs */
@media (max-width: 1180px) {
  .docs-toc {
    display: none;
  }
  .docs-content {
    max-width: 100%;
  }
}

@media (max-width: 860px) {
  .docs-nav-container {
    padding: 0 16px;
    height: 60px;
    gap: 10px;
  }

  .docs-nav-left {
    gap: 10px;
  }

  .docs-logo .brand-badge {
    display: none;
  }

  .docs-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
  }

  .docs-mobile-search-btn {
    display: flex;
    flex-shrink: 0;
  }

  /* Default on mobile/tablet: inline search wrapper is hidden until opened */
  .docs-search-wrapper {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 16px;
    background: rgba(6, 9, 17, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 110;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
  }

  .docs-search-wrapper.mobile-active {
    display: flex;
    animation: fadeIn 0.15s ease;
  }

  .docs-search-wrapper input {
    height: 42px;
    font-size: 0.9rem;
    padding: 8px 42px 8px 38px;
    background: rgba(15, 23, 42, 0.95);
  }

  .docs-search-wrapper .search-icon {
    left: 28px;
  }

  .docs-search-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    right: 26px;
  }

  .search-kbd {
    display: none;
  }

  .docs-nav-actions {
    gap: 8px;
  }

  .github-text {
    display: none;
  }

  .docs-home-link {
    font-size: 0.85rem;
    margin-right: 0 !important;
  }

  .btn-icon {
    padding: 7px 10px;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .docs-sidebar {
    position: fixed;
    top: 60px;
    left: -300px;
    width: 280px;
    height: calc(100vh - 60px);
    background: rgba(11, 17, 32, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-subtle);
    z-index: 95;
    padding: 20px 16px 40px;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .docs-sidebar.open {
    left: 0;
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.9);
  }

  .docs-content {
    padding: 16px 14px 48px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .docs-content h2 {
    font-size: 1.45rem;
  }

  .docs-content h3 {
    font-size: 1.15rem;
  }

  .principle-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .code-block-wrapper {
    margin: 14px 0;
    border-radius: var(--radius-md);
  }

  .code-header {
    padding: 8px 12px;
  }

  .code-block-wrapper pre {
    padding: 14px 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .cli-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 12px 0;
  }

  .cli-table {
    min-width: 480px;
  }

  .docs-nav-footer {
    flex-direction: column;
    gap: 10px;
    margin-top: 36px;
    padding-top: 20px;
  }

  .doc-nav-btn {
    width: 100%;
  }

  .doc-nav-btn.next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .docs-nav-container {
    padding: 0 10px;
    height: 56px;
    gap: 6px;
  }

  .docs-nav-left {
    gap: 8px;
  }

  .docs-sidebar-toggle {
    width: 32px;
    height: 32px;
  }

  .docs-logo {
    gap: 6px;
  }

  .docs-logo .logo-img {
    width: 26px;
    height: 26px;
  }

  .docs-logo .logo-text {
    font-size: 1.12rem;
  }

  .docs-mobile-search-btn {
    width: 32px;
    height: 32px;
  }

  .docs-home-link {
    font-size: 0.8rem;
    padding: 2px 4px;
  }

  .btn-icon {
    padding: 6px 8px;
  }

  .btn-icon svg {
    width: 16px;
    height: 16px;
  }

  .docs-content {
    padding: 14px 10px 40px;
  }
}

@media (max-width: 360px) {
  .docs-home-link {
    display: none;
  }
}

