/* Enhanced Responsive Carousel Styles */
.carousel-slide {
  transition: opacity 0.7s ease-in-out;
  z-index: 0;
  position: relative;
}

.carousel-slide[style*="opacity: 1"] {
  z-index: 10;
}

/* Ensure proper stacking context */
.carousel-slide.active {
  z-index: 10;
}

/* Smooth transitions for all carousel elements */
.carousel-slide * {
  transition: all 0.3s ease-in-out;
}

/* Responsive background image handling */
.carousel-slide .bg-cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease-in-out;
}

/* Navigation dots active state */
.carousel-dot.active {
  background-color: rgba(255, 255, 255, 0.9);
  transform: scale(1.2);
}

/* Navigation arrows hover effects */
.carousel-nav:hover {
  background-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

/* Enhanced responsive adjustments */
@media (max-width: 640px) {
  .carousel-nav {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  .carousel-nav svg {
    width: 0.75rem;
    height: 0.75rem;
  }
  
  .carousel-dot {
    width: 0.5rem;
    height: 0.5rem;
  }
}

@media (max-width: 768px) {
  .carousel-nav {
    width: 2rem;
    height: 2rem;
  }
  
  .carousel-nav svg {
    width: 1rem;
    height: 1rem;
  }
  
  .carousel-dot {
    width: 0.625rem;
    height: 0.625rem;
  }
}

@media (max-width: 1024px) {
  .carousel-slide h1 {
    line-height: 1.2;
  }
  
  .carousel-slide p {
    line-height: 1.5;
  }
}

/* Ensure carousel container has proper positioning */
.carousel-container {
  position: relative;
  overflow: hidden;
}

/* Smooth fade transitions */
.fade-transition {
  transition: opacity 0.7s ease-in-out;
}

/* Active slide indicator */
.slide-active {
  opacity: 1 !important;
  z-index: 10 !important;
}

.slide-inactive {
  opacity: 0 !important;
  z-index: 0 !important;
}

/* Touch-friendly interactions for mobile */
@media (hover: none) and (pointer: coarse) {
  .carousel-nav {
    min-width: 2.5rem;
    min-height: 2.5rem;
  }
  
  .carousel-dot {
    min-width: 0.75rem;
    min-height: 0.75rem;
  }
}

/* High DPI display support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .carousel-slide .bg-cover {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Product Center Sidebar Styles */
.product-sidebar {
  transition: all 0.3s ease-in-out;
}

.product-sidebar .sticky {
  position: sticky;
  top: 6rem; /* 96px, 为导航栏高度(80px) + 间距(16px) */
}

/* Sidebar category item hover effects */
.product-sidebar .category-item {
  transition: all 0.2s ease-in-out;
  border-radius: 0.5rem;
}

.product-sidebar .category-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Active category styling */
.product-sidebar .category-item.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Subcategory styling */
.product-sidebar .subcategory-item {
  transition: all 0.2s ease-in-out;
  border-radius: 0.375rem;
}

.product-sidebar .subcategory-item:hover {
  transform: translateX(2px);
  background-color: #f8fafc;
}

.product-sidebar .subcategory-item.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Responsive sidebar adjustments */
@media (max-width: 1024px) {
  .product-sidebar {
    order: 2;
    margin-top: 2rem;
  }
  
  .product-sidebar .sticky {
    position: static;
  }
}

@media (max-width: 768px) {
  .product-sidebar {
    margin-top: 1.5rem;
  }
  
  .product-sidebar .category-item:hover {
    transform: none;
  }
  
  .product-sidebar .subcategory-item:hover {
    transform: none;
  }
}

/* Product grid responsive adjustments */
.product-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Product card hover effects */
.product-card {
  transition: all 0.3s ease-in-out;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Line clamp utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Rich Text Content Styles - 富文本内容样式 */
.prose {
  /* 确保富文本内容有合适的最大宽度 */
  max-width: none;
}

.prose img {
  /* 图片基本样式 */
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.prose img[style*="float: left"] {
  /* 左对齐图片 */
  float: left;
  margin: 0.5rem 1rem 0.5rem 0;
  max-width: 50%;
}

.prose img[style*="float: right"] {
  /* 右对齐图片 */
  float: right;
  margin: 0.5rem 0 0.5rem 1rem;
  max-width: 50%;
}

.prose img[style*="text-align: center"] {
  /* 居中对齐图片 */
  display: block;
  margin: 1.5rem auto;
}

/* 响应式图片处理 */
@media (max-width: 768px) {
  .prose img[style*="float: left"],
  .prose img[style*="float: right"] {
    /* 在小屏幕上取消浮动，让图片居中显示 */
    float: none;
    margin: 1rem auto;
    max-width: 100%;
  }
}

/* 图片说明文字样式 */
.prose figure {
  margin: 2rem 0;
  text-align: center;
}

.prose figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
}

/* 确保富文本中的链接样式正确 */
.prose a {
  color: #2563eb;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.prose a:hover {
  color: #1d4ed8;
  text-decoration-thickness: 2px;
}

/* 富文本中的表格样式 */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.prose th,
.prose td {
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  text-align: left;
}

.prose th {
  background-color: #f9fafb;
  font-weight: 600;
}

/* 富文本中的代码块样式 */
.prose pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose code {
  background-color: #f3f4f6;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: #dc2626;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* 固定联系按钮样式 */
.fixed-contact-buttons {
  position: fixed;
  right: 10px;
  top: 70%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 联系按钮基础样式 */
.contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: visible;
}

.contact-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0.75rem;
}

.contact-btn:hover::before {
  opacity: 1;
}

.contact-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.contact-btn:active {
  transform: translateY(-1px) scale(1.02);
}

/* QQ按钮样式 */
.qq-btn {
  background: linear-gradient(135deg, #12b7f5 0%, #0ea5e9 100%);
  color: white;
}

.qq-btn:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 8px 25px rgba(18, 183, 245, 0.3);
}

/* 电话按钮样式 */
.phone-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.phone-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

/* 按钮图标样式 */
.contact-btn svg {
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
  width: 2rem;
  height: 2rem;
}

.contact-btn:hover svg {
  transform: scale(1.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .fixed-contact-buttons {
    right: 1rem;
    gap: 0.75rem;
  }
  
  .contact-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 0.625rem;
  }
  
  .contact-btn svg {
    width: 1.75rem;
    height: 1.75rem;
  }
}

@media (max-width: 480px) {
  .fixed-contact-buttons {
    right: 0.75rem;
    gap: 0.5rem;
  }
  
  .contact-btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.5rem;
  }
  
  .contact-btn svg {
    width: 1.625rem;
    height: 1.625rem;
  }
}

/* 滚动时的视觉效果 */
.fixed-contact-buttons.scrolling {
  opacity: 0.8;
}

/* 动画效果 */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.contact-btn:hover {
  animation: pulse 2s infinite;
}

/* Tooltip 样式 */
.contact-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.contact-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-4px);
}

/* 响应式tooltip调整 */
@media (max-width: 768px) {
  .contact-btn::after {
    font-size: 0.8rem;
    padding: 0.375rem 0.625rem;
    right: calc(100% + 10px);
  }
}

@media (max-width: 480px) {
  .contact-btn::after {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    right: calc(100% + 8px);
  }
}

/* 隐藏轮播图左右导航按钮，只保留中间切换按钮 */
.carousel-nav {
  display: none !important;
}

/* 确保中间切换按钮（dots）保持可见 */
.carousel-dots {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.carousel-dot {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* 微信按钮样式 */
.wechat-btn {
  background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
  color: white;
  position: relative;
}

.wechat-btn:hover {
  background: linear-gradient(135deg, #06ad56 0%, #059e4e 100%);
  box-shadow: 0 8px 25px rgba(7, 193, 96, 0.3);
}

/* 微信二维码弹窗样式 */
.wechat-qr-popup {
  position: absolute;
  right: calc(100% + 20px);
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 20px;
  min-width: 190px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
  z-index: 1002;
  pointer-events: none;
  border: 1px solid #e5e7eb;
}

.wechat-btn:hover .wechat-qr-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-8px);
  pointer-events: auto;
}

.qr-container {
  text-align: center;
}

.qr-image {
  width: 150px;
  height: 150px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #f3f4f6;
}

.qr-text {
  font-size: 0.875rem;
  color: #374151;
  font-weight: 500;
  margin: 0 0 4px 0;
}

.wechat-id {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 400;
  margin: 0;
  padding: 4px 8px;
  background: #f9fafb;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

/* 响应式微信二维码弹窗 */
@media (max-width: 768px) {
  .wechat-qr-popup {
    right: calc(100% + 16px);
    padding: 16px;
    min-width: 160px;
  }
  
  .qr-image {
    width: 120px;
    height: 120px;
  }
  
  .qr-text {
    font-size: 0.8rem;
  }
  
  .wechat-id {
    font-size: 0.7rem;
    padding: 3px 6px;
  }
}

@media (max-width: 480px) {
  .wechat-qr-popup {
    right: calc(100% + 12px);
    padding: 14px;
    min-width: 140px;
  }
  
  .qr-image {
    width: 100px;
    height: 100px;
  }
  
  .qr-text {
    font-size: 0.75rem;
  }
  
  .wechat-id {
    font-size: 0.65rem;
    padding: 2px 4px;
  }
}
