/* ===== 墨函AI Design System — LobeHub-Inspired ===== */
/* Inter 字体自托管（SIL OFL 1.1 许可，可商用） */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 主色调 — 现代蓝 */
  --primary: #0066ff;
  --primary-hover: #0052cc;
  --primary-dark: #003eb3;
  --primary-light: #3385ff;
  --primary-bg: rgba(0, 102, 255, 0.06);
  --primary-glow: rgba(0, 102, 255, 0.15);

  /* CTA 强调色 — 活力橙 */
  --accent: #ff6b35;
  --accent-hover: #e5561f;
  --accent-bg: rgba(255, 107, 53, 0.06);
  --accent-glow: rgba(255, 107, 53, 0.15);

  /* 渐变 */
  --gradient-primary: linear-gradient(135deg, #0066ff 0%, #6c5ce7 100%);
  --gradient-accent: linear-gradient(135deg, #ff6b35 0%, #ff8f65 100%);
  --gradient-hero: linear-gradient(135deg, #0066ff 0%, #6c5ce7 50%, #a855f7 100%);
  --gradient-text: linear-gradient(135deg, #0066ff 0%, #6c5ce7 60%, #a855f7 100%);
  --gradient-mesh:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 102, 255, 0.08) 0%, transparent 100%),
    radial-gradient(ellipse 60% 60% at 80% 50%, rgba(108, 92, 231, 0.05) 0%, transparent 100%),
    radial-gradient(ellipse 50% 50% at 20% 80%, rgba(168, 85, 247, 0.04) 0%, transparent 100%);

  /* 中性色 */
  --bg: #fafbfe;
  --bg-alt: #f0f2f8;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --text: #0a0f1e;
  --text-secondary: #4b5675;
  --text-muted: #8b95b0;
  --border: rgba(0, 20, 80, 0.08);
  --border-glass: rgba(0, 20, 80, 0.06);
  --border-focus: #0066ff;

  /* 状态色 */
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
  --space-5xl: 128px;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* 阴影 — 带色彩倾向 */
  --shadow-xs: 0 1px 2px rgba(0, 20, 80, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 20, 80, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 20, 80, 0.06), 0 1px 4px rgba(0, 20, 80, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 20, 80, 0.08), 0 2px 8px rgba(0, 20, 80, 0.04);
  --shadow-xl: 0 16px 48px rgba(0, 20, 80, 0.1), 0 4px 12px rgba(0, 20, 80, 0.05);
  --shadow-glow-primary: 0 4px 24px rgba(0, 102, 255, 0.2);
  --shadow-glow-accent: 0 4px 24px rgba(255, 107, 53, 0.2);

  /* 字号 */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;
  --text-4xl: 40px;
  --text-5xl: 56px;

  /* 动画 */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'PingFang SC',
    'Hiragino Sans GB',
    'Microsoft YaHei',
    sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}
a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* ===== 移动端安全区 ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== 通用容器 ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ===== SVG Icon 基础 ===== */
.icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon circle,
.icon ellipse,
.icon line,
.icon path,
.icon polygon,
.icon polyline,
.icon rect {
  fill: none;
  stroke: inherit;
  stroke-width: inherit;
  stroke-linecap: inherit;
  stroke-linejoin: inherit;
}
.icon-sm {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
}
.icon-lg {
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
}
.icon-xl {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
}

/* 图标容器 — 毛玻璃质感 */
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.icon-box-primary {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid rgba(0, 102, 255, 0.1);
}
.icon-box-accent {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid rgba(255, 107, 53, 0.1);
}
.icon-box-success {
  background: rgba(16, 185, 129, 0.06);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.1);
}
.icon-box-info {
  background: rgba(59, 130, 246, 0.06);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.1);
}
.icon-box-warning {
  background: rgba(245, 158, 11, 0.06);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.1);
}
.icon-box-danger {
  background: rgba(239, 68, 68, 0.06);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.1);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out-expo);
  white-space: nowrap;
  -webkit-appearance: none;
  touch-action: manipulation;
  min-height: 48px;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-glow-primary);
}
.btn-primary:hover {
  box-shadow: 0 6px 32px rgba(0, 102, 255, 0.3);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-secondary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 102, 255, 0.2);
}
.btn-secondary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25);
}
.btn-outline {
  background: var(--bg-glass);
  color: var(--text);
  border: 1.5px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  box-shadow: var(--shadow-sm);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 8px 18px;
  font-size: var(--text-sm);
  min-height: 40px;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 16px 36px;
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: var(--space-md);
}
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.form-label .required,
.required {
  color: #ef4444;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--text-base);
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
  -webkit-appearance: none;
  min-height: 48px;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.08);
}
.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ===== 毛玻璃卡片 ===== */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  border: 1px solid var(--border-glass);
  transition:
    box-shadow var(--duration-base) var(--ease-out-expo),
    transform var(--duration-base) var(--ease-out-expo);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease-out-expo);
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.toast-success {
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
}
.toast-error {
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
}
.toast-info {
  background: rgba(0, 102, 255, 0.92);
  color: #fff;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== 加载动画 ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== 入场动画 ===== */
.fade-in-up {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.7s var(--ease-out-expo),
    transform 0.7s var(--ease-out-expo);
}
.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-in {
  opacity: 0;
  transition: opacity 0.5s var(--ease-out-expo);
}
.fade-in.visible {
  opacity: 1;
}

.delay-1 {
  transition-delay: 0.1s;
}
.delay-2 {
  transition-delay: 0.2s;
}
.delay-3 {
  transition-delay: 0.3s;
}
.delay-4 {
  transition-delay: 0.4s;
}
.delay-5 {
  transition-delay: 0.5s;
}
.delay-6 {
  transition-delay: 0.6s;
}

@media (prefers-reduced-motion: reduce) {
  .fade-in-up,
  .fade-in {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* ===== 渐变文字工具 ===== */
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 装饰性网格点阵 ===== */
.dot-grid {
  background-image: radial-gradient(circle, rgba(0, 20, 80, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  :root {
    --text-3xl: 26px;
    --text-4xl: 32px;
    --text-5xl: 40px;
  }
  .container {
    padding: 0 var(--space-md);
  }
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* ===== 客服悬浮窗 ===== */
.cs-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
}

/* 入场动画：页面加载后从右侧弹入 */
@keyframes cs-fab-enter {
  0% {
    opacity: 0;
    transform: translateX(80px) scale(0.5);
  }
  60% {
    opacity: 1;
    transform: translateX(-6px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* 轻微摇摆：空闲时周期性提醒（10% 动，90% 静） */
@keyframes cs-wiggle {
  0%,
  10%,
  100% {
    transform: rotate(0deg);
  }
  2% {
    transform: rotate(-12deg);
  }
  4% {
    transform: rotate(10deg);
  }
  6% {
    transform: rotate(-6deg);
  }
  8% {
    transform: rotate(3deg);
  }
}

.cs-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #3b8bff 0%, #0062e6 50%, #0050c8 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 4px rgba(0, 50, 120, 0.25),
    0 8px 24px rgba(0, 80, 200, 0.3),
    0 16px 40px rgba(0, 60, 160, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.25);
  transition:
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s;
  position: relative;
  overflow: visible;
  animation: cs-fab-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.8s both;
}

/* 空闲时每 5 秒摇一摇图标（前 10% 即 0.5s 摇摆，其余静止） */
.cs-fab-btn .cs-icon-chat {
  animation: cs-wiggle 5s ease-in-out 3s infinite;
}
.cs-fab.open .cs-fab-btn .cs-icon-chat {
  animation: none;
}

/* 玻璃高光 */
.cs-fab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}
/* 光斑 */
.cs-fab-btn::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  top: 11px;
  left: 14px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.cs-fab-btn:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow:
    0 4px 8px rgba(0, 50, 120, 0.2),
    0 12px 32px rgba(0, 80, 200, 0.35),
    0 24px 56px rgba(0, 60, 160, 0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}
.cs-fab-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow:
    0 1px 3px rgba(0, 50, 120, 0.3),
    0 4px 12px rgba(0, 80, 200, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  transition-duration: 0.08s;
}

.cs-fab-btn .icon {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}
.cs-fab-btn .cs-icon-close {
  display: none;
}
.cs-fab.open .cs-fab-btn .cs-icon-chat {
  display: none;
}
.cs-fab.open .cs-fab-btn .cs-icon-close {
  display: block;
}

/* 打开时全屏透明遮罩，点击关闭弹窗 */
.cs-fab-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8999;
}
.cs-fab.open .cs-fab-backdrop {
  display: block;
}

.cs-fab-popup {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.95);
  transition:
    opacity 0.25s,
    transform 0.25s,
    visibility 0.25s;
  text-align: center;
}
.cs-fab.open .cs-fab-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.cs-fab-popup h4 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.cs-fab-popup p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 14px;
}
.cs-fab-qr {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-lg);
  display: block;
  margin: 0 auto 12px;
  object-fit: cover;
}
.cs-fab-wechat-id {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  display: inline-block;
}

@media (max-width: 768px) {
  .cs-fab {
    bottom: 80px;
    right: 16px;
  }
  .cs-fab-btn {
    width: 46px;
    height: 46px;
  }
  .cs-fab-popup {
    width: 260px;
    right: -8px;
  }
}
