/* 16:9 Fixed Aspect Ratio Carousel Styles */
/* This file ensures the carousel maintains a perfect 16:9 ratio on all devices */

/* Main carousel container with 16:9 aspect ratio */
.carousel-container.carousel-16-9,
.carousel-16-9 {
  width: 100% !important;
  max-width: none !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Force 16:9 ratio with viewport width calculation */
.carousel-container.carousel-16-9,
.carousel-16-9 {
  height: 70vh !important; /* Fixed height of 60vh */
  max-height: 70vh !important; /* Maximum height set to 60vh */
}

/* Use aspect-ratio when supported by browser */
@supports (aspect-ratio: 16/9) {
  .carousel-container.carousel-16-9,
  .carousel-16-9 {
    aspect-ratio: 16/9 !important;
    height: auto !important; /* Let aspect-ratio handle the height */
    width: 100vw !important; /* Full viewport width */
    margin-left: calc(-50vw + 50%); /* Center the carousel */
    margin-right: calc(-50vw + 50%);
  }
}

/* Ensure proper positioning of carousel slides */
.carousel-16-9 .carousel-slide {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  z-index: 0;
}

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

/* Background image styling for 16:9 ratio */
.carousel-16-9 .carousel-slide .bg-cover {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease-in-out;
}

/* Content positioning within 16:9 container */
.carousel-16-9 .carousel-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 2rem;
}

/* Responsive adjustments for 16:9 ratio */
@media (max-width: 640px) {
  .carousel-16-9 .carousel-content {
    padding: 1rem;
  }
  
  .carousel-container.carousel-16-9,
  .carousel-16-9 {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .carousel-16-9 .carousel-content {
    padding: 1.5rem;
  }
  
  .carousel-container.carousel-16-9,
  .carousel-16-9 {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
}

@media (min-width: 1025px) {
  .carousel-16-9 .carousel-content {
    padding: 2rem;
  }
  
  .carousel-container.carousel-16-9,
  .carousel-16-9 {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
}

/* Enhanced Navigation elements positioning for 16:9 */
.carousel-16-9 .carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease-in-out;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.carousel-16-9 .carousel-nav:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.carousel-16-9 .carousel-nav:active {
  transform: translateY(-50%) scale(1.05);
}

.carousel-16-9 .carousel-nav[data-direction="prev"] {
  left: 1.5rem;
}

.carousel-16-9 .carousel-nav[data-direction="next"] {
  right: 1.5rem;
}

/* Enhanced Navigation dots positioning for 16:9 */
.carousel-16-9 .carousel-dots {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2rem;
  backdrop-filter: blur(4px);
}

.carousel-16-9 .carousel-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  position: relative;
}

.carousel-16-9 .carousel-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.5rem;
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.3s ease-in-out;
}

.carousel-16-9 .carousel-dot.active,
.carousel-16-9 .carousel-dot:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.2);
  box-shadow: 0 1px 4px rgba(255, 255, 255, 0.2);
}

.carousel-16-9 .carousel-dot.active::before,
.carousel-16-9 .carousel-dot:hover::before {
  transform: translate(-50%, -50%) scale(1);
}

/* Responsive navigation sizing with enhanced visibility */
@media (max-width: 640px) {
  .carousel-16-9 .carousel-nav {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 2px;
  }
  
  .carousel-16-9 .carousel-nav svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .carousel-16-9 .carousel-dot {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 2px;
  }
  
  .carousel-16-9 .carousel-dot::before {
    width: 0.375rem;
    height: 0.375rem;
  }
  
  .carousel-16-9 .carousel-dots {
    bottom: 1.5rem;
    gap: 0.5rem;
    padding: 0.5rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .carousel-16-9 .carousel-nav {
    width: 3rem;
    height: 3rem;
    border-width: 2px;
  }
  
  .carousel-16-9 .carousel-nav svg {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  .carousel-16-9 .carousel-dots {
    bottom: 1.75rem;
  }
}

@media (min-width: 1025px) {
  .carousel-16-9 .carousel-nav {
    width: 3.5rem;
    height: 3.5rem;
    border-width: 2px;
  }
  
  .carousel-16-9 .carousel-nav svg {
    width: 1.75rem;
    height: 1.75rem;
  }
  
  .carousel-16-9 .carousel-dots {
    bottom: 2.5rem;
  }
}

/* Ensure proper text rendering in 16:9 container */
.carousel-16-9 .carousel-text {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  max-width: 80%;
}

/* Loading state for 16:9 carousel */
.carousel-16-9.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3rem;
  height: 3rem;
  margin: -1.5rem 0 0 -1.5rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 30;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Focus styles for accessibility */
.carousel-16-9 .carousel-nav:focus {
  outline: 3px solid #3b82f6;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Remove focus outline for dots to avoid blue circle effect */
.carousel-16-9 .carousel-dot:focus {
  outline: none;
  box-shadow: none;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .carousel-16-9 .carousel-nav {
    background: rgba(0, 0, 0, 0.7);
    border-width: 3px;
  }
  
  .carousel-16-9 .carousel-dot {
    border-width: 3px;
  }
  
  .carousel-16-9 .carousel-dots {
    background: rgba(0, 0, 0, 0.5);
  }
}

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

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

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