/* ============================================
   iAgentMart — Documentation Page
   ============================================ */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--nav-height));
  padding-top: var(--nav-height);
}

/* --- Sidebar --- */
.docs-sidebar {
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  padding: var(--space-8) var(--space-6);
  border-right: 1px solid var(--color-border-light);
  background: var(--color-surface);
}

.docs-sidebar::-webkit-scrollbar {
  width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.docs-sidebar__group {
  margin-bottom: var(--space-6);
}

.docs-sidebar__heading {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.docs-sidebar__link {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  border-left: 2px solid transparent;
}

.docs-sidebar__link:hover {
  color: var(--color-text);
  background: var(--color-surface-raised);
}

.docs-sidebar__link--active {
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-left-color: var(--color-primary);
  font-weight: var(--weight-medium);
}

/* --- Main content --- */
.docs-content {
  padding: var(--space-10) var(--space-12);
  max-width: 840px;
}

.docs-content h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
}

.docs-content h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
}

.docs-content h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.docs-content p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

.docs-content ul,
.docs-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

.docs-content ul {
  list-style: disc;
}

.docs-content ol {
  list-style: decimal;
}

.docs-content li {
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
}

.docs-content pre {
  margin-bottom: var(--space-6);
}

.docs-content code {
  font-size: 0.875em;
}

.docs-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-content a:hover {
  color: var(--color-primary-hover);
}

/* --- API endpoint block --- */
.api-endpoint {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.api-method {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.api-method--get {
  background: #DBEAFE;
  color: #1D4ED8;
}

.api-method--post {
  background: #DCFCE7;
  color: #15803D;
}

.api-method--patch {
  background: #FEF3C7;
  color: #B45309;
}

.api-method--delete {
  background: #FEE2E2;
  color: #B91C1C;
}

.api-path {
  color: var(--color-text);
}

/* --- Callout / tip boxes --- */
.docs-callout {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  border-left: 3px solid;
}

.docs-callout--info {
  background: #EFF6FF;
  border-left-color: #3B82F6;
  color: #1E40AF;
}

.docs-callout--warning {
  background: #FFFBEB;
  border-left-color: #F59E0B;
  color: #92400E;
}

.docs-callout--tip {
  background: #ECFDF5;
  border-left-color: #10B981;
  color: #065F46;
}

.docs-callout__title {
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

/* --- Docs table --- */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.docs-table th {
  text-align: left;
  font-weight: var(--weight-semibold);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text);
}

.docs-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
}

.docs-table tr:hover td {
  background: var(--color-surface-raised);
}

/* --- Mobile sidebar toggle --- */
.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: fixed;
    left: -300px;
    top: var(--nav-height);
    width: 280px;
    z-index: 100;
    transition: left var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-xl);
  }

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

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

  .docs-content {
    padding: var(--space-6) var(--space-4);
  }

  .docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--nav-height);
    background: rgba(0,0,0,0.3);
    z-index: 99;
  }

  .docs-sidebar-overlay--visible {
    display: block;
  }
}
