/* Bootstrap Carousel Touch/Swipe Fix */

/* Ensure carousel containers are properly positioned for touch events */
.carousel {
  position: relative;
  touch-action: pan-y !important; /* Allow vertical scroll but enable horizontal swipe */
}

.carousel-inner {
  position: relative;
  width: 100%;
  overflow: hidden;
  /* Ensure touch events are captured */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.carousel-item {
  position: relative;
  display: none;
  float: left;
  width: 100%;
  margin-right: -100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: transform .6s ease-in-out;
}

.carousel-item.active {
  display: block;
}

/* Ensure images don't block touch events */
.carousel-item img {
  pointer-events: none; /* Images shouldn't capture touch events */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

/* Fix for overview carousel in detail pages */
.overview__left.carousel {
  /* Remove any conflicting styles */
  overflow: visible;
}

.overview__left .carousel-inner {
  /* Ensure full width for touch area */
  width: 100%;
}

.overview__left .carousel-item {
  /* Ensure items take full width */
  width: 100%;
}

/* Carousel controls positioning */
.carousel-control-prev,
.carousel-control-next {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15%;
  padding: 0;
  color: #000;
  text-align: center;
  background: none;
  border: 0;
  opacity: 0.5;
  transition: opacity 0.15s ease;
  cursor: pointer;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
  opacity: 0.9;
}

.carousel-control-prev {
  left: 0;
}

.carousel-control-next {
  right: 0;
}

/* Carousel indicators */
.carousel-indicators {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 0;
  margin-right: 15%;
  margin-bottom: 1rem;
  margin-left: 15%;
  list-style: none;
}

.carousel-indicators button {
  box-sizing: content-box;
  flex: 0 1 auto;
  width: 30px;
  height: 3px;
  padding: 0;
  margin-right: 3px;
  margin-left: 3px;
  text-indent: -999px;
  cursor: pointer;
  background-color: #000;
  background-clip: padding-box;
  border: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  opacity: 0.5;
  transition: opacity 0.6s ease;
}

.carousel-indicators button.active {
  opacity: 1;
}

/* Mobile touch improvements */
@media (hover: none) and (pointer: coarse) {
  .carousel {
    touch-action: pan-y pinch-zoom !important;
  }

  .carousel-inner {
    /* Increase touch target area on mobile */
    min-height: 200px;
  }
}

/* Fix for detail page carousels */
#carouselAppDetail,
#carouselPmqlDetail,
#carouselQlmgDetail,
#carouselQlvhDetail {
  /* Ensure proper touch handling */
  touch-action: pan-y !important;
}

/* Ensure figure elements don't interfere */
figure.carousel-item {
  margin: 0;
  padding: 0;
}