/* API 文档样式 - 玻璃态设计 */

.api-docs-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  background: var(--bg-primary, #0a0a0f);
  gap: 1.5rem;
  padding: 0.5rem 0.75rem 0.75rem 0.75rem;
  margin: -20px -20px 0 -20px;
  padding: 1rem;
}

/* 顶部工具栏 */
.docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.625rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  flex-shrink: 0;
}

/* 主内容区 */
.docs-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 侧边栏 */
.docs-sidebar {
  width: 220px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.docs-sidebar.collapsed {
  width: 60px;
  min-width: 60px;
  overflow: visible;
}

.docs-sidebar.collapsed .sidebar-header,
.docs-sidebar.collapsed .sidebar-content {
  display: none;
}

/* 收起状态的展开按钮 */
.collapsed-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding-top: 2rem;
}

.expand-btn {
  width: 40px;
  height: 40px;
  background: rgba(120, 119, 198, 0.2);
  border: 1px solid rgba(120, 119, 198, 0.3);
  border-radius: 8px;
  color: var(--glow-purple, #7877c6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
}

.expand-btn:hover {
  background: rgba(120, 119, 198, 0.3);
  border-color: var(--glow-purple, #7877c6);
  transform: scale(1.05);
}

.expand-btn i {
  font-size: 1.2rem;
}

.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 旧的搜索框样式已迁移到通用组件 admin/css/components/search.css */

/* API测试按钮 - 工具栏版本（参考添加服务器按钮样式） */
.docs-toolbar .api-test-btn {
  padding: 8px 24px;
  background: linear-gradient(135deg, #7877c6 0%, #5b5a9e 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
  height: 37px;
}

.docs-toolbar .api-test-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(120, 119, 198, 0.4);
}

.docs-toolbar .api-test-btn.active {
  box-shadow: 0 0 0 3px rgba(120, 119, 198, 0.3);
}

.docs-toolbar .api-test-btn i {
  font-size: 14px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

/* 滚动条样式 */
.sidebar-content::-webkit-scrollbar,
.docs-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track,
.docs-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-content::-webkit-scrollbar-thumb,
.docs-content::-webkit-scrollbar-thumb {
  background: rgba(120, 119, 198, 0.3);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover,
.docs-content::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 119, 198, 0.5);
}

/* 文档项 */
.doc-section {
  margin-bottom: 0.5rem;
}

.doc-item {
  width: 100%;
  text-align: left;
  padding: 0.625rem 1rem;
  color: var(--text-secondary, #a3a3a3);
  transition: all 0.2s;
  border-left: 3px solid transparent;
  background: transparent;
  font-size: 0.875rem;
}

.doc-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-left-color: rgba(120, 119, 198, 0.5);
}

.doc-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--glow-purple, #7877c6);
  border-left-color: var(--glow-purple, #7877c6);
  font-weight: 600;
}

/* 子章节 */
.doc-subsections {
  padding-left: 2rem;
  margin-top: 0.5rem;
}

.doc-subsection-item {
  display: block;
  padding: 0.375rem 0.875rem;
  color: var(--text-tertiary, #737373);
  font-size: 0.8125rem;
  transition: all 0.2s;
  border-radius: 4px;
  margin-bottom: 0.125rem;
}

.doc-subsection-item:hover {
  color: var(--glow-purple, #7877c6);
  background: rgba(255, 255, 255, 0.05);
}

/* 内容区 */
.docs-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  background: var(--bg-primary, #0a0a0f);
  transition: all 0.3s ease;
}

.docs-content.full-width {
  flex: 1;
}

/* Markdown 渲染样式 */
.markdown-body {
  color: var(--text-secondary, #e5e7eb);
  line-height: 1.7;
  font-size: 1rem;
}

.markdown-body h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary, #fff);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(120, 119, 198, 0.3);
}

.markdown-body h2 {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--text-primary, #fff);
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-body h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-secondary, #d1d5db);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.markdown-body h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary, #9ca3af);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown-body p {
  margin-bottom: 1rem;
  color: var(--text-secondary, #d1d5db);
}

.markdown-body a {
  color: var(--glow-purple, #7877c6);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.markdown-body a:hover {
  border-bottom-color: var(--glow-purple, #7877c6);
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
  color: var(--text-secondary, #d1d5db);
}

.markdown-body li {
  margin-bottom: 0.5rem;
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.05);
  color: #a78bfa;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Fira Code', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.markdown-body pre code {
  background: transparent;
  color: #e5e7eb;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  overflow: hidden;
}

.markdown-body th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #fff);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.markdown-body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary, #d1d5db);
}

.markdown-body tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.markdown-body blockquote {
  border-left: 4px solid var(--glow-purple, #7877c6);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-tertiary, #9ca3af);
  font-style: italic;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 2rem 0;
}

/* API 测试器 */
.api-tester {
  width: 450px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.tester-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tester-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.response-section,
.error-section {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.response-body,
.error-body {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-top: 0.5rem;
}

.response-body code,
.error-body code {
  color: #a78bfa;
  font-family: 'Fira Code', 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* 动画效果 */
.slide-enter-active,
.slide-leave-active {
  transition: all 0.3s ease;
}

.slide-enter-from {
  transform: translateX(100%);
  opacity: 0;
}

.slide-leave-to {
  transform: translateX(100%);
  opacity: 0;
}

/* 响应式设计 */
@media (max-width: 1280px) {
  .api-tester {
    width: 400px;
  }
}

@media (max-width: 1024px) {
  .docs-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
  }
  
  .docs-sidebar.collapsed {
    transform: translateX(-100%);
  }
  
  .api-tester {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
  }
}

/* 代码高亮样式增强 */
.hljs {
  background: transparent !important;
  color: #e5e7eb !important;
}

.hljs-keyword,
.hljs-selector-tag {
  color: #c678dd !important;
}

.hljs-string {
  color: #98c379 !important;
}

.hljs-number {
  color: #d19a66 !important;
}

.hljs-function {
  color: #61afef !important;
}

.hljs-comment {
  color: #5c6370 !important;
  font-style: italic;
}

.hljs-attr {
  color: #d19a66 !important;
}

/* 徽章和标签样式 */
.markdown-body .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
  margin: 0 0.25rem;
}

.markdown-body .badge.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.markdown-body .badge.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.markdown-body .badge.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.markdown-body .badge.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* 搜索结果高亮 */
.search-highlight {
  background: rgba(245, 158, 11, 0.3);
  padding: 0 0.25rem;
  border-radius: 2px;
}
