/* Testimonials Section */
.testimonials-section {
  padding: 3rem 0;
  background: var(--bg-light); /* Matches about-carousel-section */
}

.carousel-container.testimonials {
  overflow: hidden; /* Ensure no overflow during animation */
}

#testimonialsCarousel {
  display: grid;
  grid-template-columns: repeat(var(--testimonial-count), minmax(300px, 1fr));
  gap: 1.5rem;
  width: calc(var(--testimonial-count) * 280px); /* Dynamic width */
  animation: scrollLeft 20s linear infinite; /* Continuous scroll */
}

#testimonialsCarousel.paused {
  animation-play-state: paused; /* Pause on hover */
}

.carousel-slide.testimonial-slide {
  opacity: 1; /* Always visible for multi-card view */
  position: relative;
}

.testimonial-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition: transform 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* FIX 2: Change alignment from 'space-between' to 'flex-start' */
  justify-content: flex-start;
}

.carousel-track {
  min-height: 300px;
}

.testimonial-card:hover {
  transform: translateY(-5px); /* Subtle lift on hover */
}

.testimonial-name {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary-color); /* Matches theme */
  margin-bottom: 1rem;
}

.testimonial-text {
  color: var(--text-dark);
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.testimonial-text.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 5; /* Limit to 5 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 8em; /* Fallback for older browsers (5 lines * ~1.6em line-height) */
}

/* FIX 2: Add a fixed min-height for the button/button space */
.read-more-btn-container {
  min-height: 48px; /* Enough space for button + margin (e.g., 1.5rem height + 1rem margin) */
  display: flex;
  justify-content: center;
  align-items: center;
}

.read-more-btn {
  background: var(--gradient-primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  /* FIX 2: Remove auto margin to prevent pushing to bottom */
  /* margin-top: auto; */
  margin-top: 1rem; /* Add standard top margin for consistent spacing */
}

.read-more-btn.hidden {
  display: none; /* Hide for short testimonials */
}

.read-more-btn:hover {
  background: var(--primary-color); /* Hover effect */
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000; /* Above floating panel */
  opacity: 0;
  transition: opacity 0.3s;
}

.modal:not(.hidden) {
  opacity: 1;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 16px; /* Matches carousel slides */
  max-width: 600px;
  max-height: 600px;
  overflow-y: auto;
  width: 90%;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* .close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
  color: var(--text-light);
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--primary-color);
} */

.modal-content h3 {
  font-size: 1.6rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.modal-content p {
  color: var(--text-dark);
  line-height: 1.7;
}

/* Continuous Scroll Animation */
@keyframes scrollLeft {
  0% {
    transform: translateX(0);
  }
  100% {
    /* transform: translateX(calc(-280px * var(--testimonial-count) / 16)); */
    transform: translateX(-15%);
  }
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  #testimonialsCarousel {
    grid-template-columns: repeat(var(--testimonial-count), minmax(200px, 1fr));
    width: calc(var(--testimonial-count) * 230px);
  }
}

@media (max-width: 768px) {
  #testimonialsCarousel {
    grid-template-columns: repeat(var(--testimonial-count), minmax(180px, 1fr));
    width: calc(var(--testimonial-count) * 200px);
  }
  .testimonial-card {
    padding: 1rem;
  }
  .testimonial-name {
    font-size: 1.2rem;
  }
  .testimonial-text {
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  #testimonialsCarousel {
    grid-template-columns: repeat(var(--testimonial-count), 1fr);
    width: calc(var(--testimonial-count) * 100%);
  }
  .carousel-nav {
    padding: 0 0.5rem;
  }
}
