/* 极点 · 最终完美打磨
   统一视觉语言、微交互、间距、字体层次 */

/* ===== 全局基础完美化 ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --accent: #f97316;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.1);
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "Inter", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

/* ===== 统一按钮系统 ===== */
.btn, button.btn, .pill {
  border-radius: 10px !important;
  font-weight: 550 !important;
  transition: var(--transition) !important;
  letter-spacing: 0.01em !important;
}

.btn:active, button:active {
  transform: scale(0.98) !important;
}

.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
}

.primary:hover {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35) !important;
  transform: translateY(-1px) !important;
}

/* ===== 统一卡片系统 ===== */
.card, .topic, .qy-function-card, .sidebar-card, 
.of-product-card, .of-card, .product-card {
  border-radius: var(--radius) !important;
  transition: var(--transition) !important;
}

.card:hover, .topic:hover, .of-product-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: var(--shadow-md) !important;
}

/* ===== 统一圆角与阴影 ===== */
.modal, .drawer, .panel, .of-docs-grid article,
.qy-support-box, .sf-inspector, .sf-editor-tools {
  border-radius: var(--radius-lg) !important;
}

/* ===== 导航完美化 ===== */
.nav, .sf-nav, .of-nav {
  transition: box-shadow 0.3s ease !important;
}

.nav:hover, .sf-nav:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.04) !important;
}

/* ===== 表单完美化 ===== */
input, select, textarea {
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

/* ===== 链接与交互 ===== */
a, button {
  transition: var(--transition) !important;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== 选中文字 ===== */
::selection {
  background: rgba(37, 99, 235, 0.15);
  color: var(--text);
}

/* ===== 加载与空状态统一 ===== */
.loading, .empty, .of-empty {
  animation: fadeIn 0.3s ease !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ===== 图片圆角统一 ===== */
img, .cover, .avatar {
  border-radius: inherit;
}

.cover {
  border-radius: 0 !important;
}

/* ===== 分区标题统一 ===== */
.section-head h2::before,
.of-head h1::before {
  border-radius: 2px !important;
}

/* ===== 侧边工具栏完美定位 ===== */
.qy-side-dock {
  transition: transform 0.3s ease !important;
}

.qy-side-dock:hover {
  transform: translateX(-2px) !important;
}

/* ===== 微交互增强 ===== */
.topic:active, .card:active, .of-product-card:active {
  transform: translateY(-1px) scale(0.995) !important;
}

/* ===== 移动端完美适配 ===== */
@media (max-width: 768px) {
  body {
    font-size: 15px !important;
  }
  
  .container, .of-main {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  .btn, .primary {
    min-height: 44px !important;
  }
  
  .nav, .sf-nav {
    height: 56px !important;
  }
  
  .qy-side-dock {
    right: 10px !important;
    bottom: 70px !important;
  }
  
  .qy-dock-btn {
    width: 46px !important;
    height: 46px !important;
  }
}

/* ===== 深色模式完美统一 ===== */
.dark {
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --bg: #0f172a;
  --card: #1e293b;
  --border: #334155;
}

.dark body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

.dark .nav, .dark .sf-nav {
  background: rgba(15, 23, 42, 0.9) !important;
  border-bottom-color: #1e293b !important;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

.dark ::selection {
  background: rgba(96, 165, 250, 0.25);
}

/* ===== 打印友好 ===== */
@media print {
  .nav, .qy-side-dock, .burger, .drawer {
    display: none !important;
  }
  .container {
    max-width: 100% !important;
  }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
