/* ═══════════════════════════════════════════════
   Documentation & Learn — Terminal Theme
   ═══════════════════════════════════════════════ */

/* ═══ Layout ═══ */
.docs-container {
  display: flex;
  min-height: calc(100vh - 56px);
  padding-top: 56px;
}

/* ═══ Sidebar ═══ */
.docs-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}

.docs-sidebar-inner {
  padding: 16px 0;
}

/* Search */
.docs-search {
  padding: 0 16px 16px;
  position: relative;
}

.docs-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-terminal);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

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

.docs-search input::placeholder {
  color: var(--text-dim);
}

.docs-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  background: var(--bg-terminal);
  border: 1px solid var(--border);
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

.docs-search-results.active {
  display: block;
}

.docs-search-result {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.docs-search-result:hover {
  background: rgba(0, 255, 65, 0.05);
  color: var(--green);
}

.docs-search-result-section {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
}

/* Sidebar sections */
.docs-sidebar-section {
  margin-bottom: 4px;
}

.docs-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-family: var(--font-retro);
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.docs-sidebar-heading:hover {
  color: var(--green);
}

.docs-sidebar-heading .toggle-icon {
  font-size: 12px;
  transition: transform 0.2s;
}

.docs-sidebar-heading.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.docs-sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-sidebar-links.collapsed {
  display: none;
}

.docs-sidebar-links a {
  display: block;
  padding: 4px 16px 4px 24px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.6;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.docs-sidebar-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.docs-sidebar-links a.active {
  color: var(--green);
  border-left-color: var(--green);
  background: rgba(0, 255, 65, 0.04);
}

/* ═══ Main Content ═══ */
.docs-main {
  flex: 1;
  margin-left: 280px;
  padding: 32px 48px 64px;
  max-width: 860px;
  min-width: 0;
}

/* Breadcrumb */
.docs-breadcrumb {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.docs-breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.docs-breadcrumb a:hover {
  color: var(--green);
}

.docs-breadcrumb-sep {
  color: var(--accent);
}

.docs-breadcrumb-current {
  color: var(--text);
}

/* ═══ Article Typography ═══ */
.docs-article {
  line-height: 1.8;
  color: var(--text);
}

.docs-article h1 {
  font-family: var(--font-retro);
  font-size: 36px;
  color: var(--text-bright);
  letter-spacing: 2px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}

.docs-article h2 {
  font-family: var(--font-retro);
  font-size: 28px;
  color: var(--text-bright);
  letter-spacing: 1px;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-article h3 {
  font-family: var(--font-retro);
  font-size: 22px;
  color: var(--text-bright);
  letter-spacing: 1px;
  margin-top: 32px;
  margin-bottom: 12px;
}

.docs-article h4 {
  font-family: var(--font-retro);
  font-size: 18px;
  color: var(--text-bright);
  margin-top: 24px;
  margin-bottom: 8px;
}

.docs-article p {
  margin-bottom: 16px;
  font-size: 14px;
}

.docs-article a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.docs-article a:hover {
  border-bottom-color: var(--green);
}

.docs-article strong {
  color: var(--text-bright);
}

.docs-article ul, .docs-article ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.docs-article li {
  margin-bottom: 6px;
  font-size: 14px;
}

.docs-article li > p {
  margin-bottom: 6px;
}

/* Inline code */
.docs-article code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--amber);
  border: 1px solid var(--border);
}

/* Code blocks */
.docs-article pre {
  background: var(--bg-terminal);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  overflow-x: auto;
  position: relative;
}

.docs-article pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

/* Tables */
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

.docs-article th {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-family: var(--font-retro);
  font-size: 16px;
  color: var(--green);
  letter-spacing: 1px;
}

.docs-article td {
  border: 1px solid var(--border);
  padding: 8px 12px;
}

.docs-article tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Blockquotes */
.docs-article blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin: 16px 0;
  background: rgba(249, 115, 22, 0.05);
  border-radius: 0 4px 4px 0;
}

.docs-article blockquote p:last-child {
  margin-bottom: 0;
}

/* Horizontal rules */
.docs-article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* Definition lists */
.docs-article dt {
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 12px;
}

.docs-article dd {
  margin-left: 16px;
  margin-bottom: 8px;
  color: var(--text-dim);
}

/* ═══ Pagination ═══ */
.docs-pagination {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.docs-pagination-btn {
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.15s;
  max-width: 45%;
}

.docs-pagination-btn:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.docs-pagination-dir {
  font-family: var(--font-retro);
  font-size: 14px;
  color: var(--green);
  letter-spacing: 1px;
}

.docs-pagination-title {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
}

.docs-pagination-next {
  text-align: right;
  margin-left: auto;
}

/* ═══ Mobile sidebar toggle ═══ */
.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font-retro);
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ═══ Nav mobile toggle ═══ */
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ═══ Landing Pages ═══ */
.docs-landing {
  padding: 120px 0 60px;
}

.docs-landing-header {
  text-align: center;
  margin-bottom: 48px;
}

.docs-landing-header .terminal-window {
  max-width: 500px;
  margin: 0 auto;
}

.docs-landing-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 12px;
}

.docs-sections-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.docs-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.docs-section-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 1px;
}

.docs-section-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.docs-section-card:hover::before {
  opacity: 1;
}

.docs-section-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.docs-section-card h2 {
  font-family: var(--font-retro);
  font-size: 22px;
  color: var(--text-bright);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.docs-section-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 12px;
}

.docs-section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.docs-section-count {
  font-size: 12px;
  color: var(--green);
  font-family: var(--font-mono);
}

.docs-section-arrow {
  color: var(--accent);
  font-size: 18px;
}

.docs-landing-cta {
  text-align: center;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.docs-landing-cta p {
  color: var(--text-dim);
  font-size: 14px;
}

.docs-inline-link {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.docs-inline-link:hover {
  border-bottom-color: var(--green);
}

/* ═══ Learn Landing ═══ */
.learn-path {
  max-width: 700px;
  margin: 0 auto 48px;
}

.learn-section {
  margin-bottom: 32px;
}

.learn-section-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.learn-section-number {
  font-family: var(--font-retro);
  font-size: 48px;
  color: var(--accent);
  line-height: 1;
  min-width: 50px;
  text-align: right;
  opacity: 0.8;
}

.learn-section-info h2 {
  font-family: var(--font-retro);
  font-size: 24px;
  color: var(--text-bright);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.learn-section-info p {
  font-size: 13px;
  color: var(--text-dim);
}

.learn-pages {
  margin-left: 66px;
  border-left: 2px solid var(--border);
}

.learn-page-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: all 0.15s;
}

.learn-page-link:hover {
  color: var(--green);
  border-left-color: var(--green);
  background: rgba(0, 255, 65, 0.04);
}

.learn-page-step {
  font-family: var(--font-retro);
  font-size: 16px;
  color: var(--accent);
  min-width: 28px;
}

.learn-page-title {
  flex: 1;
}

.learn-page-arrow {
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.15s;
}

.learn-page-link:hover .learn-page-arrow {
  opacity: 1;
}

/* ═══ Learn Progress ═══ */
.learn-progress {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.learn-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.learn-progress-section {
  font-family: var(--font-retro);
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 1px;
}

.learn-progress-step {
  font-size: 12px;
  color: var(--text-dim);
}

.learn-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.learn-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ═══ Responsive ═══ */
@media (max-width: 1024px) {
  .docs-main {
    padding: 24px 32px 48px;
  }
}

@media (max-width: 768px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

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

  .docs-main {
    margin-left: 0;
    padding: 20px 16px 48px;
  }

  .docs-sidebar-toggle {
    display: block;
  }

  .nav-mobile-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(13, 17, 23, 0.98);
    padding: 16px 24px;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.nav-links-open {
    display: flex;
  }

  .docs-sections-grid {
    grid-template-columns: 1fr;
  }

  .docs-pagination {
    flex-direction: column;
  }

  .docs-pagination-btn {
    max-width: 100%;
  }

  .docs-article h1 {
    font-size: 28px;
  }

  .docs-article h2 {
    font-size: 22px;
  }

  .learn-pages {
    margin-left: 32px;
  }

  .learn-section-number {
    font-size: 36px;
    min-width: 36px;
  }
}

@media (max-width: 480px) {
  .docs-article pre code {
    font-size: 11px;
  }

  .docs-landing {
    padding: 80px 0 40px;
  }
}
