/**
 * Testimonial API Component Styles
 * Skeleton loading states, error handling, and animations
 */

/* ============================================
   SKELETON LOADING STATES
   ============================================ */

.testimonial-loading {
  width: 100%;
}

.skeleton-row {
  margin: 0 -15px;
}

.skeleton-row > [class*="col-"] {
  padding: 0 15px;
}

.skeleton-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  min-height: 180px;
}

/* Skeleton shimmer effect */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-gray-4) 25%,
    var(--color-gray-3) 50%,
    var(--color-gray-4) 75%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

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

.skeleton-name {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-rating {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.skeleton-star {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 70%;
}

/* ============================================
   ERROR STATE
   ============================================ */

.testimonial-error {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  padding: 40px 20px;
}

.error-content {
  text-align: center;
  max-width: 400px;
}

.error-icon {
  font-size: 48px;
  color: var(--color-error, #dc3545);
  margin-bottom: 16px;
}

.error-icon i {
  animation: error-pulse 2s ease-in-out infinite;
}

@keyframes error-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.error-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 8px;
}

.error-message {
  font-size: 14px;
  color: var(--color-body);
  margin-bottom: 24px;
  line-height: 1.6;
}

.retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.retry-btn.is-retrying i {
  animation: spin 1s linear infinite;
}

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

/* ============================================
   LOADING CONTAINER STATES
   ============================================ */

.testimonial-loading.is-loading {
  opacity: 1;
}

.testimonial-loading {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ============================================
   TESTIMONIAL GRID CONTAINER
   ============================================ */

.testimonial-grid-container {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.testimonial-grid-container.is-loaded {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.testimonial-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-body);
}

.testimonial-empty p {
  font-size: 16px;
  opacity: 0.7;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 991px) {
  .skeleton-card {
    padding: 20px;
    margin-bottom: 16px;
  }

  .testimonial-error {
    min-height: 250px;
  }
}

@media (max-width: 767px) {
  .skeleton-card {
    padding: 16px;
    margin-bottom: 12px;
  }

  .skeleton-name {
    width: 50%;
  }

  .error-icon {
    font-size: 36px;
  }

  .error-title {
    font-size: 18px;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

.dark-mode .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 25%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.1) 75%
  );
  background-size: 200% 100%;
}

.dark-mode .skeleton-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .error-title {
  color: var(--color-white);
}

.dark-mode .testimonial-empty {
  color: var(--color-gray-2);
}

/* ============================================
   FADE EFFECT CONTROL
   ============================================ */

/* Hide fade effect when there are fewer than 10 testimonials */
.testimonial-sec2.no-fade-effect::before {
  display: none !important;
}

/* Also handle dark mode variant */
.dark-mode .testimonial-sec2.no-fade-effect::before,
.active-body .testimonial-sec2.no-fade-effect::before {
  display: none !important;
}
