/**
 * Carousel Component Styles
 * 轮播图组件样式
 */

/* 轮播图容器 */
.carousel-wrapper {
  position: relative;
  width: 100%;
  max-width: 1200px; /* 跟页面内容宽度适配，图片会按比例等比缩放 */
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 幻灯片容器 */
.carousel-slides {
  position: relative;
  width: 100%;
  /* 使用 16:9 比例随宽度自适应高度，而不是死固定 1080px */
  aspect-ratio: 16 / 9;
  background-color: #f0f0f0;
}

/* 单个幻灯片 */
.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(1.1);
}

.carousel-slide.active {
  opacity: 1;
  z-index: 1;
  transform: scale(1);
}

/* 幻灯片图片 */
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background-color: #f0f0f0;
}

/* 图片说明文字 */
.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: white;
  padding: 30px 20px 20px;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 控制按钮 */
.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-control:hover {
  background-color: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.carousel-control:active {
  transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
  left: 20px;
}

.carousel-next {
  right: 20px;
}

.carousel-control span {
  display: block;
  line-height: 1;
}

/* 指示器容器 */
.carousel-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 2;
}

/* 单个指示器 */
.carousel-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.carousel-indicator:hover {
  background-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

.carousel-indicator.active {
  background-color: white;
  transform: scale(1.3);
}

/* 空状态 */
.carousel-empty {
  text-align: center;
  padding: 100px 20px;
  color: #666;
  font-size: 1.2rem;
}

/* 响应式设计 - 平板 (max-width: 768px) */
@media (max-width: 768px) {
  .carousel-wrapper {
    border-radius: 4px;
  }
  
  .carousel-caption {
    font-size: 1.2rem;
    padding: 20px 15px 15px;
  }

  .carousel-control {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .carousel-prev {
    left: 10px;
  }

  .carousel-next {
    right: 10px;
  }

  .carousel-indicator {
    width: 10px;
    height: 10px;
  }
  
  .carousel-indicators {
    gap: 8px;
  }
}

/* 响应式设计 - 手机 (max-width: 480px) */
@media (max-width: 480px) {
  .carousel-wrapper {
    border-radius: 0;
    margin: 0 -0.5rem;
  }
  
  .carousel-caption {
    font-size: 1rem;
    padding: 15px 10px 10px;
    line-height: 1.4;
  }

  .carousel-control {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }

  .carousel-prev {
    left: 5px;
  }

  .carousel-next {
    right: 5px;
  }

  .carousel-indicators {
    bottom: 10px;
    gap: 6px;
  }

  .carousel-indicator {
    width: 8px;
    height: 8px;
    border-width: 1.5px;
  }
}

/* 可访问性增强 */
.carousel-control:focus,
.carousel-indicator:focus {
  outline: 2px solid var(--primary-color, #4A90E2);
  outline-offset: 2px;
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  .carousel-slide {
    transition: none;
  }
  
  .carousel-control,
  .carousel-indicator {
    transition: none;
  }
}
