/** 
 * Google Reviews Widget v2.2 Styles
 * File: assets/css/style.css
 */

/* Container */
.google-reviews-container {
  position: relative;
  width: 100%;
}

/* ===== Summary Bar (top) ===== */

.google-reviews-summary {
  width: 100%;
  margin-bottom: 20px;
}

.google-reviews-summary-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 25px;
  border-radius: 999px;
  background-color: #222222; /* default, kan override:as via Elementor */
  color: #ffffff; /* default, kan override:as via Elementor */
  min-height: 70px;
}

/* Left side: rating + stars */

.google-reviews-summary-rating {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.google-reviews-summary-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.google-reviews-summary-stars {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.google-reviews-summary-stars .star {
  font-size: 18px;
  color: #555555;
  line-height: 1;
}

.google-reviews-summary-stars .star.filled {
  color: #fbbc04; /* Google-ish yellow */
}

/* Middle: text "16,674 reviews on Google" */

.google-reviews-summary-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: start;
}

.google-reviews-summary-text {
  font-size: 13px;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.google-reviews-summary-google-label {
  font-weight: 600;
  margin-left: 4px;
  white-space: nowrap;
}

/* Right side: CTA button */

.google-reviews-summary-cta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.google-reviews-summary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 999px;
  background-color: #1a73e8;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.google-reviews-summary-button:hover {
  background-color: #1c82ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.google-reviews-summary-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ===== Responsive breakpoints for summary bar ===== */

@media (max-width: 1024px) {
  .google-reviews-summary-inner {
    display: grid;
    grid-row: 1fr 1fr;
    grid-column: 1fr 1fr;
    border-radius: 16px;
    padding: 20px;
    gap: 16px;
    min-height: auto;
  }

  .google-reviews-summary-rating {
    width: 100%;
  }

  .google-reviews-summary-meta {
    width: 100%;
    text-align: left;
    grid-column: 2 / 2;
  }

  .google-reviews-summary-text {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .google-reviews-summary-cta {
    width: 100%;
    grid-row: 2 / 2;
    grid-column: 1 / 3;
  }

  .google-reviews-summary-button {
    width: 100%;
    grid-column: -1 / 1;
    padding: 12px 20px;
  }

  .google-reviews-footer {
    justify-content: flex-start;
  }

  .google-reviews-footer-button {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
  }
}

@media (max-width: 480px) {
  .google-reviews-summary-inner {
    padding: 16px;
    gap: 12px;
  }

  .google-reviews-summary-value {
    font-size: 22px;
  }

  .google-reviews-summary-stars .star {
    font-size: 16px;
  }

  .google-reviews-summary-text {
    font-size: 11px;
  }

  .google-reviews-summary-button {
    font-size: 12px;
    padding: 10px 16px;
  }
}

/* ===== Footer buttons (bottom) ===== */

.google-reviews-footer {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.google-reviews-footer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.1s ease;
}

.google-reviews-footer-button-primary {
  background-color: #1a73e8;
  color: #ffffff;
  border-color: #1a73e8;
}

.google-reviews-footer-button-primary:hover {
  background-color: #1c82ff;
  border-color: #1c82ff;
  transform: translateY(-1px);
}

.google-reviews-footer-button-secondary {
  background-color: transparent;
  color: #e0e0e0;
  border-color: #555555;
}

.google-reviews-footer-button-secondary:hover {
  background-color: #333333;
  color: #ffffff;
  border-color: #777777;
}

/* ===== Wrapper & Layouts ===== */

.google-reviews-wrapper {
  width: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  gap: 20px; /* default gap, kan override:as via Elementor */
}

/* Grid Layout (Elementor sätter grid-template-columns) */
.google-reviews-wrapper.layout-grid {
  display: grid;
}

/* Fallback om ingen Elementor-styling laddas */
.google-reviews-wrapper.layout-grid .review-card {
  min-width: 0;
}

/* List Layout */
.google-reviews-wrapper.layout-list {
  display: flex;
  flex-direction: column;
}

/* Carousel Layout */
.google-reviews-wrapper.layout-carousel {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  justify-content: flex-start;
}

.google-reviews-wrapper.layout-carousel .review-card {
  flex: 0 0 auto;
  width: 350px;
  max-width: 90vw;
}

/* ===== Carousel Navigation ===== */

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: #ffffff;
  color: #333333;
  border: 1px solid #e0e0e0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-nav:hover:not(:disabled) {
  background-color: #f5f5f5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%) scale(1.1);
}

.carousel-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-prev {
  left: 5px;
}

.carousel-next {
  right: 5px;
}

/* ===== Review Card ===== */

.review-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.review-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Review Header */
.review-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.reviewer-photo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.reviewer-info {
  flex: 1;
  min-width: 0;
}

.reviewer-name {
  margin: 0 0 5px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Star Rating */
.star-rating {
  display: flex;
  gap: 2px;
  align-items: center;
}

.star-rating .star {
  color: #ddd;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s ease;
}

.star-rating .star.filled {
  color: #ffa500;
}

/* Review Content */
.review-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.review-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.review-time {
  font-size: 12px;
  color: #999;
  margin-top: auto;
  display: block;
}

/* Loading State */
.google-reviews-wrapper.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Empty State */
.google-reviews-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

/* ===== AI Summary Card ===== */

.review-card.ai-summary {
  border: 1px dashed rgba(0, 0, 0, 0.18);
}

.review-card.ai-summary .star-rating {
  display: none;
}

.review-card.ai-summary .reviewer-photo {
  object-fit: contain;
  background: rgba(0, 0, 0, 0.04);
}

.review-card.ai-summary .review-time {
  font-style: italic;
}

/* ===== Responsive Design ===== */

@media (max-width: 1024px) {
  /* inget grid-specifikt här längre, Elementor styr kolumnerna */
}

@media (max-width: 768px) {
  .google-reviews-wrapper.layout-carousel .review-card {
    width: 300px;
  }

  .carousel-nav {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
}

/* På riktigt små skärmar: forcera single column-grid */
@media (max-width: 480px) {
  .google-reviews-wrapper.layout-grid {
    grid-template-columns: 1fr !important;
  }

  .google-reviews-wrapper.layout-carousel .review-card {
    width: 280px;
  }

  .review-card {
    padding: 15px;
  }

  .reviewer-photo {
    width: 40px;
    height: 40px;
  }

  .reviewer-name {
    font-size: 14px;
  }

  .star-rating .star {
    font-size: 16px;
  }

  .review-text {
    font-size: 13px;
  }
}

/* Accessibility */
.carousel-nav:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .review-card,
  .carousel-nav,
  .google-reviews-wrapper,
  .google-reviews-summary-inner,
  .google-reviews-summary-button,
  .google-reviews-footer-button {
    transition: none;
  }
}

/* Print Styles */
@media print {
  .carousel-nav {
    display: none;
  }

  .google-reviews-wrapper.layout-carousel {
    flex-wrap: wrap;
  }

  .review-card {
    page-break-inside: avoid;
  }

  .google-reviews-summary,
  .google-reviews-footer {
    page-break-inside: avoid;
  }
}
