/* ═══════════════════════════════════════════
   OCR Forge — API Documentation Styles
   ═══════════════════════════════════════════ */

/* ─── Layout ─────────────────────────────── */
.docs-body {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

.docs-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1rem;
  align-items: center;
  gap: 0.75rem;
}

.docs-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--gray-600);
  display: flex;
  align-items: center;
}

.docs-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* ─── Sidebar ────────────────────────────── */
.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.docs-sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.docs-version {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.docs-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.docs-nav-section {
  margin-bottom: 0.5rem;
}

.docs-nav-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  padding: 0.75rem 1.5rem 0.25rem;
}

.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.docs-nav-link:hover {
  color: var(--gray-900);
  background: var(--gray-50);
}

.docs-nav-link.active {
  color: var(--primary);
  font-weight: 500;
  border-left-color: var(--primary);
  background: var(--primary-bg);
}

.method-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.method-dot-post { background: var(--green); }
.method-dot-get { background: var(--blue); }

.docs-sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-500);
  text-decoration: none;
}

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

.docs-status-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-500);
  text-decoration: none;
}

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

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-status 2s infinite;
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Overlay (mobile) ───────────────────── */
.docs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}

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

/* ─── Main Content ───────────────────────── */
.docs-main {
  margin-left: 280px;
  flex: 1;
  min-width: 0;
}

.docs-content {
  max-width: 850px;
  margin: 0 auto;
  padding: 2rem 2.5rem 4rem;
}

/* ─── Section Styling ────────────────────── */
.docs-section {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--gray-200);
}

.docs-section:last-child {
  border-bottom: none;
}

.docs-section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.docs-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.docs-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.docs-section p {
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

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

.docs-lead {
  font-size: 1.15rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.docs-list {
  list-style: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.docs-list li {
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 0.25rem;
}

/* ─── Endpoint Header ────────────────────── */
.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gray-200);
}

.method-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.025em;
  flex-shrink: 0;
}

.method-post {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.method-get {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
}

/* ─── Tables ─────────────────────────────── */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.docs-table th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}

.docs-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.docs-table td code {
  font-family: var(--font-mono);
  font-size: 0.825rem;
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: var(--gray-800);
}

.docs-table tbody tr:hover {
  background: var(--gray-50);
}

/* ─── Inline Code ────────────────────────── */
.docs-inline-code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: var(--gray-800);
}

/* ─── Code Windows ───────────────────────── */
.docs-section .code-window {
  margin: 1rem 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.docs-section .code-header {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.code-copy-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

/* ─── Info / Warning Boxes ───────────────── */
.docs-info-box {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-left: 3px solid var(--blue);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.docs-info-box strong {
  color: var(--gray-800);
}

.docs-info-box code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(59, 130, 246, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.docs-warning-box {
  background: rgba(234, 179, 8, 0.05);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-left: 3px solid var(--yellow);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.docs-warning-box strong {
  color: var(--gray-800);
}

.docs-warning-box code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(234, 179, 8, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

/* ─── Download Buttons ───────────────────── */
.docs-download-group {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.docs-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
  background: var(--primary);
  color: #fff;
}

.docs-download-btn:hover {
  opacity: 0.9;
  color: #fff;
}

.docs-download-btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.docs-download-btn-secondary:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 768px) {
  .docs-mobile-header {
    display: flex;
  }

  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 300px;
    z-index: 200;
  }

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

  .docs-main {
    margin-left: 0;
    padding-top: 60px;
  }

  .docs-content {
    padding: 1.5rem 1rem 3rem;
  }

  .docs-section h1 {
    font-size: 1.4rem;
  }

  .docs-section h2 {
    font-size: 1.1rem;
  }

  .endpoint-header {
    flex-wrap: wrap;
  }

  .endpoint-path {
    font-size: 0.9rem;
  }

  .docs-table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .docs-sidebar {
    width: 240px;
  }

  .docs-main {
    margin-left: 240px;
  }
}

/* ─── Scrollbar ──────────────────────────── */
.docs-sidebar::-webkit-scrollbar {
  width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--gray-300);
}

/* ─── Print ──────────────────────────────── */
@media print {
  .docs-sidebar,
  .docs-mobile-header,
  .code-copy-btn {
    display: none !important;
  }

  .docs-main {
    margin-left: 0;
  }

  .docs-section {
    break-inside: avoid;
  }
}
