/* 
 * Homepage Modules Enhancement CSS
 * 专门优化 "Try It Now" 和 "What users say" 模块
 * 兼容PC和移动端
 */

/* ========================================
   Try It Now 模块优化
   ======================================== */

/* 增强版交互演示区域 */
.section .speed-demo-enhanced {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
  border: 1px solid var(--line) !important;
  border-radius: 20px !important;
  padding: 32px !important;
  margin-top: 24px !important;
  position: relative !important;
  overflow: hidden !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

.section .speed-demo-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--pri), var(--sec));
}

/* 演示标题增强 */
.demo-header {
  text-align: center;
  margin-bottom: 32px;
}

.demo-header .section-title.animated {
  background: linear-gradient(135deg, var(--pri), var(--sec));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titlePulse 2s ease-in-out infinite alternate;
}

@keyframes titlePulse {
  0% { opacity: 0.9; }
  100% { opacity: 1; }
}

.demo-subtitle {
  font-size: 16px;
  color: var(--muted);
  margin: 8px 0 0 0;
  font-weight: 500;
}

/* 演示容器布局 */
.demo-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 32px;
  align-items: flex-start;
  max-width: 100%;
}

/* 视频包装器增强 */
.video-wrapper {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--line);
  max-width: 100%;
}

/* 视频容器尺寸控制 */
.video-wrapper .video-container {
  max-width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: 8px;
}

.video-wrapper .video-container video,
.video-wrapper .video-container #demo-video {
  width: 100% !important;
  height: auto !important;
  max-height: 280px !important;
  object-fit: contain !important;
  border-radius: 8px;
}

/* 使用提示 - 重新定位到演示容器内部，不遮挡标题 */
.demo-container {
  position: relative;
}

.demo-tips {
  position: absolute;
  top: -10px;
  right: 200px; /* 指向控制面板中央 */
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--pri);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  animation: tipsBounce 2s ease-in-out infinite;
  z-index: 2;
  white-space: nowrap;
}

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

.tip-arrow {
  font-size: 16px;
  animation: arrowPoint 1.5s ease-in-out infinite;
}

@keyframes arrowPoint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(10deg); }
}

/* 增强的控制面板 */
.enhanced-controls {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--line);
  width: 400px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 速度显示器 */
.speed-display {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: linear-gradient(135deg, #eef2ff, #f0f9ff);
  border-radius: 12px;
  border: 1px solid #e0e7ff;
}

.current-speed {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--pri);
  margin-bottom: 4px;
  text-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.speed-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

/* 滑块增强 */
.section .speed-demo-enhanced #speed-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  outline: none;
  margin: 16px 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.section .speed-demo-enhanced #speed-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pri);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.section .speed-demo-enhanced #speed-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* 预设按钮增强 */
.section .speed-demo-enhanced .speed-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.section .speed-demo-enhanced .speed-btn {
  background: white;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section .speed-demo-enhanced .speed-btn:hover {
  background: #f1f5f9;
  border-color: var(--pri);
  transform: translateY(-1px);
}

.section .speed-demo-enhanced .speed-btn.active {
  background: var(--pri);
  color: white;
  border-color: var(--pri);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ========================================
   What Users Say 模块优化
   ======================================== */

/* 用户评价统计 */
.testimonials-stats {
  display: flex !important;
  justify-content: center !important;
  gap: 32px !important;
  margin: 20px 0 32px 0 !important;
  padding: 20px !important;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9) !important;
  border-radius: 16px !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05) !important;
}

.testimonials-stats .stat {
  text-align: center;
  font-weight: 600;
  color: var(--pri);
  font-size: 16px;
}

/* 增强版轮播容器 */
.testimonials-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: white;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--line);
}

/* 轮播轨道 */
.testimonials-track {
  display: flex;
  transition: transform 0.5s ease;
  gap: 24px;
}

/* 增强版评价卡片 */
.testimonial-card.featured {
  min-width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  transition: all 0.3s ease;
}

.testimonial-card.featured:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

/* 用户信息增强 */
.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--line);
  object-fit: cover;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.user-role {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.rating {
  color: #f59e0b;
  font-size: 16px;
  margin-bottom: 2px;
}

.date {
  font-size: 12px;
  color: var(--muted);
}

/* 评价内容 */
.testimonial-content {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
  font-style: italic;
}

.testimonial-content strong {
  color: var(--pri);
  font-weight: 700;
}

/* 使用场景标签 */
.use-case {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  background: #eef2ff;
  color: var(--pri);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #e0e7ff;
}

/* 轮播控制 */
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.prev-btn, .next-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--line);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.prev-btn:hover, .next-btn:hover {
  background: var(--pri);
  color: white;
  border-color: var(--pri);
  transform: scale(1.05);
}

.prev-btn:disabled, .next-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 指示器 */
.dots-indicator {
  display: flex;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dot.active {
  background: var(--pri);
  transform: scale(1.2);
}

/* ========================================
   移动端优化 (768px 及以下)
   ======================================== */

@media (max-width: 768px) {
  
  /* Try It Now 移动端优化 */
  .section .speed-demo-enhanced {
    padding: 20px 16px;
    margin-top: 16px;
  }
  
  .demo-header .section-title.animated {
    font-size: 24px;
  }
  
  .demo-subtitle {
    font-size: 14px;
  }
  
  /* 移动端改为垂直布局 */
  .demo-container {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  /* 移动端控制面板宽度自适应 */
  .enhanced-controls {
    width: 100% !important;
    min-height: auto !important;
  }
  
  /* 移动端视频容器优化 */
  .video-wrapper .video-container {
    max-height: 200px !important;
  }
  
  .video-wrapper .video-container video,
  .video-wrapper .video-container #demo-video {
    max-height: 180px !important;
  }
  
  /* 移动端提示框重新定位 */
  .demo-tips {
    position: static !important;
    margin-bottom: 16px !important;
    justify-content: center !important;
  }
  
  .video-wrapper {
    padding: 16px;
  }
  
  .demo-tips {
    position: static;
    margin-bottom: 16px;
    justify-content: center;
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .enhanced-controls {
    padding: 20px 16px;
  }
  
  .speed-display {
    margin-bottom: 20px;
    padding: 12px;
  }
  
  .current-speed {
    font-size: 28px;
  }
  
  /* 移动端预设按钮优化 */
  .section .speed-demo-enhanced .speed-presets {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  
  .section .speed-demo-enhanced .speed-btn {
    padding: 12px 8px;
    font-size: 15px;
    min-height: 48px;
  }
  
  /* What Users Say 移动端优化 */
  .testimonials-stats {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    text-align: center;
  }
  
  .testimonials-stats .stat {
    font-size: 14px;
  }
  
  .testimonials-carousel {
    padding: 16px;
  }
  
  .testimonial-card.featured {
    padding: 20px 16px;
  }
  
  .user-info {
    gap: 12px;
    margin-bottom: 12px;
  }
  
  .user-avatar {
    width: 48px;
    height: 48px;
  }
  
  .user-name {
    font-size: 16px;
  }
  
  .user-role {
    font-size: 13px;
  }
  
  .testimonial-content {
    font-size: 15px;
    margin-bottom: 12px;
  }
  
  .carousel-controls {
    margin-top: 16px;
    gap: 12px;
  }
  
  .prev-btn, .next-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* ========================================
   超小屏幕优化 (480px 及以下)
   ======================================== */

@media (max-width: 480px) {
  
  .section .speed-demo-enhanced {
    padding: 16px 12px;
    border-radius: 16px;
  }
  
  .demo-header .section-title.animated {
    font-size: 20px;
  }
  
  .video-wrapper, .enhanced-controls {
    padding: 12px;
  }
  
  .speed-display {
    padding: 10px;
  }
  
  .current-speed {
    font-size: 24px;
  }
  
  /* 超小屏幕预设按钮 */
  .section .speed-demo-enhanced .speed-presets {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .section .speed-demo-enhanced .speed-btn {
    padding: 10px 6px;
    font-size: 14px;
    min-height: 44px;
  }
  
  /* 超小屏幕评价模块 */
  .testimonials-stats {
    padding: 12px;
    gap: 8px;
  }
  
  .testimonials-stats .stat {
    font-size: 13px;
  }
  
  .testimonials-carousel {
    padding: 12px;
  }
  
  .testimonial-card.featured {
    padding: 16px 12px;
  }
  
  .user-avatar {
    width: 44px;
    height: 44px;
  }
  
  .user-name {
    font-size: 15px;
  }
  
  .testimonial-content {
    font-size: 14px;
  }
  
  .carousel-controls {
    gap: 8px;
  }
  
  .prev-btn, .next-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
}

/* ========================================
   触摸设备优化
   ======================================== */

@media (hover: none) and (pointer: coarse) {
  
  /* 触摸设备按钮优化 */
  .section .speed-demo-enhanced .speed-btn,
  .prev-btn, .next-btn {
    min-height: 48px;
    min-width: 48px;
  }
  
  /* 移除悬停效果，使用点击效果 */
  .section .speed-demo-enhanced .speed-btn:active {
    background: #f1f5f9;
    border-color: var(--pri);
    transform: scale(0.95);
  }
  
  .prev-btn:active, .next-btn:active {
    background: var(--pri);
    color: white;
    transform: scale(0.95);
  }
  
  /* 滑块触摸优化 */
  .section .speed-demo-enhanced #speed-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
}

/* ========================================
   高对比度模式支持
   ======================================== */

@media (prefers-contrast: high) {
  
  .section .speed-demo-enhanced,
  .testimonials-carousel {
    border-width: 2px;
  }
  
  .section .speed-demo-enhanced .speed-btn,
  .prev-btn, .next-btn {
    border-width: 2px;
  }
  
  .testimonial-content {
    font-weight: 500;
  }
}

/* ========================================
   减少动画模式支持
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  
  .demo-header .section-title.animated {
    animation: none;
  }
  
  .demo-tips {
    animation: none;
  }
  
  .tip-arrow {
    animation: none;
  }
  
  .testimonials-track {
    transition: none;
  }
  
  .testimonial-card.featured,
  .section .speed-demo-enhanced .speed-btn,
  .prev-btn, .next-btn {
    transition: none;
  }
}