@import './variables.css';
@import './utilities.css';

/* Base section styles */
.google-reviews-section {
  background-color: var(--white);
  padding: var(--spacing-xl) var(--spacing-md);
  text-align: center;
  font-family: var(--font-secondary);
  overflow: hidden;
  position: relative;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, var(--font-size-xl));
  font-weight: 500;
  color: var(--black);
  margin-bottom: var(--spacing-xl);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Reviews carousel container */
.reviews-carousel {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  min-height: 300px;
}

/* Infinite Carousel Styles */
.InfiniteCarousel {
  position: relative;
  width: 100%;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 var(--spacing-xl);
}

.InfiniteCarouselFrame {
  width: 100%;
  overflow: hidden;
  position: relative;
  padding: var(--spacing-sm) 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  will-change: transform;
  min-height: 300px;
}

.InfiniteCarouselFrame ul,
.reviews-container {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  transform-style: preserve-3d;
  width: max-content;
  user-select: none;
}

.InfiniteCarouselSlide {
  flex: 0 0 auto;
  width: 380px !important;
  margin: 0 calc(var(--spacing-md) / 2) !important;
  cursor: pointer;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  will-change: transform;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  perspective: 1000px;
  min-height: 250px;
  user-select: none;
}

.InfiniteCarouselSlide:hover {
  transform: translateY(-2px);
}

.review-slide {
  height: 100%;
  padding: var(--spacing-xs);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  transform-style: preserve-3d;
}

/* Review Card Styles */
.review-card {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-font-smoothing: subpixel-antialiased;
}

/* Review Header */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
  gap: var(--spacing-sm);
}

.wrapper-review-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Avatar styles */
.review-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: var(--surface);
  display: block;
}

.review-info {
  text-align: left;
  min-width: 0;
}

.review-author {
  font-weight: 500;
  font-size: var(--font-size-base);
  color: var(--black);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-time {
  font-size: var(--font-size-sm);
  color: var(--black);
  opacity: 0.6;
}

/* Rating Stars */
.review-rating {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

.star {
  font-size: var(--font-size-base);
  line-height: 1;
}

.star-red {
  color: var(--coral);
}

/* Review Content */
.review-line {
  width: 32px;
  height: 1px;
  background-color: var(--coral);
  margin: var(--spacing-sm) 0;
  opacity: 0.7;
}

.review-comment {
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--black);
  flex-grow: 1;
  margin: 0;
  font-style: italic;
  position: relative;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-left: var(--spacing-sm);
}

/* Navigation Arrows */
.InfiniteCarouselArrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  z-index: 10;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333333;
  opacity: 0.9;
  font-size: 20px;
  font-weight: 700;
}

.arrow-icon {
  color: #333333;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
}

/* Removed CSS pseudo-elements to prevent duplicate arrows */

.InfiniteCarouselArrowPrev {
  left: -16px;
}

.InfiniteCarouselArrowNext {
  right: -16px;
}

.InfiniteCarouselArrow:hover {
  background-color: var(--coral);
  color: #ffffff;
  border-color: var(--coral);
  opacity: 1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%) scale(1.1);
}

.InfiniteCarouselArrow:hover .arrow-icon {
  color: #ffffff;
}

.InfiniteCarouselArrow:active {
  transform: translateY(-50%) scale(0.95);
}

/* Loading & Error States */
.reviews-loading,
.reviews-error {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-xl) var(--spacing-md);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--blue);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.reviews-loading-text {
  color: var(--black);
  font-size: var(--font-size-base);
  opacity: 0.8;
}

.reviews-error-icon {
  font-size: 32px;
  margin-bottom: var(--spacing-xs);
  opacity: 0.8;
}

.reviews-error-message {
  font-size: var(--font-size-lg);
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
  color: var(--black);
}

.reviews-error-details {
  font-size: var(--font-size-base);
  color: var(--black);
  opacity: 0.7;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .InfiniteCarouselSlide {
    width: 340px !important;
  }
  
  .InfiniteCarouselArrow {
    width: 36px;
    height: 36px;
  }

  .InfiniteCarouselArrow::before {
    width: 12px;
    height: 12px;
    border-width: 2px;
  }
  
  .InfiniteCarousel {
    padding: 0 var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .InfiniteCarouselSlide {
    width: 300px !important;
  }
  
  .review-comment {
    -webkit-line-clamp: 3;
  }
  
  .InfiniteCarouselArrow {
    display: none;
  }
}

/* Print styles */
@media print {
  .google-reviews-section {
    break-inside: avoid;
    border: none;
  }

  .InfiniteCarousel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
  }

  .InfiniteCarouselArrow {
    display: none;
  }

  .review-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .review-card,
  .InfiniteCarouselSlide,
  .InfiniteCarouselArrow {
    transition: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
  .review-card {
    border: 2px solid var(--black);
    box-shadow: none;
  }

  .review-time {
    opacity: 1;
  }

  .review-line {
    background-color: var(--black);
    opacity: 1;
  }

  .InfiniteCarouselArrow {
    border: 2px solid var(--black);
    box-shadow: none;
  }

  .review-comment::before {
    color: var(--black);
    opacity: 1;
  }
}

