/* aidb.live 通用样式 */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-bg: #f9fafb;
  --color-white: #ffffff;
  --font-sans: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 汉堡菜单按钮 - 仅移动端显示 */
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  gap: 8px;
  flex-shrink: 0;
}

.logo img {
  height: 32px;
  width: 32px;
  object-fit: cover;
  border-radius: 8px;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo-ai {
  color: #1e3a8a;
}

.logo-db {
  color: #f97316;
}

.main-nav {
  display: flex;
  gap: 24px;
}

.main-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--color-primary);
}

/* 左侧抽屉导航 - 移动端 */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
}

.drawer-overlay.open {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  max-width: 85vw;
  height: 100vh;
  background: var(--color-white);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-header .logo {
  font-size: 1.2rem;
}

.drawer-nav {
  padding: 16px 0;
}

.drawer-nav a {
  display: block;
  padding: 14px 24px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
}

.drawer-nav a:hover,
.drawer-nav a.active {
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.06);
}

@media (max-width: 900px) {
  .menu-toggle {
    display: flex !important;
  }

  .main-nav {
    display: none;
  }

  .site-header {
    padding: 0 16px;
  }

  .header-inner .logo {
    flex: 1;
    text-align: center;
  }

  .drawer-overlay {
    display: block;
    pointer-events: none;
  }

  .drawer-overlay.open {
    pointer-events: auto;
  }
}

/* 通用内容区宽度（与 market 一致） */
.page-main {
  flex: 1;
}

.page-inner {
  max-width: 1400px;
  margin: 0 auto;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 24px;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.footer-inner p+p {
  margin-top: 8px;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

.footer-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--color-primary);
}

.footer-legal {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.footer-legal a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: color 0.2s;
}

.footer-legal a:hover {
  color: var(--color-primary);
}

.icp-beian {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.icp-beian a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.icp-beian a:hover {
  color: var(--color-primary);
}

/* Search clear button */
.search-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 4px;
  border: none;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.search-clear-btn:hover {
  background: #d1d5db;
  color: #374151;
}

/* Shared pagination used by wiki, news, and other SSR pages */
.wiki-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.wiki-pagination a,
.wiki-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: var(--color-white);
}
.wiki-pagination a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(37, 99, 235, .06);
}
.wiki-pagination .current {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  cursor: default;
}
.wiki-pagination .disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}
.wiki-pagination .pagination-info {
  margin-left: 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.wiki-pagination .pagination-ellipsis {
  border: none;
  background: transparent;
  min-width: auto;
  color: var(--color-text-muted);
  cursor: default;
}

/* Shared breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}
.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--color-primary);
}
.breadcrumb .sep {
  color: var(--color-border);
}
.breadcrumb .current {
  color: var(--color-text);
}

/* HTMX loading feedback — non-blocking */
[hx-boost].htmx-request {
  opacity: 0.45;
  transition: opacity 0.15s;
}
[hx-boost].htmx-request::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4f46e5, #06b6d4, #4f46e5);
  background-size: 200% 100%;
  animation: htmx-loadbar 0.8s linear infinite;
  z-index: 9999;
  pointer-events: none;
}
@keyframes htmx-loadbar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}