/**
 * 海鸥云 UI 增强样式
 * 全局动画、交互效果、视觉升级
 */

/* ========================================
   CSS 变量 - 动画与颜色
======================================== */
:root {
  --primary: #3B82F6;
  --primary-light: #60A5FA;
  --primary-dark: #2563EB;
  --gradient-primary: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  --gradient-warm: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --gradient-cool: linear-gradient(135deg, #0EA5E9 0%, #3B82F6 100%);
  --gradient-green: linear-gradient(135deg, #10B981 0%, #059669 100%);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.3);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========================================
   全局动画定义
======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(59, 130, 246, 0.2);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes rotate-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce-subtle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ========================================
   滚动触发动画类 (不隐藏默认状态，仅增强)
======================================== */
.animate-on-scroll {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.will-animate {
  opacity: 0;
  transform: translateY(30px);
}

.animate-on-scroll.animated {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.animate-on-scroll.delay-1 { transition-delay: 0.1s; }
.animate-on-scroll.delay-2 { transition-delay: 0.2s; }
.animate-on-scroll.delay-3 { transition-delay: 0.3s; }
.animate-on-scroll.delay-4 { transition-delay: 0.4s; }
.animate-on-scroll.delay-5 { transition-delay: 0.5s; }

.animate-fade-left {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-fade-left.will-animate {
  opacity: 0;
  transform: translateX(-30px);
}

.animate-fade-left.animated {
  opacity: 1 !important;
  transform: translateX(0) !important;
}

.animate-fade-right {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-fade-right.will-animate {
  opacity: 0;
  transform: translateX(30px);
}

.animate-fade-right.animated {
  opacity: 1 !important;
  transform: translateX(0) !important;
}

.animate-scale {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-scale.will-animate {
  opacity: 0;
  transform: scale(0.9);
}

.animate-scale.animated {
  opacity: 1 !important;
  transform: scale(1) !important;
}

/* ========================================
   卡片悬停增强效果
======================================== */
.card-hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card-hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.card-hover-glow {
  transition: all var(--transition-normal);
  position: relative;
}

.card-hover-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--gradient-primary);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-normal);
}

.card-hover-glow:hover::before {
  opacity: 1;
}

.card-hover-glow:hover {
  transform: translateY(-4px);
}

/* 3D 翻转效果卡片 */
.card-3d {
  perspective: 1000px;
}

.card-3d-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
  transform: rotateY(10deg) rotateX(5deg);
}

/* ========================================
   按钮增强效果
======================================== */
.btn-enhanced {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.btn-enhanced::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-enhanced:hover::before {
  width: 300px;
  height: 300px;
}

.btn-enhanced:active {
  transform: scale(0.98);
}

/* 渐变动态按钮 */
.btn-gradient-animated {
  background: linear-gradient(90deg, #3B82F6, #2563EB, #1D4ED8, #3B82F6);
  background-size: 300% 100%;
  animation: gradient-shift 4s ease infinite;
  border: none;
  color: white;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-normal);
}

.btn-gradient-animated:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

/* 边框动画按钮 */
.btn-border-animate {
  position: relative;
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  overflow: hidden;
  z-index: 1;
}

.btn-border-animate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--primary);
  transition: left var(--transition-normal);
  z-index: -1;
}

.btn-border-animate:hover {
  color: white;
}

.btn-border-animate:hover::before {
  left: 0;
}

/* ========================================
   输入框增强
======================================== */
.input-enhanced {
  transition: all var(--transition-normal);
  border: 2px solid #E5E7EB;
}

.input-enhanced:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  outline: none;
}

.input-enhanced:hover:not(:focus) {
  border-color: #9CA3AF;
}

/* 浮动标签输入框 */
.input-float-label {
  position: relative;
}

.input-float-label input {
  padding-top: 20px;
}

.input-float-label label {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  font-size: 14px;
  color: #9CA3AF;
  transition: all var(--transition-normal);
  pointer-events: none;
}

.input-float-label input:focus + label,
.input-float-label input:not(:placeholder-shown) + label {
  top: 10px;
  font-size: 11px;
  color: var(--primary);
  transform: translateY(0);
}

/* ========================================
   导航栏增强
======================================== */
.nav-link-enhanced {
  position: relative;
  transition: color var(--transition-fast);
}

.nav-link-enhanced::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition-normal), left var(--transition-normal);
}

.nav-link-enhanced:hover::after,
.nav-link-enhanced.active::after {
  width: 100%;
  left: 0;
}

/* ========================================
   加载动画
======================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #E5E7EB;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: rotate-slow 0.8s linear infinite;
}

.dots-loading {
  display: flex;
  gap: 8px;
}

.dots-loading span {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce-subtle 0.6s ease infinite;
}

.dots-loading span:nth-child(2) {
  animation-delay: 0.1s;
}

.dots-loading span:nth-child(3) {
  animation-delay: 0.2s;
}

/* ========================================
   页面过渡效果
======================================== */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
  opacity: 1;
}

.page-transition-exit-active {
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

::-webkit-scrollbar-track {
  background: #F3F4F6;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ========================================
   文字效果
======================================== */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-warm {
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-shimmer {
  background: linear-gradient(90deg, #1F2937 0%, #3B82F6 50%, #1F2937 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}

/* ========================================
   徽章和标签增强
======================================== */
.badge-pulse {
  position: relative;
}

.badge-pulse::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: pulse-glow 2s ease infinite;
}

.badge-new {
  background: var(--gradient-warm);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  animation: bounce-subtle 2s ease infinite;
}

.badge-hot {
  background: linear-gradient(135deg, #EF4444, #F97316);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ========================================
   图标动画
======================================== */
.icon-hover-rotate {
  transition: transform var(--transition-normal);
}

.icon-hover-rotate:hover {
  transform: rotate(15deg);
}

.icon-hover-scale {
  transition: transform var(--transition-bounce);
}

.icon-hover-scale:hover {
  transform: scale(1.2);
}

.icon-float {
  animation: float 3s ease-in-out infinite;
}

/* ========================================
   背景装饰效果
======================================== */
.bg-gradient-mesh {
  background: 
    radial-gradient(at 40% 20%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
    radial-gradient(at 80% 50%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.1) 0px, transparent 50%);
}

.bg-dots {
  background-image: radial-gradient(circle, #E5E7EB 1px, transparent 1px);
  background-size: 20px 20px;
}

.bg-grid {
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ========================================
   工具提示增强
======================================== */
.tooltip-enhanced {
  position: relative;
}

.tooltip-enhanced::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 8px 12px;
  background: #1F2937;
  color: white;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 100;
}

.tooltip-enhanced:hover::after {
  transform: translateX(-50%) translateY(-8px);
  opacity: 1;
  visibility: visible;
}

/* ========================================
   响应式动画调整
======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 768px) {
  .card-hover-lift:hover {
    transform: translateY(-4px);
  }
  
  .animate-on-scroll {
    transform: translateY(20px);
  }
}
