/* 极简现代风格主色调 */
:root {
  --main-bg: #fff;
  --main-color: #3b82f6;
  --main-color-dark: #6366f1;
  --main-gradient: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%);
  --card-radius: 18px;
  --card-shadow: 0 2px 16px 0 rgba(60,72,100,0.07);
  --sidebar-width: 220px;
  --sidebar-bg: #fff;
  --sidebar-active: #e0e7ff;
  --sidebar-hover: #f1f5f9;
  --font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}

body {
  background: var(--main-bg);
  font-family: var(--font-family);
  color: #222;
  font-size: 17px;
  line-height: 1.7;
}

/* 顶部导航栏 */
.navbar {
  background: var(--main-bg);
  box-shadow: 0 2px 8px 0 rgba(60,72,100,0.04);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  border-bottom: 1px solid #f1f5f9;
}
.navbar-brand {
  font-weight: bold;
  font-size: 1.3rem;
  color: var(--main-color);
  letter-spacing: 1px;
}
.navbar .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--main-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-left: 18px;
}

/* 侧边栏 */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid #f1f5f9;
  min-height: 100vh;
  padding-top: 16px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: all 0.2s;
}
#sidebar .components {
  list-style: none;
  padding: 0;
  margin: 0;
}
#sidebar .components li {
  margin-bottom: 6px;
}
#sidebar .components li a {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  border-radius: 10px;
  color: #222;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
#sidebar .components li.active a,
#sidebar .components li a:active {
  background: var(--sidebar-active);
  color: var(--main-color);
}
#sidebar .components li a:hover {
  background: var(--sidebar-hover);
  color: var(--main-color-dark);
}
#sidebar .components li i {
  margin-right: 12px;
  font-size: 1.2em;
}

/* 主内容区 */
#main-content {
  margin-left: var(--sidebar-width);
  padding: 32px 32px 32px 32px;
  min-height: 100vh;
  background: var(--main-bg);
  transition: margin 0.2s;
}

/* 卡片 */
.card {
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: none;
  background: #fff;
  margin-bottom: 32px;
}
.card-header {
  background: transparent;
  border-bottom: none;
  padding: 24px 24px 0 24px;
}
.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #222;
}
.card-body {
  padding: 24px;
}

/* 表格 */
.table {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 0;
}
.table th, .table td {
  border: none;
  padding: 16px 12px;
  font-size: 0.95rem;
  vertical-align: middle;
}
.table thead th {
  background: #f8fafc;
  color: #555;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table-hover tbody tr:hover {
  background: #f1f5f9;
}
.table tbody tr {
  border-bottom: 1px solid #f1f5f9;
}
.table tbody tr:last-child {
  border-bottom: none;
}

/* 按钮组 */
.btn-group {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  padding: 6px 12px;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.btn-group .btn:first-child {
  border-radius: 8px 0 0 8px;
}
.btn-group .btn:last-child {
  border-radius: 0 8px 8px 0;
}
.btn-group .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 徽章样式 */
.badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
}
.badge.bg-success {
  background-color: #10b981 !important;
}
.badge.bg-secondary {
  background-color: #6b7280 !important;
}
.badge.bg-info {
  background-color: #3b82f6 !important;
}

/* 代码样式 */
code {
  background: #f1f5f9;
  color: #374151;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 按钮 */
.btn {
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  padding: 8px 22px;
  transition: box-shadow 0.15s, background 0.15s;
  border: none;
}
.btn-primary {
  background: var(--main-gradient);
  color: #fff;
  box-shadow: 0 2px 8px 0 rgba(59,130,246,0.08);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(90deg, #6366f1 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 4px 16px 0 rgba(59,130,246,0.13);
}
.btn-outline-primary {
  border: 1.5px solid var(--main-color);
  color: var(--main-color);
  background: #fff;
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
  background: var(--main-gradient);
  color: #fff;
  border: 1.5px solid var(--main-color-dark);
}

/* 输入框 */
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  font-size: 1rem;
  padding: 10px 14px;
  background: #f8fafc;
  transition: border 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 0 2px #e0e7ff;
  background: #fff;
}

/* 模态框 */
.modal-content {
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  border: none;
}

/* ========== 代码演示区块美化 ========== */
.api-demo {
  background: #23272e;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(37,99,235,0.08);
  padding: 0;
  position: relative;
}
.api-demo pre {
  background: none;
  color: #fff;
  border-radius: 0 0 14px 14px;
  margin: 0;
  padding: 22px 20px 18px 20px;
  font-size: 1.08rem;
  font-family: 'Fira Mono', 'Menlo', 'Consolas', monospace;
  overflow-x: auto;
  border: none;
}
.api-demo code {
  background: none;
  color: inherit;
  font-size: 1.08rem;
  font-family: inherit;
  padding: 0;
  border-radius: 0;
}
.api-demo .copy-btn, #copy-demo-btn {
  background: #fff;
  color: #23272e;
  border: none;
  border-radius: 8px;
  padding: 6px 14px 6px 10px;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 1px 6px rgba(37,99,235,0.10);
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.api-demo .copy-btn:hover, #copy-demo-btn:hover {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 12px rgba(37,99,235,0.18);
}
.api-demo .copy-btn svg, #copy-demo-btn i {
  font-size: 1.1em;
}
.api-demo-header, .card-section .card-header.d-flex {
  background: linear-gradient(90deg,#2563eb 60%,#60a5fa 100%);
  color: #fff;
  border-radius: 14px 14px 0 0;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 16px 20px 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.api-demo-tabs {
  display: flex;
  gap: 8px;
}
.api-demo-tabs .tab, #demo-model, #demo-lang {
  background: none;
  border: none;
  color: #e0e7ef;
  padding: 5px 18px;
  border-radius: 8px;
  margin-right: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  transition: background 0.2s, color 0.2s;
}
.api-demo-tabs .tab.active, #demo-model:focus, #demo-lang:focus, #demo-model option:checked, #demo-lang option:checked {
  background: #2563eb;
  color: #fff;
}
.api-demo-tabs .tab:hover, #demo-model:hover, #demo-lang:hover {
  background: #3b82f6;
  color: #fff;
}
@media (max-width: 600px) {
  .api-demo pre { padding: 14px 6px 12px 6px; font-size: 0.98rem; }
  .api-demo .copy-btn, #copy-demo-btn { top: 8px; right: 8px; padding: 5px 10px 5px 8px; font-size: 0.95rem; }
  .api-demo-header, .card-section .card-header.d-flex { padding: 10px 8px 8px 8px; font-size: 0.98rem; }
}

/* 编辑器风格代码区块 */
.code-editor-frame {
  background: #23272e;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(37,99,235,0.10);
  padding: 0;
  position: relative;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
}
.code-editor-frame::before {
  content: '';
  display: block;
  height: 36px;
  background: #22262e;
  border-radius: 14px 14px 0 0;
  position: absolute;
  left: 0; top: 0; right: 0;
  z-index: 1;
}
.code-editor-frame .editor-dots {
  position: absolute;
  left: 18px;
  top: 12px;
  z-index: 2;
  display: flex;
  gap: 7px;
}
.code-editor-frame .editor-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.code-editor-frame .editor-dot.red { background: #ff5f56; }
.code-editor-frame .editor-dot.yellow { background: #ffbd2e; }
.code-editor-frame .editor-dot.green { background: #27c93f; }
.code-editor-frame pre {
  background: none;
  color: #fff;
  border-radius: 0 0 14px 14px;
  margin: 0;
  padding: 38px 22px 20px 22px;
  font-size: 1.08rem;
  font-family: 'Fira Mono', 'Menlo', 'Consolas', monospace;
  overflow-x: auto;
  border: none;
  min-height: 180px;
  position: relative;
  z-index: 2;
}
.code-editor-frame code {
  background: none;
  color: inherit;
  font-size: 1.08rem;
  font-family: inherit;
  padding: 0;
  border-radius: 0;
}
.api-demo-select {
  border: 1.5px solid #2563eb;
  border-radius: 8px;
  padding: 6px 18px;
  font-size: 1rem;
  color: #23272e;
  background: #fff;
  font-weight: 500;
  margin-left: 18px;
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
  box-shadow: none;
}
.api-demo-select:focus, .api-demo-select:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px #2563eb22;
}
.api-demo .copy-btn, #copy-demo-btn {
  background: #fff;
  color: #23272e;
  border: 1.5px solid #2563eb;
  border-radius: 8px;
  padding: 6px 14px 6px 10px;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 1px 6px rgba(37,99,235,0.10);
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, border 0.18s;
}
.api-demo .copy-btn:hover, #copy-demo-btn:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 2px 12px rgba(37,99,235,0.18);
}
.api-demo .copy-btn svg, #copy-demo-btn svg {
  font-size: 1.1em;
}
@media (max-width: 600px) {
  .code-editor-frame pre { padding: 32px 6px 12px 6px; font-size: 0.98rem; }
  .api-demo .copy-btn, #copy-demo-btn { top: 10px; right: 8px; padding: 5px 10px 5px 8px; font-size: 0.95rem; }
}

/* 响应式 */
@media (max-width: 900px) {
  #sidebar {
    width: 60px;
    min-width: 60px;
    padding: 8px 0;
  }
  #sidebar .components li a {
    justify-content: center;
    padding: 12px 0;
  }
  #sidebar .components li a span {
    display: none;
  }
  #main-content {
    margin-left: 60px;
    padding: 18px 8px 18px 8px;
  }
}
@media (max-width: 600px) {
  .navbar {
    padding: 0 8px;
    height: 48px;
  }
  #main-content {
    padding: 8px 2px;
  }
}

/* 其它细节优化 */
::-webkit-scrollbar {
  width: 8px;
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #e0e7ff;
  border-radius: 8px;
}

.api-demo-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 600px) {
  .api-demo-controls { flex-direction: column; gap: 8px; }
}