/* Carousel Container Styles */
#home-carousel-container {
  margin: 0 0 40px 0; /* Remove any horizontal margins */
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 100%; /* Ensure full width */
  padding: 0; /* Remove any padding */
  overflow: hidden; /* Hide any overflow */
  max-width: 100vw; /* Prevent exceeding viewport width */
  display: block !important; /* Ensure block display with !important */
  height: 500px; /* Fixed height to prevent layout shifts */
  visibility: visible !important; /* Ensure visibility */
}

/* Carousel Animation */
.carousel-fade .carousel-item {
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.carousel-fade .carousel-item.active {
  opacity: 1;
}

/* Image Container to Maintain Aspect Ratio */
.carousel-image-container {
  height: 500px; /* Reduced height to eliminate white space */
  width: 100%;
  overflow: hidden;
  position: relative;
  background-color: #003264;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0; /* Ensure no margin */
  padding: 0; /* Ensure no padding */
  max-width: 100%; /* Prevent exceeding parent width */
}

.carousel-image {
  position: absolute !important; /* Force position with !important */
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  min-width: 100% !important;
  min-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: cover !important;
  object-position: center center !important;
  margin: 0 !important;
  padding: 0 !important;
  /* Improve image loading appearance */
  transition: opacity 0.3s ease-in;
  opacity: 0.9; /* Start slightly transparent and fade in when fully loaded */
  background-color: #003264; /* Match container background */
}

/* Caption Styling */
.carousel-caption {
  background: linear-gradient(to right, rgba(0, 50, 100, 0.9), rgba(0, 50, 100, 0.7));
  padding: 25px 30px;
  border-radius: 8px;
  max-width: 600px;
  text-align: left;
  left: 10%;
  right: auto;
  bottom: 80px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border-left: 5px solid #F4C430;
}

.carousel-caption h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #F4C430;
  margin-bottom: 15px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.carousel-caption p {
  font-size: 1.3rem;
  color: #FFFFFF;
  margin-bottom: 20px;
  font-weight: 300;
}

/* Carousel Button */
.carousel-btn {
  background-color: #F4C430;
  color: #003264;
  font-weight: 600;
  border: 2px solid #F4C430;
  padding: 10px 20px;
  border-radius: 30px;
  transition: all 0.3s ease;
}

.carousel-btn:hover {
  background-color: #FFFFFF;
  color: #003264;
  border-color: #F4C430;
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Standard Bootstrap carousel controls with slight enhancements */
.carousel-control-prev,
.carousel-control-next {
  width: 5%;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

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

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 30px;
  height: 30px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  background-size: 60%;
  background-position: center;
}

/* Carousel Indicators */
.carousel-indicators {
  bottom: 20px;
}

.carousel-indicators button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 5px;
  background-color: rgba(255, 255, 255, 0.5);
  border: 2px solid transparent;
}

.carousel-indicators button.active {
  background-color: #F4C430;
  transform: scale(1.2);
}

/* Responsive Adjustments */
@media (max-width: 992px) {
  .carousel-image-container {
    height: 500px;
  }
  
  .carousel-caption {
    max-width: 80%;
    bottom: 60px;
    padding: 20px 25px;
  }
  
  .carousel-caption h2 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .carousel-image-container {
    height: 400px;
  }
  
  .carousel-caption {
    left: 50%;
    transform: translateX(-50%);
    bottom: 40px;
    text-align: center;
    padding: 15px 20px;
  }
  
  .carousel-caption h2 {
    font-size: 1.8rem;
  }
  
  .carousel-caption p {
    font-size: 1.1rem;
    margin-bottom: 15px;
  }
}

@media (max-width: 576px) {
  .carousel-image-container {
    height: 350px;
  }
  
  #home-carousel-container {
    margin-bottom: 20px; /* Reduced from default 40px */
  }
  
  .carousel-caption {
    max-width: 90%;
    bottom: 30px;
    padding: 12px 15px;
  }
  
  .carousel-caption h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  
  .carousel-caption p {
    font-size: 1rem;
    margin-bottom: 10px;
  }
  
  .carousel-btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }
}
