// ======================================
// BOOTSTRAP 5 + BOOTSTRAPVUENEXT CAROUSEL
// ======================================
// This file ensures proper carousel styling with Bootstrap 5 and BootstrapVueNext

// ======================================
// CAROUSEL BASE STYLING
// ======================================

.carousel {
  position: relative;
  background-color: #f8f9fa;
  border-radius: 0.375rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.carousel-inner {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-item {
  position: relative;
  display: none;
  float: left;
  width: 100%;
  margin-right: -100%;
  backface-visibility: hidden;
  transition: transform 0.6s ease-in-out;

  &.active,
  &.carousel-item-next,
  &.carousel-item-prev {
    display: block;
  }

  &.carousel-item-next:not(.carousel-item-start),
  &.active.carousel-item-end {
    transform: translateX(100%);
  }

  &.carousel-item-prev:not(.carousel-item-end),
  &.active.carousel-item-start {
    transform: translateX(-100%);
  }
}

// ======================================
// CAROUSEL IMAGES
// ======================================

.carousel-item img {
  display: block;
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 0;
}

// ======================================
// CAROUSEL CONTROLS
// ======================================

.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: #fff;
  text-align: center;
  background: none;
  border: 0;
  opacity: 0.5;
  transition: opacity 0.15s ease;

  &:hover,
  &:focus {
    color: #fff;
    text-decoration: none;
    outline: 0;
    opacity: 0.9;
  }
}

.carousel-control-prev {
  left: 0;
}

.carousel-control-next {
  right: 0;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  background-repeat: no-repeat;
  background-position: 50%;
  background-size: 100% 100%;
}

.carousel-control-prev-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
}

.carousel-control-next-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

// ======================================
// 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%;

  [data-bs-target] {
    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: #fff;
    background-clip: padding-box;
    border: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    opacity: 0.5;
    transition: opacity 0.6s ease;

    &.active {
      opacity: 1;
    }
  }
}

// ======================================
// CAROUSEL CAPTIONS
// ======================================

.carousel-caption {
  position: absolute;
  right: 15%;
  bottom: 1.25rem;
  left: 15%;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  color: #fff;
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
  border-radius: 0.375rem;

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  }

  p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  }
}

// ======================================
// BOOTSTRAP VUE NEXT SPECIFIC FIXES
// ======================================

// Fix for BootstrapVueNext carousel wrapper
.carousel.b-carousel {
  position: relative;
  display: block;
}

// Ensure slides transition properly
.carousel .carousel-item {
  transition: transform 0.6s ease-in-out;
}

// Fix fade transition if used
.carousel-fade {
  .carousel-item {
    opacity: 0;
    transition-property: opacity;
    transform: none;

    &.active {
      opacity: 1;
    }

    &.carousel-item-next.carousel-item-start,
    &.carousel-item-prev.carousel-item-end {
      z-index: 1;
      opacity: 1;
    }

    &.active.carousel-item-start,
    &.active.carousel-item-end {
      z-index: 0;
      opacity: 0;
      transition: opacity 0s 0.6s;
    }
  }
}

// ======================================
// RESPONSIVE CAROUSEL
// ======================================

@media (max-width: 768px) {
  .carousel-control-prev,
  .carousel-control-next {
    width: 10%;
  }

  .carousel-indicators {
    margin-right: 10%;
    margin-left: 10%;
  }

  .carousel-caption {
    right: 10%;
    left: 10%;
    padding-top: 1rem;
    padding-bottom: 1rem;

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      font-size: 1.1rem;
    }

    p {
      font-size: 0.9rem;
    }
  }

  .carousel-item img {
    height: 250px;
  }
}

// ======================================
// CAROUSEL ANIMATION ENHANCEMENTS
// ======================================

.carousel {
  &:hover {
    .carousel-control-prev,
    .carousel-control-next {
      opacity: 0.8;
    }
  }
}

// Smooth indicator transitions
.carousel-indicators [data-bs-target] {
  transition: all 0.3s ease;

  &:hover {
    opacity: 0.8;
    transform: scale(1.1);
  }

  &.active {
    background-color: #007bff;
    opacity: 1;
    transform: scale(1.2);
  }
}

// Loading state for images
.carousel-item img[src*='picsum'] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
