@import "tailwindcss";
@import "../styles/ui-tokens-glass.css";
@import "../styles/ui-semantic-glass.css";

@custom-variant dark (&:is(.dark *));

:root {

  /* 设计系统 - 颜色 */
  --bg-primary: var(--glass-bg-canvas);
  /* 浅灰背景 */
  --bg-card: var(--glass-bg-surface);
  /* 卡片白色 */
  --bg-glass: var(--glass-bg-surface-strong);
  /* 玻璃态背景 */

  /* 设计系统 - 阴影 */
  --shadow-card: var(--glass-shadow-sm);
  --shadow-card-hover: var(--glass-shadow-md);
  --shadow-glass: var(--glass-shadow-lg);

  /* 设计系统 - 圆角 */
  --radius-card: var(--glass-radius-md);
  --radius-button: var(--glass-radius-sm);
  --radius-input: var(--glass-radius-xs);

  /* 设计系统 - 模糊 */
  --blur-glass: var(--glass-blur-lg);
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);

  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-4xl: calc(var(--radius) + 16px);
}

body {
  font-family: var(--font-geist-sans), Arial, Helvetica, sans-serif;
}

/* 可复用组件类 */
.card-base {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease;
}

.card-base:hover {
  box-shadow: var(--shadow-card-hover);
}

.glass-nav {
  background: var(--glass-bg-nav);
  backdrop-filter: blur(var(--glass-blur-nav)) saturate(1.12);
  -webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(1.12);
  box-shadow: var(--glass-shadow-nav);
  border-bottom: 1px solid var(--glass-stroke-soft);
}

.input-base {
  border-radius: var(--radius-input);
  transition: all 0.2s ease;
}

/* 液体流动动画 */
@keyframes float {

  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1);
    opacity: 0.6;
  }

  25% {
    transform: translateY(-40px) translateX(30px) scale(1.1);
    opacity: 0.8;
  }

  50% {
    transform: translateY(-20px) translateX(-20px) scale(0.9);
    opacity: 0.7;
  }

  75% {
    transform: translateY(30px) translateX(40px) scale(1.05);
    opacity: 0.9;
  }
}

@keyframes float-delayed {

  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1);
    opacity: 0.5;
  }

  25% {
    transform: translateY(50px) translateX(-40px) scale(0.85);
    opacity: 0.7;
  }

  50% {
    transform: translateY(-30px) translateX(60px) scale(1.2);
    opacity: 0.6;
  }

  75% {
    transform: translateY(20px) translateX(-30px) scale(0.95);
    opacity: 0.8;
  }
}

@keyframes float-slow {

  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1);
    opacity: 0.4;
  }

  33% {
    transform: translateY(-60px) translateX(50px) scale(1.3);
    opacity: 0.7;
  }

  66% {
    transform: translateY(40px) translateX(-60px) scale(0.8);
    opacity: 0.6;
  }
}

.animate-float {
  animation: float 15s ease-in-out infinite;
}

.animate-float-delayed {
  animation: float-delayed 18s ease-in-out infinite;
  animation-delay: -3s;
}

.animate-float-slow {
  animation: float-slow 20s ease-in-out infinite;
  animation-delay: -6s;
}

@keyframes assistant-stream-gradient {
  0% {
    background-position: 100% 50%;
    opacity: 0.72;
  }

  100% {
    background-position: 0% 50%;
    opacity: 1;
  }
}

.assistant-streaming-response {
  background-image: linear-gradient(
    90deg,
    color-mix(in oklch, var(--glass-text-secondary) 85%, white 15%) 0%,
    color-mix(in oklch, var(--glass-text-primary) 95%, white 5%) 42%,
    color-mix(in oklch, var(--glass-text-secondary) 85%, white 15%) 100%
  );
  background-size: 220% 100%;
  background-position: 100% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: assistant-stream-gradient 520ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .assistant-streaming-response {
    animation: none;
    background-image: none;
    background-size: auto;
    -webkit-text-fill-color: currentColor;
    color: var(--glass-text-primary);
  }
}

/* 测试页面动画 - 增强版 */
@keyframes float-1 {

  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
    opacity: 0.6;
  }

  25% {
    transform: translateY(-120px) translateX(80px) scale(1.3) rotate(5deg);
    opacity: 0.8;
  }

  50% {
    transform: translateY(-60px) translateX(-90px) scale(0.7) rotate(-3deg);
    opacity: 0.7;
  }

  75% {
    transform: translateY(100px) translateX(110px) scale(1.1) rotate(8deg);
    opacity: 0.9;
  }
}

@keyframes float-2 {

  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
    opacity: 0.5;
  }

  20% {
    transform: translateY(80px) translateX(-70px) scale(0.8) rotate(-4deg);
    opacity: 0.7;
  }

  40% {
    transform: translateY(-90px) translateX(130px) scale(1.4) rotate(6deg);
    opacity: 0.6;
  }

  60% {
    transform: translateY(110px) translateX(-100px) scale(0.9) rotate(-7deg);
    opacity: 0.8;
  }

  80% {
    transform: translateY(-50px) translateX(90px) scale(1.2) rotate(3deg);
    opacity: 0.7;
  }
}

@keyframes float-3 {

  0%,
  100% {
    transform: translateY(0px) translateX(0px) scale(1) rotate(0deg);
    opacity: 0.4;
  }

  33% {
    transform: translateY(-140px) translateX(120px) scale(1.5) rotate(10deg);
    opacity: 0.8;
  }

  66% {
    transform: translateY(90px) translateX(-140px) scale(0.6) rotate(-8deg);
    opacity: 0.6;
  }
}

.animate-float-1 {
  animation: float-1 10s ease-in-out infinite;
}

.animate-float-2 {
  animation: float-2 12s ease-in-out infinite;
  animation-delay: -2s;
}

.animate-float-3 {
  animation: float-3 14s ease-in-out infinite;
  animation-delay: -4s;
}

/* Toast动画 */
@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slide-up 0.8s ease-out both;
}

/* 进度条动画 */
@keyframes progress {
  0% {
    width: 0%;
  }

  100% {
    width: 100%;
  }
}

.animate-progress {
  animation: progress 2s ease-in-out infinite;
}

/* 确认对话框动画 */
@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scale-in {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fade-in 0.2s ease-out both;
}

.animate-scale-in {
  animation: scale-in 0.22s ease-out both;
}

/* 竖向文字 */
.writing-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* 渐变动画 */
@keyframes gradient-x {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.animate-gradient-x {
  background-size: 200% auto;
  animation: gradient-x 3s linear infinite;
}

@keyframes float-slow {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(20px, 20px);
  }
}

@keyframes float-delayed {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-20px, 20px);
  }
}

.animate-float-slow {
  animation: float-slow 8s ease-in-out infinite;
}

.animate-float-delayed {
  animation: float-delayed 10s ease-in-out infinite;
  animation-delay: 2s;
}

@keyframes pulse-slow {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.animate-pulse-slow {
  animation: pulse-slow 8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}
